Arch: Export structural nodes to IFC

This commit is contained in:
Yorik van Havre
2023-06-07 10:54:05 +02:00
parent e9936ead80
commit cee922bbbd

View File

@@ -2368,7 +2368,7 @@ def getRepresentation(
placement = ifcbin.createIfcLocalPlacement()
representation = [ifcfile.createIfcShapeRepresentation(context,'Body',solidType,shapes)]
# additional representations?
if Draft.getType(obj) in ["Wall"]:
if Draft.getType(obj) in ["Wall","Structure"]:
addrepr = createAxis(ifcfile,obj,preferences)
if addrepr:
representation = representation + [addrepr]
@@ -2477,9 +2477,14 @@ def getAxisContext(ifcfile):
def createAxis(ifcfile,obj,preferences):
"""Creates an axis for a given wall, if applicable"""
if hasattr(obj,"Base") and hasattr(obj.Base,"Shape") and obj.Base.Shape:
if obj.Base.Shape.ShapeType in ["Wire","Edge"]:
curve = createCurve(ifcfile,obj.Base.Shape,preferences["SCALE_FACTOR"])
shape = None
if getattr(obj,"Nodes",None):
shape = Part.makePolygon([obj.Placement.multVec(v) for v in obj.Nodes])
elif hasattr(obj,"Base") and hasattr(obj.Base,"Shape") and obj.Base.Shape:
shape = obj.Base.Shape
if shape:
if shape.ShapeType in ["Wire","Edge"]:
curve = createCurve(ifcfile,shape,preferences["SCALE_FACTOR"])
if curve:
ctx = getAxisContext(ifcfile)
axis = ifcfile.createIfcShapeRepresentation(ctx,'Axis','Curve2D',[curve])