Skip to content

Commit

Permalink
Merge pull request #1372 from sethfischer/import-step-typing
Browse files Browse the repository at this point in the history
Typing for importStep() and importShape()
  • Loading branch information
jmwright authored Jul 24, 2023
2 parents 6b35f59 + 0929ad7 commit 396f0ad
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions cadquery/occ_impl/importers/__init__.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
from math import pi
from typing import List
from typing import List, Literal

import OCP.IFSelect
from OCP.STEPControl import STEPControl_Reader

from ... import cq
from ..shapes import Shape
from .dxf import _importDXF


from OCP.STEPControl import STEPControl_Reader

import OCP.IFSelect

RAD2DEG = 360.0 / (2 * pi)


Expand All @@ -23,25 +21,27 @@ class UNITS:
IN = "in"


def importShape(importType, fileName, *args, **kwargs):
def importShape(
importType: Literal["STEP", "DXF"], fileName: str, *args, **kwargs
) -> "cq.Workplane":
"""
Imports a file based on the type (STEP, STL, etc)
:param importType: The type of file that we're importing
:param fileName: THe name of the file that we're importing
:param fileName: The name of the file that we're importing
"""

# Check to see what type of file we're working with
if importType == ImportTypes.STEP:
return importStep(fileName, *args, **kwargs)
return importStep(fileName)
elif importType == ImportTypes.DXF:
return importDXF(fileName, *args, **kwargs)
else:
raise RuntimeError("Unsupported import type: {!r}".format(importType))


# Loads a STEP file into a CQ.Workplane object
def importStep(fileName):
def importStep(fileName: str) -> "cq.Workplane":
"""
Accepts a file name and loads the STEP file into a cadquery Workplane
Expand Down

0 comments on commit 396f0ad

Please sign in to comment.