Arch: Fixes to ifc importer to make it compatible with ifcopenshell 0.4
This commit is contained in:
parent
716629006c
commit
eceebf4d71
|
@ -169,6 +169,9 @@ def read(filename):
|
||||||
if str(obj) == str(getAttr(r,"RelatedOpeningElement")):
|
if str(obj) == str(getAttr(r,"RelatedOpeningElement")):
|
||||||
objparentid = int(str(getAttr(r,"RelatingBuildingElement")).split("=")[0].strip("#"))
|
objparentid = int(str(getAttr(r,"RelatingBuildingElement")).split("=")[0].strip("#"))
|
||||||
|
|
||||||
|
else:
|
||||||
|
if hasattr(IfcImport, 'GetBrepData'):
|
||||||
|
obj = IfcImport.GetBrepData()
|
||||||
else:
|
else:
|
||||||
obj = IfcImport.Get()
|
obj = IfcImport.Get()
|
||||||
objid = obj.id
|
objid = obj.id
|
||||||
|
@ -245,11 +248,16 @@ def read(filename):
|
||||||
else:
|
else:
|
||||||
# treat as meshes
|
# treat as meshes
|
||||||
if DEBUG: print "Warning: Object without shape: ",objid, " ", objtype
|
if DEBUG: print "Warning: Object without shape: ",objid, " ", objtype
|
||||||
|
if hasattr(obj,"mesh"):
|
||||||
|
if not hasattr(obj.mesh, 'verts'):
|
||||||
|
obj = IfcImport.Get() # Get triangulated rep of same product
|
||||||
me,pl = getMesh(obj)
|
me,pl = getMesh(obj)
|
||||||
nobj = FreeCAD.ActiveDocument.addObject("Mesh::Feature",n)
|
nobj = FreeCAD.ActiveDocument.addObject("Mesh::Feature",n)
|
||||||
nobj.Label = n
|
nobj.Label = n
|
||||||
nobj.Mesh = me
|
nobj.Mesh = me
|
||||||
nobj.Placement = pl
|
nobj.Placement = pl
|
||||||
|
else:
|
||||||
|
if DEBUG: print "Error: Skipping object without mesh: ",objid, " ", objtype
|
||||||
|
|
||||||
# registering object number and parent
|
# registering object number and parent
|
||||||
if objparentid > 0:
|
if objparentid > 0:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user