PartDesign: Update Length/Offset when Occurrences changes (#12069)
* Add 'HACK:'/`NOTE:` tags to get special highlightning * [PD] Bugfix: Update Length/Offset when Occurrences changes Fix #12068
This commit is contained in:
@@ -221,7 +221,7 @@ const std::list<gp_Trsf> LinearPattern::getTransformations(const std::vector<App
|
||||
gp_Trsf trans;
|
||||
transformations.push_back(trans);
|
||||
|
||||
// Note: The original feature is already included in the list of transformations!
|
||||
// NOTE: The original feature is already included in the list of transformations!
|
||||
// Therefore we start with occurrence number 1
|
||||
for (int i = 1; i < occurrences; i++) {
|
||||
trans.SetTranslation(offset * i);
|
||||
@@ -254,12 +254,14 @@ void LinearPattern::onChanged(const App::Property* prop)
|
||||
setReadWriteStatusForMode(mode);
|
||||
}
|
||||
|
||||
// Keep Length in sync with Offset
|
||||
if (mode == LinearPatternMode::offset && prop == &Offset && !Length.testStatus(App::Property::Status::Immutable)) {
|
||||
// Keep Length in sync with Offset, catch Occurrences changes
|
||||
if (mode == LinearPatternMode::offset && (prop == &Offset || prop == &Occurrences)
|
||||
&& !Length.testStatus(App::Property::Status::Immutable)) {
|
||||
Length.setValue(Offset.getValue() * (Occurrences.getValue() - 1));
|
||||
}
|
||||
|
||||
if (mode == LinearPatternMode::length && prop == &Length && !Offset.testStatus(App::Property::Status::Immutable)) {
|
||||
if (mode == LinearPatternMode::length && (prop == &Length || prop == &Occurrences)
|
||||
&& !Offset.testStatus(App::Property::Status::Immutable)) {
|
||||
Offset.setValue(Length.getValue() / (Occurrences.getValue() - 1));
|
||||
}
|
||||
|
||||
|
||||
@@ -169,7 +169,7 @@ class TaskWizardShaft:
|
||||
def isAllowedAlterDocument(self):
|
||||
return False
|
||||
|
||||
# Workaround to allow a callback
|
||||
# HACK: Workaround to allow a callback
|
||||
# Problem: From the FemConstraint ViewProvider, we need to tell the Shaft instance that the user finished editing the constraint
|
||||
# We can find the Shaft Wizard dialog object from C++, but there is no way to reach the Shaft instance
|
||||
# Also it seems to be impossible to access the active dialog from Python, so Gui::Command::runCommand() is not an option either
|
||||
|
||||
Reference in New Issue
Block a user