MCPcopy Create free account
hub / github.com/FreeCAD/FreeCAD / getPlacementOf

Method getPlacementOf

src/App/DocumentObject.cpp:1762–1787  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1760}
1761
1762Base::Placement DocumentObject::getPlacementOf(const std::string& sub, DocumentObject* targetObj)
1763{
1764 Base::Placement plc;
1765 auto* propPlacement = freecad_cast<App::PropertyPlacement*>(getPropertyByName("Placement"));
1766 if (propPlacement) {
1767 // If the object has no placement (like a Group), plc stays identity so we can proceed.
1768 plc = propPlacement->getValue();
1769 }
1770
1771 std::vector<std::string> names = Base::Tools::splitSubName(sub);
1772
1773 if (names.empty() || this == targetObj) {
1774 return plc;
1775 }
1776
1777 DocumentObject* subObj = getDocument()->getObject(names.front().c_str());
1778
1779 if (!subObj) {
1780 return plc;
1781 }
1782
1783 std::vector<std::string> newNames(names.begin() + 1, names.end());
1784 std::string newSub = Base::Tools::joinList(newNames, ".");
1785
1786 return plc * subObj->getPlacementOf(newSub, targetObj);
1787}
1788
1789Base::Placement DocumentObject::getPlacement() const
1790{

Callers

nothing calls this directly

Calls 9

getPropertyByNameFunction · 0.85
getDocumentFunction · 0.50
getValueMethod · 0.45
emptyMethod · 0.45
getObjectMethod · 0.45
c_strMethod · 0.45
frontMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected