Fixed angle input for imperial units in polyline wall and measure tool.

This commit is contained in:
Bruno Perdigão
2024-08-24 15:02:22 -03:00
parent f72c128ba6
commit f89dee7668
3 changed files with 7 additions and 3 deletions
+1 -1
View File
@@ -327,7 +327,7 @@ class DrawPolylineWall(bpy.types.Operator):
def recalculate_inputs(self, context):
if self.number_input:
is_valid, self.number_output = tool.Snap.validate_input(self.number_output)
is_valid, self.number_output = tool.Snap.validate_input(self.number_output, self.input_type)
self.input_panel[self.input_type] = self.number_output
if not is_valid:
self.report({"WARNING"}, "The number typed is not valid.")
@@ -2336,7 +2336,7 @@ class MeasureTool(bpy.types.Operator):
def recalculate_inputs(self, context):
if self.number_input:
is_valid, self.number_output = tool.Snap.validate_input(self.number_output)
is_valid, self.number_output = tool.Snap.validate_input(self.number_output, self.input_type)
self.input_panel[self.input_type] = self.number_output
if not is_valid:
self.report({"WARNING"}, "The number typed is not valid.")
+5 -1
View File
@@ -454,7 +454,7 @@ class Snap(bonsai.core.tool.Snap):
cls.update_snaping_point(intersection, "Plane")
@classmethod
def validate_input(cls, input_number):
def validate_input(cls, input_number, input_type):
grammar_imperial = """
start: FORMULA? dim expr?
@@ -565,6 +565,10 @@ class Snap(bonsai.core.tool.Snap):
parser = Lark(grammar_metric)
factor = 1
if input_type == 'A':
parser = Lark(grammar_metric)
factor = 1
parse_tree = parser.parse(input_number)
transformer = InputTransform()