From fe809567e2acb32260a361a4c9e885eba5f03342 Mon Sep 17 00:00:00 2001 From: Roberto Pastor Muela <37798125+RobPasMue@users.noreply.github.com> Date: Mon, 9 Jun 2025 13:10:35 +0200 Subject: [PATCH 1/4] fix: make sure export_glb is handling a single Polydata object --- src/ansys/geometry/core/plotting/plotter.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/ansys/geometry/core/plotting/plotter.py b/src/ansys/geometry/core/plotting/plotter.py index aeb18cc3a2..28664b3c9a 100644 --- a/src/ansys/geometry/core/plotting/plotter.py +++ b/src/ansys/geometry/core/plotting/plotter.py @@ -557,6 +557,24 @@ def export_glb( ~pathlib.Path Path to the exported glb file. """ + # Export to GLB requires merging the object into a single mesh + LOG.debug( + "Exporting to GLB requires merging the object into a single mesh. " + "This may take some time depending on the size of the object." + ) + LOG.debug( + "When calling export_glb, if you had previously set the plotting_options " + "'merge_bodies' or 'merge_component' to False, they will be ignored." + ) + plotting_options["merge_component"] = True + plotting_options["merge_bodies"] = True + if plotting_object is None: + LOG.warning( + "If you had previously added the objects to the plotter, " + "make sure that the options 'merge_bodies' and 'merge_component' " + "are set to True, otherwise the export will not work as expected." + ) + if plotting_object is not None: self.plot(plotting_object, **plotting_options) From 164d517db82aacf74094827b37e2447ea4741ada Mon Sep 17 00:00:00 2001 From: pyansys-ci-bot <92810346+pyansys-ci-bot@users.noreply.github.com> Date: Mon, 9 Jun 2025 11:13:05 +0000 Subject: [PATCH 2/4] chore: adding changelog file 2032.fixed.md [dependabot-skip] --- doc/changelog.d/2032.fixed.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 doc/changelog.d/2032.fixed.md diff --git a/doc/changelog.d/2032.fixed.md b/doc/changelog.d/2032.fixed.md new file mode 100644 index 0000000000..81860161d7 --- /dev/null +++ b/doc/changelog.d/2032.fixed.md @@ -0,0 +1 @@ +Make sure export_glb is handling a single polydata object \ No newline at end of file From a3e2ab561d892a47232fc8828268e9cf5220e06b Mon Sep 17 00:00:00 2001 From: Roberto Pastor Muela <37798125+RobPasMue@users.noreply.github.com> Date: Mon, 9 Jun 2025 14:23:27 +0200 Subject: [PATCH 3/4] chore: reorder log message --- src/ansys/geometry/core/plotting/plotter.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/ansys/geometry/core/plotting/plotter.py b/src/ansys/geometry/core/plotting/plotter.py index 28664b3c9a..2bbf287039 100644 --- a/src/ansys/geometry/core/plotting/plotter.py +++ b/src/ansys/geometry/core/plotting/plotter.py @@ -568,16 +568,15 @@ def export_glb( ) plotting_options["merge_component"] = True plotting_options["merge_bodies"] = True - if plotting_object is None: + + if plotting_object is not None: + self.plot(plotting_object, **plotting_options) + else: LOG.warning( "If you had previously added the objects to the plotter, " "make sure that the options 'merge_bodies' and 'merge_component' " "are set to True, otherwise the export will not work as expected." ) - - if plotting_object is not None: - self.plot(plotting_object, **plotting_options) - # Depending on whether a name is provided, the file will be saved with the name # provided or with a default name (temp_glb). If a name is provided, the file will # be saved in the current working directory. If a path is provided, the file will be From cffe4757de6ae732faf4a10ed1cd1ab85b5cb39d Mon Sep 17 00:00:00 2001 From: Roberto Pastor Muela <37798125+RobPasMue@users.noreply.github.com> Date: Mon, 9 Jun 2025 14:23:46 +0200 Subject: [PATCH 4/4] chore: missing line break --- src/ansys/geometry/core/plotting/plotter.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ansys/geometry/core/plotting/plotter.py b/src/ansys/geometry/core/plotting/plotter.py index 2bbf287039..6beee659f0 100644 --- a/src/ansys/geometry/core/plotting/plotter.py +++ b/src/ansys/geometry/core/plotting/plotter.py @@ -577,6 +577,7 @@ def export_glb( "make sure that the options 'merge_bodies' and 'merge_component' " "are set to True, otherwise the export will not work as expected." ) + # Depending on whether a name is provided, the file will be saved with the name # provided or with a default name (temp_glb). If a name is provided, the file will # be saved in the current working directory. If a path is provided, the file will be