From a85756b1c94c30252f99c7bc497beed5c8dcbf25 Mon Sep 17 00:00:00 2001 From: mwganson Date: Sat, 25 Jan 2025 13:14:32 -0600 Subject: [PATCH] [Mesh Python] Mesh.show() returns python object, update documentation for Mesh.show(), Part.show(), and Points.show() --- src/Mod/Mesh/App/AppMeshPy.cpp | 5 ++--- src/Mod/Part/App/AppPartPy.cpp | 3 ++- src/Mod/Points/App/AppPointsPy.cpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Mod/Mesh/App/AppMeshPy.cpp b/src/Mod/Mesh/App/AppMeshPy.cpp index 6ec639a3c4af..cfcbf3e0efd0 100644 --- a/src/Mod/Mesh/App/AppMeshPy.cpp +++ b/src/Mod/Mesh/App/AppMeshPy.cpp @@ -82,7 +82,7 @@ class Module: public Py::ExtensionModule add_varargs_method("show", &Module::show, "show(shape,[string]) -- Add the mesh to the active document or create " - "one if no document exists."); + "one if no document exists. Returns document object."); add_varargs_method("createBox", &Module::createBox, "Create a solid mesh box"); add_varargs_method("createPlane", &Module::createPlane, "Create a mesh XY plane normal +Z"); add_varargs_method("createSphere", &Module::createSphere, "Create a tessellated sphere"); @@ -311,8 +311,7 @@ class Module: public Py::ExtensionModule } // copy the data pcFeature->Mesh.setValue(*mo); - - return Py::None(); + return Py::asObject(pcFeature->getPyObject()); } Py::Object createBox(const Py::Tuple& args) { diff --git a/src/Mod/Part/App/AppPartPy.cpp b/src/Mod/Part/App/AppPartPy.cpp index 3c5e718f922a..05cf1dc5002e 100644 --- a/src/Mod/Part/App/AppPartPy.cpp +++ b/src/Mod/Part/App/AppPartPy.cpp @@ -425,7 +425,8 @@ class Module : public Py::ExtensionModule "read(string) -- Load the file and return the shape." ); add_varargs_method("show",&Module::show, - "show(shape,[string]) -- Add the shape to the active document or create one if no document exists." + "show(shape,[string]) -- Add the shape to the active document or create one if no document exists.\n" + "Returns document object." ); add_varargs_method("getFacets",&Module::getFacets, "getFacets(shape): simplified mesh generation" diff --git a/src/Mod/Points/App/AppPointsPy.cpp b/src/Mod/Points/App/AppPointsPy.cpp index 4fd98d8e8619..e5f1d49e1e78 100644 --- a/src/Mod/Points/App/AppPointsPy.cpp +++ b/src/Mod/Points/App/AppPointsPy.cpp @@ -55,7 +55,7 @@ class Module: public Py::ExtensionModule add_varargs_method("show", &Module::show, "show(points,[string]) -- Add the points to the active document or " - "create one if no document exists."); + "create one if no document exists. Returns document object."); initialize("This module is the Points module."); // register with Python }