mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-24 18:50:05 +00:00
Add support for dimensions added with MeasureIt-ARCH
This commit is contained in:
@@ -116,6 +116,7 @@ class SvgWriter():
|
|||||||
self.draw_dimension_annotations(self.ifc_cutter.equal_obj, text_override='EQ')
|
self.draw_dimension_annotations(self.ifc_cutter.equal_obj, text_override='EQ')
|
||||||
if self.ifc_cutter.dimension_obj:
|
if self.ifc_cutter.dimension_obj:
|
||||||
self.draw_dimension_annotations(self.ifc_cutter.dimension_obj)
|
self.draw_dimension_annotations(self.ifc_cutter.dimension_obj)
|
||||||
|
self.draw_measureit_arch_dimension_annotations()
|
||||||
|
|
||||||
if self.ifc_cutter.break_obj:
|
if self.ifc_cutter.break_obj:
|
||||||
self.draw_break_annotations(self.ifc_cutter.break_obj)
|
self.draw_break_annotations(self.ifc_cutter.break_obj)
|
||||||
@@ -340,18 +341,29 @@ class SvgWriter():
|
|||||||
path = self.svg.add(self.svg.path(d=d, class_=' '.join(['breakline'])))
|
path = self.svg.add(self.svg.path(d=d, class_=' '.join(['breakline'])))
|
||||||
|
|
||||||
def draw_dimension_annotations(self, dimension_obj, text_override=None):
|
def draw_dimension_annotations(self, dimension_obj, text_override=None):
|
||||||
x_offset = self.raw_width / 2
|
|
||||||
y_offset = self.raw_height / 2
|
|
||||||
|
|
||||||
matrix_world = dimension_obj.matrix_world
|
matrix_world = dimension_obj.matrix_world
|
||||||
for spline in dimension_obj.data.splines:
|
for spline in dimension_obj.data.splines:
|
||||||
points = self.get_spline_points(spline)
|
points = self.get_spline_points(spline)
|
||||||
for i, p in enumerate(points):
|
for i, p in enumerate(points):
|
||||||
if i+1 >= len(points):
|
if i+1 >= len(points):
|
||||||
continue
|
continue
|
||||||
classes = ['annotation', 'dimension', 'blahblah']
|
|
||||||
v0_global = matrix_world @ points[i].co.xyz
|
v0_global = matrix_world @ points[i].co.xyz
|
||||||
v1_global = matrix_world @ points[i+1].co.xyz
|
v1_global = matrix_world @ points[i+1].co.xyz
|
||||||
|
self.draw_dimension_annotation(v0_global, v1_global, text_override)
|
||||||
|
|
||||||
|
def draw_measureit_arch_dimension_annotations(self):
|
||||||
|
try:
|
||||||
|
import MeasureIt_ARCH.measureit_arch_external_utils
|
||||||
|
coords = MeasureIt_ARCH.measureit_arch_external_utils.blenderBIM_get_coords(bpy.context)
|
||||||
|
except:
|
||||||
|
return
|
||||||
|
for coord in coords:
|
||||||
|
self.draw_dimension_annotation(Vector(coord[0]), Vector(coord[1]))
|
||||||
|
|
||||||
|
def draw_dimension_annotation(self, v0_global, v1_global, text_override=None):
|
||||||
|
classes = ['annotation', 'dimension']
|
||||||
|
x_offset = self.raw_width / 2
|
||||||
|
y_offset = self.raw_height / 2
|
||||||
v0 = self.project_point_onto_camera(v0_global)
|
v0 = self.project_point_onto_camera(v0_global)
|
||||||
v1 = self.project_point_onto_camera(v1_global)
|
v1 = self.project_point_onto_camera(v1_global)
|
||||||
start = Vector(((x_offset + v0.x), (y_offset - v0.y)))
|
start = Vector(((x_offset + v0.x), (y_offset - v0.y)))
|
||||||
|
|||||||
Reference in New Issue
Block a user