diff --git a/src/Mod/Part/App/Part2DObject.cpp b/src/Mod/Part/App/Part2DObject.cpp index 4b82fbf6a..21fb48ccb 100644 --- a/src/Mod/Part/App/Part2DObject.cpp +++ b/src/Mod/Part/App/Part2DObject.cpp @@ -64,7 +64,6 @@ PROPERTY_SOURCE(Part::Part2DObject, Part::Feature) Part2DObject::Part2DObject() { - ADD_PROPERTY_TYPE(Support,(0), "2D",(App::PropertyType)(App::Prop_None),"Support of the 2D geometry"); } @@ -75,12 +74,16 @@ App::DocumentObjectExecReturn *Part2DObject::execute(void) void Part2DObject::positionBySupport(void) { + AttachableObject::positionBySupport(); + + return; + /* // recalculate support: Base::Placement Place; TopoDS_Shape sh; bool Reverse = false; gp_Pln plane; - App::DocumentObject* support = Support.getValue(); + App::DocumentObject* support = Support.getValues(); if (support == NULL) return; @@ -229,13 +232,13 @@ void Part2DObject::positionBySupport(void) //Standard_Real a = Normal.Angle(gp_Ax1(gp_Pnt(0,0,0),gp_Dir(0,0,1))); Placement.setValue(Base::Placement(mtrx)); + */ } void Part2DObject::transformPlacement(const Base::Placement &transform) { - Part::Feature *part = static_cast(Support.getValue()); - if (part && part->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())) { - part->transformPlacement(transform); + if (Support.getValues().size() > 0) { + //part->transformPlacement(transform); positionBySupport(); } else GeoFeature::transformPlacement(transform); @@ -370,7 +373,7 @@ void Part2DObject::acceptGeometry() void Part2DObject::onChanged(const App::Property* prop) { // Update the Placement if the Support changes - if ((prop == &Support) && (Support.getValue() != NULL)) + if ((prop == &Support) && (Support.getValues().size() > 0)) positionBySupport(); Part::Feature::onChanged(prop); } diff --git a/src/Mod/Part/App/Part2DObject.h b/src/Mod/Part/App/Part2DObject.h index e1f131b52..8fb85dd81 100644 --- a/src/Mod/Part/App/Part2DObject.h +++ b/src/Mod/Part/App/Part2DObject.h @@ -29,6 +29,7 @@ #include #include "PartFeature.h" +#include "Attacher.h" class TopoDS_Face; @@ -49,28 +50,15 @@ class Geometry; * geometry as its descend Sketcher::SketchObject . */ -class PartExport Part2DObject : public Part::Feature +class PartExport Part2DObject : public Part::AttachableObject { PROPERTY_HEADER(Part::Part2DObject); public: Part2DObject(); - /// if the 2DObject lies on the Face of an other object this links to it - App::PropertyLinkSub Support; + void positionBySupport(); - /** calculate and update the Placement property based on the Support - * this methode will calculate the position of the - * 2D shape on a supporting Face. The Normal(Orientation) get - * extracted from the Face and for the position an educated guess is made, - * by examining the placement of the support object (not only the face). - * If the support is changed this methode is called do determine a new - * postion of the 2D shape on the supporting Face - */ - void positionBySupport(void); - /** applies a transform on the Placement of the Sketch or its - * support if it has one - */ virtual void transformPlacement(const Base::Placement &transform); /// returns the number of construction lines (to be used as axes) diff --git a/src/Mod/Sketcher/App/SketchObject.cpp b/src/Mod/Sketcher/App/SketchObject.cpp index 07a390269..be79a6144 100644 --- a/src/Mod/Sketcher/App/SketchObject.cpp +++ b/src/Mod/Sketcher/App/SketchObject.cpp @@ -128,8 +128,7 @@ SketchObject::~SketchObject() App::DocumentObjectExecReturn *SketchObject::execute(void) { try { - App::DocumentObject* support = Support.getValue(); - if (support) + if (Support.getSize() > 0) this->positionBySupport(); } catch (const Base::Exception& e) {