Some code unification for DressUp features
This commit is contained in:
committed by
Stefan Tröger
parent
d32317229d
commit
a59901ee4b
@@ -27,6 +27,7 @@
|
||||
|
||||
|
||||
#include "FeatureDressUp.h"
|
||||
#include <Base/Exception.h>
|
||||
|
||||
|
||||
using namespace PartDesign;
|
||||
@@ -57,6 +58,22 @@ void DressUp::positionByBaseFeature(void)
|
||||
this->Placement.setValue(base->Placement.getValue());
|
||||
}
|
||||
|
||||
Part::TopoShape DressUp::getBaseShape()
|
||||
{
|
||||
App::DocumentObject* link = BaseFeature.getValue();
|
||||
if (!link)
|
||||
link = this->Base.getValue(); // For legacy features
|
||||
if (!link)
|
||||
throw Base::Exception("No object linked");
|
||||
if (!link->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId()))
|
||||
throw Base::Exception("Linked object is not a Part object");
|
||||
Part::Feature* base = static_cast<Part::Feature*>(link);
|
||||
const Part::TopoShape& shape = base->Shape.getShape();
|
||||
if (shape._Shape.IsNull())
|
||||
throw Base::Exception("Cannot draft invalid shape");
|
||||
return shape;
|
||||
}
|
||||
|
||||
void DressUp::onChanged(const App::Property* prop)
|
||||
{
|
||||
if (prop == &BaseFeature) {
|
||||
|
||||
Reference in New Issue
Block a user