mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-10 14:07:43 +00:00
Minor fix
This commit is contained in:
@@ -65,8 +65,7 @@ class TextData:
|
|||||||
element = tool.Ifc.get_entity(bpy.context.active_object)
|
element = tool.Ifc.get_entity(bpy.context.active_object)
|
||||||
if not element or not element.is_a("IfcAnnotation") or element.ObjectType not in ["TEXT", "TEXT_LEADER"]:
|
if not element or not element.is_a("IfcAnnotation") or element.ObjectType not in ["TEXT", "TEXT_LEADER"]:
|
||||||
return []
|
return []
|
||||||
rep = ifcopenshell.util.representation.get_representation(element, "Plan", "Annotation")
|
text_literal = tool.Drawing.get_text_literal(bpy.context.active_object)
|
||||||
text_literal = [i for i in rep.Items if i.is_a("IfcTextLiteral")][0]
|
|
||||||
return [
|
return [
|
||||||
{"name": "Literal", "value": text_literal.Literal},
|
{"name": "Literal", "value": text_literal.Literal},
|
||||||
{"name": "BoxAlignment", "value": text_literal.BoxAlignment},
|
{"name": "BoxAlignment", "value": text_literal.BoxAlignment},
|
||||||
|
|||||||
@@ -616,8 +616,7 @@ class SvgWriter:
|
|||||||
x_offset = self.raw_width / 2
|
x_offset = self.raw_width / 2
|
||||||
y_offset = self.raw_height / 2
|
y_offset = self.raw_height / 2
|
||||||
element = tool.Ifc.get_entity(text_obj)
|
element = tool.Ifc.get_entity(text_obj)
|
||||||
rep = ifcopenshell.util.representation.get_representation(element, "Plan", "Annotation")
|
text_literal = tool.Drawing.get_text_literal(text_obj)
|
||||||
text_literal = [i for i in rep.Items if i.is_a("IfcTextLiteral")][0]
|
|
||||||
|
|
||||||
text_position = self.project_point_onto_camera(position)
|
text_position = self.project_point_onto_camera(position)
|
||||||
text_position = Vector(((x_offset + text_position.x), (y_offset - text_position.y)))
|
text_position = Vector(((x_offset + text_position.x), (y_offset - text_position.y)))
|
||||||
|
|||||||
@@ -304,7 +304,9 @@ class Drawing(blenderbim.core.tool.Drawing):
|
|||||||
element = tool.Ifc.get_entity(obj)
|
element = tool.Ifc.get_entity(obj)
|
||||||
if not element:
|
if not element:
|
||||||
return
|
return
|
||||||
rep = ifcopenshell.util.representation.get_representation(element, "Plan", "Annotation")
|
rep = ifcopenshell.util.representation.get_representation(
|
||||||
|
element, "Plan", "Annotation"
|
||||||
|
) or ifcopenshell.util.representation.get_representation(element, "Model", "Annotation")
|
||||||
if not rep:
|
if not rep:
|
||||||
return
|
return
|
||||||
items = [i for i in rep.Items if i.is_a("IfcTextLiteral")]
|
items = [i for i in rep.Items if i.is_a("IfcTextLiteral")]
|
||||||
|
|||||||
@@ -114,7 +114,16 @@ class Usecase:
|
|||||||
def create_model_representation(self):
|
def create_model_representation(self):
|
||||||
if self.settings["context"].is_a() == "IfcGeometricRepresentationContext":
|
if self.settings["context"].is_a() == "IfcGeometricRepresentationContext":
|
||||||
return self.create_variable_representation()
|
return self.create_variable_representation()
|
||||||
if self.settings["context"].ContextIdentifier == "Annotation":
|
elif self.settings["ifc_representation_class"] == "IfcTextLiteral":
|
||||||
|
return self.create_text_representation(is_2d=False)
|
||||||
|
elif self.settings["ifc_representation_class"] == "IfcGeometricCurveSet/IfcTextLiteral":
|
||||||
|
shape_representation = self.create_geometric_curve_set_representation(is_2d=True)
|
||||||
|
shape_representation.RepresentationType = "Annotation3D"
|
||||||
|
items = list(shape_representation.Items)
|
||||||
|
items.append(self.create_text())
|
||||||
|
shape_representation.Items = items
|
||||||
|
return shape_representation
|
||||||
|
elif self.settings["context"].ContextIdentifier == "Annotation":
|
||||||
return self.create_annotation3d_representation()
|
return self.create_annotation3d_representation()
|
||||||
elif self.settings["context"].ContextIdentifier == "Axis":
|
elif self.settings["context"].ContextIdentifier == "Axis":
|
||||||
return self.create_curve3d_representation()
|
return self.create_curve3d_representation()
|
||||||
@@ -140,7 +149,7 @@ class Usecase:
|
|||||||
|
|
||||||
def create_plan_representation(self):
|
def create_plan_representation(self):
|
||||||
if self.settings["ifc_representation_class"] == "IfcTextLiteral":
|
if self.settings["ifc_representation_class"] == "IfcTextLiteral":
|
||||||
return self.create_text_representation()
|
return self.create_text_representation(is_2d=True)
|
||||||
elif self.settings["ifc_representation_class"] == "IfcGeometricCurveSet/IfcTextLiteral":
|
elif self.settings["ifc_representation_class"] == "IfcGeometricCurveSet/IfcTextLiteral":
|
||||||
shape_representation = self.create_geometric_curve_set_representation(is_2d=True)
|
shape_representation = self.create_geometric_curve_set_representation(is_2d=True)
|
||||||
shape_representation.RepresentationType = "Annotation2D"
|
shape_representation.RepresentationType = "Annotation2D"
|
||||||
@@ -194,11 +203,11 @@ class Usecase:
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
def create_text_representation(self):
|
def create_text_representation(self, is_2d=False):
|
||||||
return self.file.createIfcShapeRepresentation(
|
return self.file.createIfcShapeRepresentation(
|
||||||
self.settings["context"],
|
self.settings["context"],
|
||||||
self.settings["context"].ContextIdentifier,
|
self.settings["context"].ContextIdentifier,
|
||||||
"Annotation2D",
|
"Annotation2D" if is_2d else "Annotation3D",
|
||||||
[self.create_text()],
|
[self.create_text()],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user