From 2d0e4f52a69d728e0da46568b303249f48bc9d36 Mon Sep 17 00:00:00 2001 From: Ryan Schultz Date: Fri, 8 Mar 2024 09:08:42 -0600 Subject: [PATCH] =?UTF-8?q?Add=20parameter=20for=20angle=20tolerance,=20an?= =?UTF-8?q?d=20change=20'deg'=20to=20'=C2=B0'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/blenderbim/blenderbim/bim/data/pset/EPset_Drawing.ifc | 3 ++- src/blenderbim/blenderbim/bim/module/drawing/decoration.py | 5 +++-- src/blenderbim/blenderbim/bim/module/drawing/svgwriter.py | 5 ++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/blenderbim/blenderbim/bim/data/pset/EPset_Drawing.ifc b/src/blenderbim/blenderbim/bim/data/pset/EPset_Drawing.ifc index 5a2227b90e..13e2c4e629 100644 --- a/src/blenderbim/blenderbim/bim/data/pset/EPset_Drawing.ifc +++ b/src/blenderbim/blenderbim/bim/data/pset/EPset_Drawing.ifc @@ -5,7 +5,7 @@ FILE_NAME('EPset_Drawing.ifc','2020-01-01T00:00:00',(),(),'EPset_Drawing','EPset FILE_SCHEMA(('IFC4')); ENDSEC; DATA; -#1=IFCPROPERTYSETTEMPLATE('2JhNIvqZrFnAgxfhK0XVQX',$,'EPset_Drawing','',.PSET_OCCURRENCEDRIVEN.,'IfcAnnotation',(#2,#3,#4,#5,#6,#7,#8,#9,#10,#11,#12,#13,#14,#15,#16,#17,#18,#19,#20,#21,#22)); +#1=IFCPROPERTYSETTEMPLATE('2JhNIvqZrFnAgxfhK0XVQX',$,'EPset_Drawing','',.PSET_OCCURRENCEDRIVEN.,'IfcAnnotation',(#2,#3,#4,#5,#6,#7,#8,#9,#10,#11,#12,#13,#14,#15,#16,#17,#18,#19,#20,#21,#22,#23)); #2=IFCSIMPLEPROPERTYTEMPLATE('23JavTMk98ZxXhrUEnjAcf',$,'TargetView','',.P_SINGLEVALUE.,'IfcLabel',$,$,$,$,$,.READWRITE.); #3=IFCSIMPLEPROPERTYTEMPLATE('1yVWUt5H9DAOuu0OaMMLpe',$,'Scale','The scale of this drawing represented as a numerator and denominator, such as 1/100',.P_SINGLEVALUE.,'IfcLabel',$,$,$,$,$,.READWRITE.); #4=IFCSIMPLEPROPERTYTEMPLATE('3gsuPBtU93b8f0gg1pjkq6',$,'HumanScale','The scale of this drawing in human readable format, such as 1:100',.P_SINGLEVALUE.,'IfcLabel',$,$,$,$,$,.READWRITE.); @@ -27,5 +27,6 @@ DATA; #20=IFCSIMPLEPROPERTYTEMPLATE('0joEq0Rd10cxweEh0NeHT6',$,'JoinCriteria','Comma separated selection keys which determine what cut objects are to be joined.',.P_SINGLEVALUE.,'IfcText',$,$,$,$,$,.READWRITE.); #21=IFCSIMPLEPROPERTYTEMPLATE('0nYMT3OSj5gArVniCWZRtv',$,'ShadingStyles','',.P_SINGLEVALUE.,'IfcText',$,$,$,$,$,.READWRITE.); #22=IFCSIMPLEPROPERTYTEMPLATE('3VWG22eZXBdQwdKlzMeVQH',$,'CurrentShadingStyle','',.P_SINGLEVALUE.,'IfcLabel',$,$,$,$,$,.READWRITE.); +#23=IFCSIMPLEPROPERTYTEMPLATE('28mJ$GDxb7kBbKFH_rACMQ',$,'AngleDecimalPlaces','',.P_SINGLEVALUE.,'IfcInteger',$,$,$,$,$,.READWRITE.); ENDSEC; END-ISO-10303-21; diff --git a/src/blenderbim/blenderbim/bim/module/drawing/decoration.py b/src/blenderbim/blenderbim/bim/module/drawing/decoration.py index bee1b3c318..d88d765ee4 100644 --- a/src/blenderbim/blenderbim/bim/module/drawing/decoration.py +++ b/src/blenderbim/blenderbim/bim/module/drawing/decoration.py @@ -812,8 +812,9 @@ class AngleDecorator(BaseDecorator): base_edge = edge0 if tool.Cad.is_counter_clockwise_order(p0, p1, p2) else edge1 text_offset = (Matrix.Rotation(-angle_rad / 2, 2) @ base_edge).normalized() * (radius + ANGLE_LABEL_OFFSET) label_position = p1 + text_offset - - text = f"{int(angle)}deg" + drawing_pset_data = DrawingsData.data["active_drawing_pset_data"] + decimal_places = drawing_pset_data.get("AngleDecimalPlaces", None) + text = f"{round(angle, decimal_places)}°" label_dir = Vector((1, 0)) self.draw_label(context, text, label_position, label_dir, box_alignment="center") diff --git a/src/blenderbim/blenderbim/bim/module/drawing/svgwriter.py b/src/blenderbim/blenderbim/bim/module/drawing/svgwriter.py index b56d5a795e..2bc394c8c8 100644 --- a/src/blenderbim/blenderbim/bim/module/drawing/svgwriter.py +++ b/src/blenderbim/blenderbim/bim/module/drawing/svgwriter.py @@ -32,6 +32,7 @@ import ifcopenshell.util.representation import blenderbim.tool as tool import blenderbim.bim.module.drawing.helper as helper import blenderbim.bim.module.drawing.annotation as annotation +from blenderbim.bim.module.drawing.data import DrawingsData from blenderbim.bim.module.drawing.data import DecoratorData from blenderbim.bim.ifc import IfcStore @@ -1066,7 +1067,9 @@ class SvgWriter: # calculating text parameters and adding text text_position = arc_mid_point + arc_mid_dir * 5 text_style = SvgWriter.get_box_alignment_parameters("center") - angle_text = f"{int(angle)}deg" + drawing_pset_data = DrawingsData.data["active_drawing_pset_data"] + decimal_places = drawing_pset_data.get("AngleDecimalPlaces", None) + angle_text = f"{round(angle, decimal_places)}°" self.svg.add(self.svg.text(angle_text, insert=text_position, class_="ANGLE", **text_style)) # Draw SVG arc, see for details: http://xahlee.info/js/svg_circle_arc.html