From b90fc2fa33e63a943ab91c0cf4c392685159146d Mon Sep 17 00:00:00 2001 From: bweissinger Date: Mon, 26 Nov 2018 16:19:28 -0600 Subject: [PATCH 1/2] Add Shells to STEP import --- cadquery/freecad_impl/importers.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/cadquery/freecad_impl/importers.py b/cadquery/freecad_impl/importers.py index 2c30e50..3e62e97 100644 --- a/cadquery/freecad_impl/importers.py +++ b/cadquery/freecad_impl/importers.py @@ -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") From 16da1ff20e20627b9febf35c6d308422aa9ec72b Mon Sep 17 00:00:00 2001 From: bweissinger Date: Mon, 26 Nov 2018 21:05:57 -0600 Subject: [PATCH 2/2] Use importStep to load temp STEP file --- cadquery/freecad_impl/importers.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/cadquery/freecad_impl/importers.py b/cadquery/freecad_impl/importers.py index 3e62e97..c602217 100644 --- a/cadquery/freecad_impl/importers.py +++ b/cadquery/freecad_impl/importers.py @@ -68,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")