Skip to content

Commit

Permalink
Add parameter and return types to importDXF (#1205)
Browse files Browse the repository at this point in the history
* add parameter and return types
* fix param filename case in docstring
* fix disjointed paragraph in rendered docs
* format example code with black
  • Loading branch information
sethfischer authored Dec 16, 2022
1 parent f49f580 commit 4b4e64b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
9 changes: 6 additions & 3 deletions cadquery/occ_impl/importers/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from math import pi
from typing import List

from ... import cq
from ..shapes import Shape
Expand Down Expand Up @@ -67,14 +68,16 @@ def importStep(fileName):
return cq.Workplane("XY").newObject(solids)


def importDXF(filename, tol=1e-6, exclude=[], include=[]):
def importDXF(
filename: str, tol: float = 1e-6, exclude: List[str] = [], include: List[str] = []
) -> "cq.Workplane":
"""
Loads a DXF file into a Workplane.
All layers are imported by default. Provide a layer include or exclude list
to select layers. Layer names are handled as case-insensitive.
to select layers. Layer names are handled as case-insensitive.
:param fileName: The path and name of the DXF file to be imported
:param filename: The path and name of the DXF file to be imported
:param tol: The tolerance used for merging edges into wires
:param exclude: a list of layer names not to import
:param include: a list of layer names to import
Expand Down
6 changes: 2 additions & 4 deletions doc/importexport.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,8 @@ Importing a DXF profile with default settings and using it within a CadQuery scr
import cadquery as cq
result = (
cq.importers.importDXF('/path/to/dxf/circle.dxf')
.wires().toPending()
.extrude(10)
)
cq.importers.importDXF("/path/to/dxf/circle.dxf").wires().toPending().extrude(10)
)
Note the use of the :py:meth:`Workplane.wires` and :py:meth:`Workplane.toPending` methods to make the DXF profile
ready for use during subsequent operations. Calling ``toPending()`` tells CadQuery to make the edges/wires available
Expand Down

0 comments on commit 4b4e64b

Please sign in to comment.