mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-30 16:43:00 +00:00
Fix bug where updating type text literals didn't propagate and formatting rounding null values wasn't handled.
This commit is contained in:
@@ -889,13 +889,32 @@ class Drawing(blenderbim.core.tool.Drawing):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def update_text_value(cls, obj):
|
def update_text_value(cls, obj):
|
||||||
props = obj.BIMTextProperties
|
element = tool.Ifc.get_entity(obj)
|
||||||
|
if element.is_a("IfcTypeProduct"):
|
||||||
|
objs = [obj]
|
||||||
|
for occurrence in ifcopenshell.util.element.get_types(element):
|
||||||
|
obj = tool.Ifc.get_object(occurrence)
|
||||||
|
if obj:
|
||||||
|
objs.append(obj)
|
||||||
|
else:
|
||||||
|
objs = []
|
||||||
|
element_type = ifcopenshell.util.element.get_type(element)
|
||||||
|
if element_type and element_type.RepresentationMaps:
|
||||||
|
obj = tool.Ifc.get_object(element_type)
|
||||||
|
if obj:
|
||||||
|
objs.append(obj)
|
||||||
|
for occurrence in ifcopenshell.util.element.get_types(element_type):
|
||||||
|
obj = tool.Ifc.get_object(occurrence)
|
||||||
|
if obj:
|
||||||
|
objs.append(obj)
|
||||||
|
|
||||||
literals = cls.get_text_literal(obj, return_list=True)
|
for obj in objs:
|
||||||
cls.import_text_attributes(obj)
|
props = obj.BIMTextProperties
|
||||||
for i, literal in enumerate(literals):
|
literals = cls.get_text_literal(obj, return_list=True)
|
||||||
product = cls.get_assigned_product(tool.Ifc.get_entity(obj)) or tool.Ifc.get_entity(obj)
|
cls.import_text_attributes(obj)
|
||||||
props.literals[i].value = cls.replace_text_literal_variables(literal.Literal, product)
|
for i, literal in enumerate(literals):
|
||||||
|
product = cls.get_assigned_product(tool.Ifc.get_entity(obj)) or tool.Ifc.get_entity(obj)
|
||||||
|
props.literals[i].value = cls.replace_text_literal_variables(literal.Literal, product)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def update_text_size_pset(cls, obj):
|
def update_text_size_pset(cls, obj):
|
||||||
|
|||||||
@@ -195,7 +195,7 @@ class FormatTransformer(lark.Transformer):
|
|||||||
return str(args[0])[int(args[1]) :]
|
return str(args[0])[int(args[1]) :]
|
||||||
|
|
||||||
def round(self, args):
|
def round(self, args):
|
||||||
value = Decimal(args[0] or 0.0)
|
value = Decimal(0.0 if args[0] == "None" else args[0] or 0.0)
|
||||||
nearest = Decimal(args[1])
|
nearest = Decimal(args[1])
|
||||||
result = round(value / nearest) * nearest
|
result = round(value / nearest) * nearest
|
||||||
if nearest % 1 == 0:
|
if nearest % 1 == 0:
|
||||||
|
|||||||
Reference in New Issue
Block a user