Arch: small fix in IFC importer
This commit is contained in:
parent
a81c16c391
commit
8b75c6a206
|
@ -123,7 +123,6 @@ def read(filename):
|
|||
|
||||
obj = IfcImport.Get()
|
||||
if DEBUG: print "["+str(int((float(obj.id)/num_lines)*100))+"%] parsing ",obj.id,": ",obj.name," of type ",obj.type
|
||||
meshdata = []
|
||||
|
||||
# retrieving name
|
||||
n = getName(obj)
|
||||
|
@ -136,9 +135,7 @@ def read(filename):
|
|||
else:
|
||||
# build shape
|
||||
shape = None
|
||||
if obj.type in ASMESH:
|
||||
shape = getMesh(obj)[0]
|
||||
elif useShapes:
|
||||
if useShapes:
|
||||
shape = getShape(obj)
|
||||
|
||||
# walls
|
||||
|
@ -191,7 +188,7 @@ def read(filename):
|
|||
|
||||
if not IfcImport.Next():
|
||||
break
|
||||
|
||||
|
||||
# processing non-geometry and relationships
|
||||
parents_temp = dict(ifcParents)
|
||||
import ArchCommands
|
||||
|
@ -245,7 +242,7 @@ def read(filename):
|
|||
ArchCommands.addComponents(ifcObjects[id],parent)
|
||||
else:
|
||||
ArchCommands.removeComponents(ifcObjects[id],parent)
|
||||
|
||||
|
||||
IfcImport.CleanUp()
|
||||
|
||||
else:
|
||||
|
@ -514,7 +511,14 @@ def getShape(obj):
|
|||
"gets a shape from an IfcOpenShell object"
|
||||
import StringIO,Part
|
||||
sh=Part.Shape()
|
||||
sh.importBrep(StringIO.StringIO(obj.mesh.brep_data))
|
||||
try:
|
||||
sh.importBrep(StringIO.StringIO(obj.mesh.brep_data))
|
||||
#sh = Part.makeBox(2,2,2)
|
||||
#print "getting shape: ",sh,sh.Solids,sh.Volume
|
||||
#for v in sh.Vertexes: print v.Point
|
||||
except:
|
||||
print "Error: malformed shape"
|
||||
return None
|
||||
if not sh.Solids:
|
||||
# try to extract a solid shape
|
||||
if sh.Faces:
|
||||
|
|
Loading…
Reference in New Issue
Block a user