Skip to content

Commit

Permalink
Typing for importStep() and importShape()
Browse files Browse the repository at this point in the history
  • Loading branch information
sethfischer committed Jul 9, 2023
1 parent fa0abf0 commit 0929ad7
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 0929ad7

Please sign in to comment.