From ee6f0d0ba9dcb2301f09229753d3e87b0d4d8530 Mon Sep 17 00:00:00 2001 From: "Zheng, Lei" Date: Thu, 26 May 2022 21:40:00 +0800 Subject: [PATCH] Part: fix ruled surface transformation problem --- src/Mod/Part/App/PartFeatures.cpp | 37 ++++--------------------------- src/Mod/Part/App/PartFeatures.h | 1 - 2 files changed, 4 insertions(+), 34 deletions(-) diff --git a/src/Mod/Part/App/PartFeatures.cpp b/src/Mod/Part/App/PartFeatures.cpp index 9b0cb8f7f1..d228ae4719 100644 --- a/src/Mod/Part/App/PartFeatures.cpp +++ b/src/Mod/Part/App/PartFeatures.cpp @@ -24,6 +24,7 @@ #include "PreCompiled.h" #ifndef _PreComp_ # include +# include # include # include # include @@ -61,8 +62,6 @@ RuledSurface::RuledSurface() ADD_PROPERTY_TYPE(Curve2,(nullptr),"Ruled Surface",App::Prop_None,"Curve of ruled surface"); ADD_PROPERTY_TYPE(Orientation,((long)0),"Ruled Surface",App::Prop_None,"Orientation of ruled surface"); Orientation.setEnums(OrientationEnums); - ADD_PROPERTY_TYPE(ResetPlacement,(false),"Ruled Surface",App::Prop_None, - "Whether to reset placement"); } short RuledSurface::mustExecute() const @@ -73,8 +72,6 @@ short RuledSurface::mustExecute() const return 1; if (Orientation.isTouched()) return 1; - if (ResetPlacement.isTouched()) - return 1; return 0; } @@ -147,16 +144,9 @@ App::DocumentObjectExecReturn *RuledSurface::execute(void) // // if both shapes are sub-elements of one common shape then the fill algorithm // leads to problems if the shape has set a placement - // The workaround is to reset the placement before calling BRepFill and then - // applying the placement to the output shape - TopLoc_Location Loc; - if (Curve1.getValue() == Curve2.getValue()) { - Loc = S1.Location(); - if (!Loc.IsIdentity() && Loc == S2.Location()) { - S1.Location(TopLoc_Location()); - S2.Location(TopLoc_Location()); - } - } + // The workaround is to copy the sub-shape + S1 = BRepBuilderAPI_Copy(S1).Shape(); + S2 = BRepBuilderAPI_Copy(S2).Shape(); // make both shapes to have the same type Standard_Boolean isWire = Standard_False; @@ -241,25 +231,6 @@ App::DocumentObjectExecReturn *RuledSurface::execute(void) ruledShape = BRepFill::Shell(TopoDS::Wire(S1), TopoDS::Wire(S2)); } - // re-apply the placement in case we reset it - if (!Loc.IsIdentity()) - ruledShape.Move(Loc); - - Loc = ruledShape.Location(); - - if (!Loc.IsIdentity() && ResetPlacement.getValue()) { - // reset the placement of the shape because the Placement - // property will be changed - ruledShape.Location(TopLoc_Location()); - Base::Matrix4D transform; - TopoShape::convertToMatrix(Loc.Transformation(), transform); - this->Placement.setValue(Base::Placement(transform)); - } else { - if (!Loc.IsIdentity()){ //Reset Placement property = False - this->Placement.setValue(Base::Placement()); - } - } - this->Shape.setValue(ruledShape); return App::DocumentObject::StdReturn; } diff --git a/src/Mod/Part/App/PartFeatures.h b/src/Mod/Part/App/PartFeatures.h index f7164aac90..898dce1945 100644 --- a/src/Mod/Part/App/PartFeatures.h +++ b/src/Mod/Part/App/PartFeatures.h @@ -41,7 +41,6 @@ public: App::PropertyEnumeration Orientation; App::PropertyLinkSub Curve1; App::PropertyLinkSub Curve2; - App::PropertyBool ResetPlacement; /** @name methods override feature */ //@{