Draft: Preserve direction vector upon Continue Mode for Dimension (#20974)
So, currently, if we use Vertical/Horizontal Dimension which is constrained in one direction vector, upon `Continue`, the direction vector is not being preserved. The cause of that is that everytime we recall the command in Continue Mode, we also call base class' `Activated` method, which in turn calls `finish()` if we have already initialized an active Draft command. This doesn't happen during first usage of the command, because this variable is not yet populated, but upon second (and next) runs it is. In turn, this causes to call `finish()`, and clean up the direction vector. So, in essence, we are specifying the vector and cleaning it every "Continue" run. So, as a solution, just move the direction vector as an argument to populate super class with it, and do that after super class' `Activated()` call, so it won't get cleaned up in `finish()`. Co-authored-by: Yorik van Havre <yorik@uncreated.net>
This commit is contained in:
@@ -66,11 +66,10 @@ class BIM_DimensionHorizontal(gui_dimensions.Dimension):
|
||||
}
|
||||
|
||||
def Activated(self):
|
||||
|
||||
import WorkingPlane
|
||||
|
||||
self.dir = WorkingPlane.get_working_plane().u
|
||||
super().Activated()
|
||||
super().Activated(dir_vec=self.dir)
|
||||
|
||||
|
||||
class BIM_DimensionVertical(gui_dimensions.Dimension):
|
||||
@@ -91,11 +90,10 @@ class BIM_DimensionVertical(gui_dimensions.Dimension):
|
||||
}
|
||||
|
||||
def Activated(self):
|
||||
|
||||
import WorkingPlane
|
||||
|
||||
self.dir = WorkingPlane.get_working_plane().v
|
||||
super().Activated()
|
||||
super().Activated(dir_vec=self.dir)
|
||||
|
||||
|
||||
FreeCADGui.addCommand("BIM_DimensionVertical", BIM_DimensionVertical())
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user