Skip to content
This repository has been archived by the owner on Feb 9, 2021. It is now read-only.

Commit

Permalink
Merge 16da1ff into 1c86a97
Browse files Browse the repository at this point in the history
  • Loading branch information
bweissinger committed Nov 27, 2018
2 parents 1c86a97 + 16da1ff commit 3dce9b4
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions cadquery/freecad_impl/importers.py
Expand Up @@ -39,12 +39,16 @@ def importStep(fileName):
try:
rshape = Part.read(fileName)

#Make sure that we extract all the solids
solids = []
# Extract all solids and surfaces
geometry = []
for solid in rshape.Solids:
solids.append(Shape.cast(solid))
geometry.append(Shape.cast(solid))

for shell in rshape.Shells:
geometry.append(Shape.cast(shell))

return cadquery.Workplane("XY").newObject(geometry)

return cadquery.Workplane("XY").newObject(solids)
except:
raise ValueError("STEP File Could not be loaded")

Expand All @@ -64,13 +68,7 @@ def importStepFromURL(url):
webFile.close()
tempFile.close()

rshape = Part.read(tempFile.name)

#Make sure that we extract all the solids
solids = []
for solid in rshape.Solids:
solids.append(Shape.cast(solid))

return cadquery.Workplane("XY").newObject(solids)
# Read saved file and return CQ Workplane object
return importStep(tempFile.name)
except:
raise ValueError("STEP File from the URL: " + url + " Could not be loaded")

0 comments on commit 3dce9b4

Please sign in to comment.