Merge pull request 'feat(assembly): fixed reference planes (Top/Front/Right) + solver docs' (#307) from feat/assembly-origin-planes into main
Reviewed-on: #307
This commit was merged in pull request #307.
This commit is contained in:
@@ -30,6 +30,7 @@
|
||||
|
||||
#include <App/Application.h>
|
||||
#include <App/Datums.h>
|
||||
#include <App/Origin.h>
|
||||
#include <App/Document.h>
|
||||
#include <App/DocumentObjectGroup.h>
|
||||
#include <App/FeaturePythonPyImp.h>
|
||||
@@ -106,6 +107,24 @@ AssemblyObject::AssemblyObject()
|
||||
|
||||
AssemblyObject::~AssemblyObject() = default;
|
||||
|
||||
void AssemblyObject::setupObject()
|
||||
{
|
||||
App::Part::setupObject();
|
||||
|
||||
// Relabel origin planes with assembly-friendly names (SolidWorks convention)
|
||||
if (auto* origin = getOrigin()) {
|
||||
if (auto* xy = origin->getXY()) {
|
||||
xy->Label.setValue("Top");
|
||||
}
|
||||
if (auto* xz = origin->getXZ()) {
|
||||
xz->Label.setValue("Front");
|
||||
}
|
||||
if (auto* yz = origin->getYZ()) {
|
||||
yz->Label.setValue("Right");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PyObject* AssemblyObject::getPyObject()
|
||||
{
|
||||
if (PythonObject.is(Py::_None())) {
|
||||
|
||||
@@ -84,6 +84,7 @@ public:
|
||||
return "AssemblyGui::ViewProviderAssembly";
|
||||
}
|
||||
|
||||
void setupObject() override;
|
||||
App::DocumentObjectExecReturn* execute() override;
|
||||
void onChanged(const App::Property* prop) override;
|
||||
/* Solve the assembly. It will update first the joints, solve, update placements of the parts
|
||||
|
||||
@@ -591,6 +591,19 @@ App::DocumentObject* getObjFromRef(App::DocumentObject* comp, const std::string&
|
||||
if (obj->isDerivedFrom<App::Part>() || obj->isLinkGroup()) {
|
||||
continue;
|
||||
}
|
||||
else if (obj->isDerivedFrom<App::LocalCoordinateSystem>()) {
|
||||
// Resolve LCS → child datum element (e.g. Origin → XY_Plane)
|
||||
auto nextIt = std::next(it);
|
||||
if (nextIt != names.end()) {
|
||||
for (auto* child : obj->getOutList()) {
|
||||
if (child->getNameInDocument() == *nextIt
|
||||
&& child->isDerivedFrom<App::DatumElement>()) {
|
||||
return child;
|
||||
}
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
else if (obj->isDerivedFrom<PartDesign::Body>()) {
|
||||
return handlePartDesignBody(obj, it);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user