BIM: NativeIFC 2D support - small fixes

This commit is contained in:
Yorik van Havre
2024-10-17 16:07:21 +02:00
committed by Yorik van Havre
parent 94ccb830ca
commit fcc4eb1370
3 changed files with 9 additions and 2 deletions

View File

@@ -234,6 +234,9 @@ def get_dimension(annotation):
s = ifcopenshell.util.unit.calculate_unit_scale(annotation.file) * 1000
for rep in annotation.Representation.Representations:
shape = importIFCHelper.get2DShape(rep, s, notext=True)
pl = get_placement(annotation.ObjectPlacement, scale=s)
if pl:
shape[0].Placement = pl
if shape and len(shape) == 1:
if len(shape[0].Vertexes) >= 2:
# two-point polyline (BBIM)

View File

@@ -214,7 +214,7 @@ class ifc_object:
else:
print("DEBUG: unknown dimension curve type:",sub)
elif attribute in ["DisplayLength","DisplayHeight","Depth"]:
l = w = h = 1000
l = w = h = 1000.0
if obj.ViewObject:
if obj.ViewObject.DisplayLength.Value:
l = ifc_export.get_scaled_value(obj.ViewObject.DisplayLength.Value, ifcfile)

View File

@@ -843,6 +843,9 @@ def set_attribute(ifcfile, element, attribute, value):
return False
if not val1 and not val2:
return False
if isinstance(val1, (tuple, list)):
if tuple(val1) == tuple(val2):
return False
if val1 is None and "NOTDEFINED" in str(val2).upper():
return False
if val1 is None and "UNDEFINED" in str(val2).upper():
@@ -882,12 +885,13 @@ def set_attribute(ifcfile, element, attribute, value):
):
# do not consider default FreeCAD names given to unnamed alements
return False
if differs(getattr(element, attribute, None),value):
if differs(getattr(element, attribute, None), value):
FreeCAD.Console.PrintLog(
"Changing IFC attribute value of "
+ str(attribute)
+ ": "
+ str(value)
+ " (original value:" +str(getattr(element, attribute))+")"
+ "\n"
)
api_run(cmd, ifcfile, product=element, attributes=attribs)