@@ -225,17 +225,24 @@ def draw_section_level_annotation(self, obj):
225225 )
226226 )
227227 # TODO: allow metric to be configurable
228- rl = (matrix_world @ points [0 ].co .xyz ).z
228+ rl_value = (matrix_world @ points [0 ].co .xyz ).z
229229 if bpy .context .scene .unit_settings .system == "IMPERIAL" :
230- rl = helper .format_distance (rl , precision = self .precision , decimal_places = self .decimal_places )
230+ rl = helper .format_distance (rl_value , precision = self .precision , decimal_places = self .decimal_places )
231231 else :
232232 unit_scale = ifcopenshell .util .unit .calculate_unit_scale (tool .Ifc .get ())
233- rl /= unit_scale
233+ rl = rl_value / unit_scale
234234 rl = ifcopenshell .util .geolocation .auto_z2e (tool .Ifc .get (), rl )
235235 rl *= unit_scale
236236 rl = "{:.3f}m" .format (rl )
237237 text_style = SvgWriter .get_box_alignment_parameters ("bottom-left" )
238- self .svg .add (self .svg .text (f"RL +{ rl } " , insert = tuple (text_position ), class_ = "SECTIONLEVEL" , ** text_style ))
238+ self .svg .add (
239+ self .svg .text (
240+ "RL {}{}" .format ("" if rl_value < 0 else "+" , rl ),
241+ insert = tuple (text_position ),
242+ class_ = "SECTIONLEVEL" ,
243+ ** text_style ,
244+ )
245+ )
239246 if tag :
240247 self .svg .add (self .svg .text (tag , insert = (text_position [0 ], text_position [1 ] - 5 ), ** text_style ))
241248
@@ -787,12 +794,12 @@ def draw_plan_level_annotation(self, obj):
787794 )
788795 )
789796 # TODO: allow metric to be configurable
790- rl = (matrix_world @ points [0 ].co ).z
797+ rl_value = (matrix_world @ points [0 ].co ).z
791798 if bpy .context .scene .unit_settings .system == "IMPERIAL" :
792- rl = helper .format_distance (rl , precision = self .precision , decimal_places = self .decimal_places )
799+ rl = helper .format_distance (rl_value , precision = self .precision , decimal_places = self .decimal_places )
793800 else :
794801 unit_scale = ifcopenshell .util .unit .calculate_unit_scale (tool .Ifc .get ())
795- rl /= unit_scale
802+ rl = rl_value / unit_scale
796803 rl = ifcopenshell .util .geolocation .auto_z2e (tool .Ifc .get (), rl )
797804 rl *= unit_scale
798805 rl = "{:.3f}m" .format (rl )
@@ -801,7 +808,7 @@ def draw_plan_level_annotation(self, obj):
801808 text_style = SvgWriter .get_box_alignment_parameters (box_alignment )
802809 self .svg .add (
803810 self .svg .text (
804- "RL +{} " .format (rl ),
811+ "RL {}{} " .format ("" if rl_value < 0 else "+" , rl ),
805812 insert = tuple (text_position ),
806813 class_ = "PLANLEVEL" ,
807814 ** text_style ,
0 commit comments