Skip to content

Commit 4b4e64b

Browse files
authored
Add parameter and return types to importDXF (#1205)
* add parameter and return types * fix param filename case in docstring * fix disjointed paragraph in rendered docs * format example code with black
1 parent f49f580 commit 4b4e64b

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

cadquery/occ_impl/importers/__init__.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from math import pi
2+
from typing import List
23

34
from ... import cq
45
from ..shapes import Shape
@@ -67,14 +68,16 @@ def importStep(fileName):
6768
return cq.Workplane("XY").newObject(solids)
6869

6970

70-
def importDXF(filename, tol=1e-6, exclude=[], include=[]):
71+
def importDXF(
72+
filename: str, tol: float = 1e-6, exclude: List[str] = [], include: List[str] = []
73+
) -> "cq.Workplane":
7174
"""
7275
Loads a DXF file into a Workplane.
7376
7477
All layers are imported by default. Provide a layer include or exclude list
75-
to select layers. Layer names are handled as case-insensitive.
78+
to select layers. Layer names are handled as case-insensitive.
7679
77-
:param fileName: The path and name of the DXF file to be imported
80+
:param filename: The path and name of the DXF file to be imported
7881
:param tol: The tolerance used for merging edges into wires
7982
:param exclude: a list of layer names not to import
8083
:param include: a list of layer names to import

doc/importexport.rst

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,8 @@ Importing a DXF profile with default settings and using it within a CadQuery scr
5757
import cadquery as cq
5858
5959
result = (
60-
cq.importers.importDXF('/path/to/dxf/circle.dxf')
61-
.wires().toPending()
62-
.extrude(10)
63-
)
60+
cq.importers.importDXF("/path/to/dxf/circle.dxf").wires().toPending().extrude(10)
61+
)
6462
6563
Note the use of the :py:meth:`Workplane.wires` and :py:meth:`Workplane.toPending` methods to make the DXF profile
6664
ready for use during subsequent operations. Calling ``toPending()`` tells CadQuery to make the edges/wires available

0 commit comments

Comments
 (0)