| 1760 | } |
| 1761 | |
| 1762 | Base::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 | |
| 1789 | Base::Placement DocumentObject::getPlacement() const |
| 1790 | { |
nothing calls this directly
no test coverage detected