Sketcher: Fix Sketch Mirror functionality
========================================= The problem: Mirror stopped working. How to reproduce: Select a sketch, and apply "Mirror Sketch" from the menu. Why? With the introduction of expressions, mirror sketch stopped working. The reason is that mirror functionality did use the "clone" function to make copies of constraints and then modify their values. After expessions introduction, which introduces a unique tag per constraint, this copy was regarded as a "rename" of the original constraint as they shared the unique tag. Fix? New function "copy()" for a constraint, that copies all the content but the tag.
This commit is contained in:
@@ -97,6 +97,26 @@ Constraint *Constraint::clone(void) const
|
||||
return new Constraint(*this);
|
||||
}
|
||||
|
||||
Constraint *Constraint::copy(void) const
|
||||
{
|
||||
Constraint *temp = new Constraint();
|
||||
temp->Value = this->Value;
|
||||
temp->Type = this->Type;
|
||||
temp->AlignmentType = this->AlignmentType;
|
||||
temp->Name = this->Name;
|
||||
temp->First = this->First;
|
||||
temp->FirstPos = this->FirstPos;
|
||||
temp->Second = this->Second;
|
||||
temp->SecondPos = this->SecondPos;
|
||||
temp->Third = this->Third;
|
||||
temp->ThirdPos = this->ThirdPos;
|
||||
temp->LabelDistance = this->LabelDistance;
|
||||
temp->LabelPosition = this->LabelPosition;
|
||||
temp->isDriving = this->isDriving;
|
||||
// Do not copy tag, otherwise it is considered a clone, and a "rename" by the expression engine.
|
||||
return temp;
|
||||
}
|
||||
|
||||
PyObject *Constraint::getPyObject(void)
|
||||
{
|
||||
return new ConstraintPy(new Constraint(*this));
|
||||
|
||||
Reference in New Issue
Block a user