mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-19 22:50:21 +00:00
Polyline tool now shows dimensions for meters and centimeters.
This commit is contained in:
@@ -70,7 +70,7 @@ class Polyline(bonsai.core.tool.Polyline):
|
|||||||
return None
|
return None
|
||||||
if attribute_name == "A":
|
if attribute_name == "A":
|
||||||
value = float(self.get_text_value(attribute_name))
|
value = float(self.get_text_value(attribute_name))
|
||||||
return f"{value:.2f}"
|
return f"{value:.2f}°"
|
||||||
else:
|
else:
|
||||||
return Polyline.format_input_ui_units(value)
|
return Polyline.format_input_ui_units(value)
|
||||||
|
|
||||||
@@ -176,7 +176,6 @@ class Polyline(bonsai.core.tool.Polyline):
|
|||||||
if should_round:
|
if should_round:
|
||||||
angle = round(angle)
|
angle = round(angle)
|
||||||
factor = tool.Snap.get_increment_snap_value(context)
|
factor = tool.Snap.get_increment_snap_value(context)
|
||||||
print(factor)
|
|
||||||
distance = factor * round(distance / factor)
|
distance = factor * round(distance / factor)
|
||||||
input_ui.set_value("X", snap_vector.x)
|
input_ui.set_value("X", snap_vector.x)
|
||||||
input_ui.set_value("Y", snap_vector.y)
|
input_ui.set_value("Y", snap_vector.y)
|
||||||
@@ -235,7 +234,7 @@ class Polyline(bonsai.core.tool.Polyline):
|
|||||||
|
|
||||||
area = input_ui.get_number_value("AREA")
|
area = input_ui.get_number_value("AREA")
|
||||||
if area:
|
if area:
|
||||||
area = tool.Polyline.format_input_ui_units(area)
|
area = tool.Polyline.format_input_ui_units(area, is_area = True)
|
||||||
polyline_data.area = area
|
polyline_data.area = area
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -420,7 +419,7 @@ class Polyline(bonsai.core.tool.Polyline):
|
|||||||
|
|
||||||
FORMULA: "="
|
FORMULA: "="
|
||||||
|
|
||||||
metric: NUMBER
|
metric: NUMBER "mm"? "m"? "°"?
|
||||||
|
|
||||||
expr: (ADD | SUB | MUL | DIV) dim
|
expr: (ADD | SUB | MUL | DIV) dim
|
||||||
|
|
||||||
@@ -518,7 +517,7 @@ class Polyline(bonsai.core.tool.Polyline):
|
|||||||
return False, "0"
|
return False, "0"
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def format_input_ui_units(cls, value):
|
def format_input_ui_units(cls, value, is_area=False):
|
||||||
unit_system = tool.Drawing.get_unit_system()
|
unit_system = tool.Drawing.get_unit_system()
|
||||||
if unit_system == "IMPERIAL":
|
if unit_system == "IMPERIAL":
|
||||||
precision = bpy.context.scene.DocProperties.imperial_precision
|
precision = bpy.context.scene.DocProperties.imperial_precision
|
||||||
@@ -529,7 +528,7 @@ class Polyline(bonsai.core.tool.Polyline):
|
|||||||
if bpy.context.scene.unit_settings.length_unit == "MILLIMETERS":
|
if bpy.context.scene.unit_settings.length_unit == "MILLIMETERS":
|
||||||
factor = 1000
|
factor = 1000
|
||||||
|
|
||||||
return format_distance(value * factor, precision=precision, suppress_zero_inches=True, in_unit_length=True)
|
return format_distance(value * factor, precision=precision, hide_units=False, isArea=is_area, suppress_zero_inches=True, in_unit_length=True)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def insert_polyline_point(cls, input_ui, tool_state=None):
|
def insert_polyline_point(cls, input_ui, tool_state=None):
|
||||||
|
|||||||
Reference in New Issue
Block a user