diff --git a/operators/add_line_2d.py b/operators/add_line_2d.py index eca58bee..7e6da86b 100644 --- a/operators/add_line_2d.py +++ b/operators/add_line_2d.py @@ -19,7 +19,7 @@ class View3D_OT_slvs_add_line2d(Operator, Operator2d): """Add a line to the active sketch""" - + bl_idname = Operators.AddLine2D bl_label = "Add Solvespace 2D Line" bl_options = {"REGISTER", "UNDO"} @@ -54,6 +54,7 @@ def main(self, context: Context): self.target.construction = True # auto vertical/horizontal constraint + self.has_alignment = False constraints = context.scene.sketcher.constraints vec_dir = self.target.direction_vec() if vec_dir.length: @@ -62,8 +63,10 @@ def main(self, context: Context): threshold = 0.1 if angle < threshold or angle > HALF_TURN - threshold: constraints.add_horizontal(self.target, sketch=self.sketch) + self.has_alignment = True elif (QUARTER_TURN - threshold) < angle < (QUARTER_TURN + threshold): constraints.add_vertical(self.target, sketch=self.sketch) + self.has_alignment = True ignore_hover(self.target) return True @@ -83,7 +86,7 @@ def fini(self, context: Context, succeede: bool): logger.debug("Add: {}".format(self.target)) if succeede: - if self.has_coincident(): + if self.has_coincident() or self.has_alignment: solve_system(context, sketch=self.sketch)