harmonize show() function of Part, Mesh, Fem, Path and Points modules

This commit is contained in:
wmayer
2017-09-29 00:35:48 +02:00
parent bad543e114
commit 846195327a
5 changed files with 20 additions and 18 deletions

View File

@@ -103,7 +103,7 @@ public:
);
#endif
add_varargs_method("show",&Module::show,
"show(shape) -- Add the shape to the active document or create one if no document exists."
"show(shape,[string]) -- Add the mesh to the active document or create one if no document exists."
);
initialize("This module is the Fem module."); // register with Python
}
@@ -299,7 +299,8 @@ private:
Py::Object show(const Py::Tuple& args)
{
PyObject *pcObj;
if (!PyArg_ParseTuple(args.ptr(), "O!", &(FemMeshPy::Type), &pcObj))
char *name = "Mesh";
if (!PyArg_ParseTuple(args.ptr(), "O!|s", &(FemMeshPy::Type), &pcObj, &name))
throw Py::Exception();
App::Document *pcDoc = App::GetApplication().getActiveDocument();
@@ -307,9 +308,9 @@ private:
pcDoc = App::GetApplication().newDocument();
FemMeshPy* pShape = static_cast<FemMeshPy*>(pcObj);
Fem::FemMeshObject *pcFeature = (Fem::FemMeshObject *)pcDoc->addObject("Fem::FemMeshObject", "Mesh");
Fem::FemMeshObject *pcFeature = static_cast<Fem::FemMeshObject*>
(pcDoc->addObject("Fem::FemMeshObject", name));
// copy the data
//TopoShape* shape = new MeshObject(*pShape->getTopoShapeObjectPtr());
pcFeature->FemMesh.setValue(*(pShape->getFemMeshPtr()));
pcDoc->recompute();