Commit 85585cf4 authored by logari81's avatar logari81 Committed by wmayer
Browse files

PartDesign: Enable manual alignment tool for PartDesign features

parent 1860d7de
......@@ -47,3 +47,10 @@ GeoFeature::GeoFeature(void)
GeoFeature::~GeoFeature(void)
{
}
void GeoFeature::transformPlacement(const Base::Placement &transform)
{
Base::Placement plm = this->Placement.getValue();
plm = transform * plm;
this->Placement.setValue(plm);
}
......@@ -46,6 +46,8 @@ public:
/// Constructor
GeoFeature(void);
virtual ~GeoFeature();
virtual void transformPlacement(const Base::Placement &transform);
};
} //namespace App
......
......@@ -1016,9 +1016,7 @@ void ManualAlignment::alignObject(App::DocumentObject *obj)
{
if (obj->getTypeId().isDerivedFrom(App::GeoFeature::getClassTypeId())) {
App::GeoFeature* geom = static_cast<App::GeoFeature*>(obj);
Base::Placement plm = geom->Placement.getValue();
plm = this->myTransform * plm;
geom->Placement.setValue(plm);
geom->transformPlacement(this->myTransform);
}
}
......
......@@ -116,6 +116,19 @@ void SketchBased::positionBySketch(void)
}
}
void SketchBased::transformPlacement(const Base::Placement &transform)
{
Part::Part2DObject *sketch = static_cast<Part::Part2DObject*>(Sketch.getValue());
if (sketch && sketch->getTypeId().isDerivedFrom(Part::Part2DObject::getClassTypeId())) {
Part::Feature *part = static_cast<Part::Feature*>(sketch->Support.getValue());
if (part && part->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId()))
part->transformPlacement(transform);
else
sketch->transformPlacement(transform);
positionBySketch();
}
}
Part::Part2DObject* SketchBased::getVerifiedSketch() const {
App::DocumentObject* result = Sketch.getValue();
if (!result)
......
......@@ -57,6 +57,10 @@ public:
* or its support if it has one
*/
void positionBySketch(void);
/** applies a transform on the Placement of the Sketch or its
* support if it has one
*/
virtual void transformPlacement(const Base::Placement &transform);
/// Verifies the linked Sketch object
Part::Part2DObject* getVerifiedSketch() const;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment