mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-18 22:33:33 +00:00
Add support for arbitrary point annotations and survey point, traverse points, control points, spot elevations, etc.
This commit is contained in:
@@ -41,4 +41,17 @@
|
|||||||
<circle r="5" fill="white" stroke="black" style="stroke-width: 0.25;" />
|
<circle r="5" fill="white" stroke="black" style="stroke-width: 0.25;" />
|
||||||
<line x1="-5" y1="0" x2="5" y2="0" style="stroke: black; stroke-width: 0.25;" />
|
<line x1="-5" y1="0" x2="5" y2="0" style="stroke: black; stroke-width: 0.25;" />
|
||||||
</g>
|
</g>
|
||||||
|
<g id="SurveyArea">
|
||||||
|
<circle r="1" fill="black" stroke="black" style="stroke-width: 0.25;" />
|
||||||
|
</g>
|
||||||
|
<g id="SurveyArea-CONTROLPOINT">
|
||||||
|
<path style="fill: white; stroke: black; stroke-width: 0.25;" d="M 2.286165,1.4798666 H -1.0000316e-7 -2.2861651 L -1.1430826,-0.5000101 -1.0000316e-7,-2.479888 1.1430827,-0.5000101 Z" />
|
||||||
|
<circle r="0.5" fill="black" stroke="black" style="stroke-width: 0.25;" />
|
||||||
|
</g>
|
||||||
|
<g id="SurveyArea-TRAVERSEPOINT">
|
||||||
|
<path style="fill: white; stroke: black; stroke-width: 0.5;" d="M -2,-2 2,2 M -2,2 2,-2" />
|
||||||
|
</g>
|
||||||
|
<g id="SurveyArea-SPOTELEVATION">
|
||||||
|
<path style="fill: white; stroke: black; stroke-width: 0.5;" d="M 0,-2 0,2 M -2,0 2,0" />
|
||||||
|
</g>
|
||||||
</svg>
|
</svg>
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 3.3 KiB |
@@ -332,9 +332,10 @@ class SvgWriter:
|
|||||||
return
|
return
|
||||||
|
|
||||||
classes = self.get_attribute_classes(obj)
|
classes = self.get_attribute_classes(obj)
|
||||||
if len(obj.data.polygons) == 0:
|
if len(obj.data.vertices) and not len(obj.data.edges):
|
||||||
self.draw_edge_annotation(obj, classes)
|
return self.draw_point_annotation(obj, classes)
|
||||||
return
|
elif len(obj.data.polygons) == 0:
|
||||||
|
return self.draw_edge_annotation(obj, classes)
|
||||||
|
|
||||||
bm = bmesh.new()
|
bm = bmesh.new()
|
||||||
bm.from_mesh(obj.data)
|
bm.from_mesh(obj.data)
|
||||||
@@ -837,6 +838,26 @@ class SvgWriter:
|
|||||||
self.svg.add(tag)
|
self.svg.add(tag)
|
||||||
line_number += len(tag.elements)
|
line_number += len(tag.elements)
|
||||||
|
|
||||||
|
def draw_point_annotation(self, obj, classes):
|
||||||
|
x_offset = self.raw_width / 2
|
||||||
|
y_offset = self.raw_height / 2
|
||||||
|
|
||||||
|
matrix_world = obj.matrix_world
|
||||||
|
projected_points = [self.project_point_onto_camera(matrix_world @ v.co) for v in obj.data.vertices]
|
||||||
|
|
||||||
|
element = tool.Ifc.get_entity(obj)
|
||||||
|
svg_id = str(ifcopenshell.util.element.get_predefined_type(element))
|
||||||
|
|
||||||
|
# EPset_AnnotationSurveyArea is not standard! See bSI-4.3 proposal #660.
|
||||||
|
point_type = ifcopenshell.util.element.get_pset(element, "EPset_AnnotationSurveyArea", "PointType")
|
||||||
|
if point_type:
|
||||||
|
svg_id += f"-{point_type}"
|
||||||
|
|
||||||
|
for symbol_position in projected_points:
|
||||||
|
symbol_position = Vector(((x_offset + symbol_position.x), (y_offset - symbol_position.y)))
|
||||||
|
symbol_position_svg = symbol_position * self.svg_scale
|
||||||
|
self.svg.add(self.svg.use(f"#{svg_id}", insert=symbol_position_svg))
|
||||||
|
|
||||||
def draw_break_annotations(self, obj):
|
def draw_break_annotations(self, obj):
|
||||||
x_offset = self.raw_width / 2
|
x_offset = self.raw_width / 2
|
||||||
y_offset = self.raw_height / 2
|
y_offset = self.raw_height / 2
|
||||||
|
|||||||
Reference in New Issue
Block a user