Minor fix to support multiple dimension objects for decorations. See #1150.

This commit is contained in:
Dion Moult
2020-12-11 11:13:48 +11:00
parent 48de2f77ab
commit d5e6721ac4
3 changed files with 11 additions and 10 deletions
@@ -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]
+3 -3
View File
@@ -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):
+1 -1
View File
@@ -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):