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));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user