From c5c937c8bdecc40883c5916bd6afdfbfa47318c5 Mon Sep 17 00:00:00 2001 From: Kacper Donat Date: Wed, 31 Dec 2025 17:09:43 +0100 Subject: [PATCH] PartDesign: Fix misplaced preview for patterns Previous solution did not take into account supporting shape transform which should now be handled correctly. --- .../PartDesign/Gui/ViewProviderTransformed.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/Mod/PartDesign/Gui/ViewProviderTransformed.cpp b/src/Mod/PartDesign/Gui/ViewProviderTransformed.cpp index d5e203d228..50c6f6ca15 100644 --- a/src/Mod/PartDesign/Gui/ViewProviderTransformed.cpp +++ b/src/Mod/PartDesign/Gui/ViewProviderTransformed.cpp @@ -104,6 +104,19 @@ void ViewProviderTransformed::updatePreview() try { if (auto feature = getObject()) { + const Part::Feature* supportFeature = feature->getBaseObject(); + const Part::TopoShape& supportShape = supportFeature->Shape.getShape(); + + if (supportShape.isNull()) { + return; + } + + Base::Matrix4D invertedSupportMatrix; + Part::TopoShape::convertToMatrix( + supportShape.getShape().Location().Transformation().Inverted(), + invertedSupportMatrix + ); + auto originals = feature->getOriginals(); auto transforms = feature->getTransformations(originals); @@ -120,7 +133,7 @@ void ViewProviderTransformed::updatePreview() auto sep = new SoSeparator; auto transformNode = new SoTransform; - transformNode->setMatrix(convert(transformMatrix)); + transformNode->setMatrix(convert(transformMatrix * invertedSupportMatrix)); sep->addChild(transformNode); sep->addChild(pcPreviewShape);