use ShapeBinder to create a copy from Origin feature
This commit is contained in:
@@ -52,6 +52,7 @@ public:
|
||||
App::PropertyBool TraceSupport;
|
||||
|
||||
static void getFilteredReferences(App::PropertyLinkSubList* prop, App::GeoFeature*& object, std::vector< std::string >& subobjects);
|
||||
static Part::TopoShape buildShapeFromReferences(App::GeoFeature* obj, std::vector< std::string > subs);
|
||||
|
||||
const char* getViewProviderName(void) const {
|
||||
return "PartDesignGui::ViewProviderShapeBinder";
|
||||
@@ -65,7 +66,6 @@ protected:
|
||||
private:
|
||||
void slotChangedObject(const App::DocumentObject& Obj, const App::Property& Prop);
|
||||
virtual void onSettingDocument();
|
||||
static Part::TopoShape buildShapeFromReferences(App::GeoFeature* obj, std::vector< std::string > subs);
|
||||
|
||||
typedef boost::signals2::connection Connection;
|
||||
Connection connectDocumentChangedObject;
|
||||
|
||||
@@ -406,9 +406,25 @@ App::DocumentObject* TaskFeaturePick::makeCopy(App::DocumentObject* obj, std::st
|
||||
else
|
||||
shapeProp = &static_cast<PartDesign::ShapeBinder*>(copy)->Shape;
|
||||
}
|
||||
else if(obj->isDerivedFrom(App::Plane::getClassTypeId()) ||
|
||||
obj->isDerivedFrom(App::Line::getClassTypeId())) {
|
||||
|
||||
if(independent && shapeProp) {
|
||||
if(entity.empty())
|
||||
copy = App::GetApplication().getActiveDocument()->addObject("PartDesign::ShapeBinder", name.c_str());
|
||||
|
||||
if (!independent) {
|
||||
static_cast<PartDesign::ShapeBinder*>(copy)->Support.setValue(obj, entity.c_str());
|
||||
}
|
||||
else {
|
||||
App::GeoFeature* geo = static_cast<App::GeoFeature*>(obj);
|
||||
std::vector<std::string> subvalues;
|
||||
subvalues.push_back(entity);
|
||||
Part::TopoShape shape = PartDesign::ShapeBinder::buildShapeFromReferences(geo, subvalues);
|
||||
static_cast<PartDesign::ShapeBinder*>(copy)->Shape.setValue(shape);
|
||||
}
|
||||
}
|
||||
|
||||
if (independent && shapeProp) {
|
||||
if (entity.empty())
|
||||
shapeProp->setValue(static_cast<Part::Feature*>(obj)->Shape.getValue());
|
||||
else
|
||||
shapeProp->setValue(static_cast<Part::Feature*>(obj)->Shape.getShape().getSubShape(entity.c_str()));
|
||||
|
||||
Reference in New Issue
Block a user