Skip to content

Commit

Permalink
Part: support cross coordinate link in AttachExtension
Browse files Browse the repository at this point in the history
  • Loading branch information
realthunder committed Jul 4, 2022
1 parent c88d762 commit 629a87a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/Mod/Part/App/AttachExtension.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@ AttachExtension::AttachExtension()
this->AttacherType.setStatus(App::Property::Status::Hidden, true);

EXTENSION_ADD_PROPERTY_TYPE(Support, (0,0), "Attachment",(App::PropertyType)(App::Prop_Hidden),"Support of the 2D geometry (Deprecated! Use AttachmentSupport instead");
Support.setScope(App::LinkScope::Global);

EXTENSION_ADD_PROPERTY_TYPE(AttachmentSupport, (0,0), "Attachment",(App::PropertyType)(App::Prop_None),"Support of the 2D geometry");
AttachmentSupport.setScope(App::LinkScope::Global);

EXTENSION_ADD_PROPERTY_TYPE(MapMode, (mmDeactivated), "Attachment", App::Prop_None, "Mode of attachment to other object");
MapMode.setEditorName("PartGui::PropertyEnumAttacherItem");
Expand Down
14 changes: 12 additions & 2 deletions src/Mod/Part/Gui/TaskAttacher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -551,8 +551,18 @@ void TaskAttacher::onSelectionChanged(const Gui::SelectionChanges& msg)
if (selObj->getLinkedObject(true)->isDerivedFrom(App::OriginFeature::getClassTypeId()))
sel.setSubName(sel.getSubNameNoElement());

if (editObjT.getSubObject())
sel = Part::SubShapeBinder::import(sel, editObjT);
sel.normalize();
if (editObjT.getSubObject()) {
auto self = editObjT.normalized();
auto topParent = self.getObject();
App::DocumentObject *link = sel.getObject();
std::string linkSub = sel.getSubName();
std::string subname = self.getSubNameNoElement();
topParent->resolveRelativeLink(subname, link, linkSub,
App::DocumentObject::RelativeLinkOption::Flatten);
if (link)
sel = App::SubObjectT(link, linkSub.c_str());
}
selObj = sel.getSubObject();
auto selElement = sel.getOldElementName();

Expand Down

0 comments on commit 629a87a

Please sign in to comment.