importShape in importers.py was not returning anything.
This commit is contained in:
parent
ceadc87bde
commit
8994493b7b
|
@ -637,6 +637,14 @@ class CQ(object):
|
|||
"""
|
||||
exporters.exportSVG(self,fileName)
|
||||
|
||||
def importStep(self,fileName):
|
||||
"""
|
||||
Reads and imports a solid(s) from a STEP file
|
||||
|
||||
:param fileName: The location and name of the STEP file to load
|
||||
"""
|
||||
importers.importStep(self, fileName)
|
||||
|
||||
def rotateAboutCenter(self,axisEndPoint,angleDegrees):
|
||||
"""
|
||||
Rotates all items on the stack by the specified angle, about the specified axis
|
||||
|
|
|
@ -41,7 +41,7 @@ def importShape(importType,fileName):
|
|||
|
||||
#Check to see what type of file we're working with
|
||||
if importType == ImportTypes.STEP:
|
||||
importStep(fileName)
|
||||
return importStep(fileName)
|
||||
|
||||
#Loads a STEP file into a CQ object
|
||||
def importStep(fileName):
|
||||
|
@ -51,16 +51,12 @@ def importStep(fileName):
|
|||
"""
|
||||
|
||||
#Now read and return the shape
|
||||
# try:
|
||||
rshape = Part.read(fileName)
|
||||
try:
|
||||
rshape = Part.read(fileName)
|
||||
|
||||
r = Shape.cast(rshape)
|
||||
#print "loadStep: " + str(r)
|
||||
#print "Faces=%d" % cadquery.CQ(r).solids().size()
|
||||
return cadquery.CQ(r)
|
||||
# except:
|
||||
# raise ValueError("STEP File Could not be loaded")
|
||||
|
||||
if __name__ == '__main__':
|
||||
import unittest
|
||||
unittest.main()
|
||||
r = Shape.cast(rshape)
|
||||
#print "loadStep: " + str(r)
|
||||
#print "Faces=%d" % cadquery.CQ(r).solids().size()
|
||||
return cadquery.CQ(r)
|
||||
except:
|
||||
raise ValueError("STEP File Could not be loaded")
|
||||
|
|
|
@ -35,6 +35,9 @@ class TestImporters(BaseTest):
|
|||
# Reimport the shape from the new STEP file
|
||||
importedShape = importers.importShape(importType,fileName)
|
||||
|
||||
#Check to make sure we got a shape back
|
||||
if not importedShape.ShapeType:
|
||||
raise TypeError("Wrong type imported from STEP file.")
|
||||
def testSTEP(self):
|
||||
"""
|
||||
Tests STEP file import
|
||||
|
|
Loading…
Reference in New Issue
Block a user