mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-12 02:23:34 +00:00
Minor fix to support multiple dimension objects for decorations. See #1150.
This commit is contained in:
@@ -135,12 +135,12 @@ class DimensionDecorator(ViewDecorator):
|
||||
return
|
||||
drawing = self.props.drawings[self.props.active_drawing_index]
|
||||
collection = bpy.data.collections.get("IfcGroup/" + drawing.name)
|
||||
# get curve object
|
||||
if 'IfcAnnotation/Dimension' not in collection.all_objects:
|
||||
return
|
||||
curve = collection.all_objects['IfcAnnotation/Dimension']
|
||||
|
||||
segments = list(self.iter_segments(curve))
|
||||
curves = [o for o in collection.objects if "IfcAnnotation/Dimension" in o.name]
|
||||
segments = []
|
||||
for curve in curves:
|
||||
segments.extend(list(self.iter_segments(curve)))
|
||||
|
||||
self.draw_arrows(segments)
|
||||
for segm in segments:
|
||||
self.draw_label(segm)
|
||||
@@ -150,7 +150,8 @@ class DimensionDecorator(ViewDecorator):
|
||||
(v0, v1, length)
|
||||
"""
|
||||
for spline in curve.data.splines:
|
||||
points = [curve.matrix_world @ p.co for p in spline.points]
|
||||
spline_points = spline.bezier_points if spline.bezier_points else spline.points
|
||||
points = [curve.matrix_world @ p.co for p in spline_points]
|
||||
for i in range(len(points)-1):
|
||||
p0 = points[i]
|
||||
p1 = points[i+1]
|
||||
|
||||
@@ -358,8 +358,8 @@ def refreshTitleblocks(self, context):
|
||||
getTitleblocks(self, context)
|
||||
|
||||
|
||||
def toggleDimDecorations(self, context):
|
||||
toggle = self.dim_decorations
|
||||
def toggleDecorations(self, context):
|
||||
toggle = self.should_draw_decorations
|
||||
if toggle:
|
||||
decoration.DimensionDecorator.install(self, context)
|
||||
else:
|
||||
@@ -677,7 +677,7 @@ class DocProperties(PropertyGroup):
|
||||
active_sheet_index: IntProperty(name="Active Sheet Index")
|
||||
ifc_files: CollectionProperty(name="IFCs", type=StrProperty)
|
||||
drawing_styles: CollectionProperty(name="Drawing Styles", type=DrawingStyle)
|
||||
dim_decorations: BoolProperty(name="Decorate dimentions", update=toggleDimDecorations)
|
||||
should_draw_decorations: BoolProperty(name="Should Draw Decorations", update=toggleDecorations)
|
||||
|
||||
|
||||
class BIMCameraProperties(PropertyGroup):
|
||||
|
||||
@@ -2353,7 +2353,7 @@ class BIM_PT_annotation_utilities(Panel):
|
||||
layout.template_list("BIM_UL_generic", "", props, "drawings", props, "active_drawing_index")
|
||||
|
||||
row = layout.row()
|
||||
row.prop(props, 'dim_decorations')
|
||||
row.prop(props, "should_draw_decorations")
|
||||
|
||||
|
||||
class BIM_PT_qto_utilities(Panel):
|
||||
|
||||
Reference in New Issue
Block a user