Assembly: Simulation implementation
This commit is contained in:
committed by
Max Wilfinger
parent
4a2edae421
commit
3326c33d83
@@ -68,6 +68,18 @@ PyObject* AssemblyObjectPy::solve(PyObject* args)
|
||||
return Py_BuildValue("i", ret);
|
||||
}
|
||||
|
||||
PyObject* AssemblyObjectPy::generateSimulation(PyObject* args)
|
||||
{
|
||||
PyObject* pyobj;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "O", &pyobj)) {
|
||||
return nullptr;
|
||||
}
|
||||
auto* obj = static_cast<App::DocumentObjectPy*>(pyobj)->getDocumentObjectPtr();
|
||||
int ret = this->getAssemblyObjectPtr()->generateSimulation(obj);
|
||||
return Py_BuildValue("i", ret);
|
||||
}
|
||||
|
||||
PyObject* AssemblyObjectPy::ensureIdentityPlacements(PyObject* args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, "")) {
|
||||
@@ -77,6 +89,31 @@ PyObject* AssemblyObjectPy::ensureIdentityPlacements(PyObject* args)
|
||||
Py_Return;
|
||||
}
|
||||
|
||||
PyObject* AssemblyObjectPy::updateForFrame(PyObject* args)
|
||||
{
|
||||
unsigned long index {};
|
||||
|
||||
if (!PyArg_ParseTuple(args, "k", &index)) {
|
||||
throw Py::RuntimeError("updateForFrame requires an integer index");
|
||||
}
|
||||
PY_TRY
|
||||
{
|
||||
this->getAssemblyObjectPtr()->updateForFrame(index);
|
||||
}
|
||||
PY_CATCH;
|
||||
|
||||
Py_Return;
|
||||
}
|
||||
|
||||
PyObject* AssemblyObjectPy::numberOfFrames(PyObject* args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, "")) {
|
||||
return nullptr;
|
||||
}
|
||||
size_t ret = this->getAssemblyObjectPtr()->numberOfFrames();
|
||||
return Py_BuildValue("k", ret);
|
||||
}
|
||||
|
||||
PyObject* AssemblyObjectPy::undoSolve(PyObject* args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, "")) {
|
||||
@@ -151,3 +188,15 @@ PyObject* AssemblyObjectPy::exportAsASMT(PyObject* args)
|
||||
|
||||
Py_Return;
|
||||
}
|
||||
|
||||
Py::List AssemblyObjectPy::getJoints() const
|
||||
{
|
||||
Py::List ret;
|
||||
std::vector<App::DocumentObject*> list = getAssemblyObjectPtr()->getJoints();
|
||||
|
||||
for (auto It : list) {
|
||||
ret.append(Py::Object(It->getPyObject(), true));
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user