diff --git a/doc/source/_static/basic/Topo_opitimized.gif b/doc/source/_static/basic/Topo_opitimized.gif new file mode 100644 index 00000000..c6f8dfbf Binary files /dev/null and b/doc/source/_static/basic/Topo_opitimized.gif differ diff --git a/doc/source/_static/basic/Valve.gif b/doc/source/_static/basic/Valve.gif new file mode 100644 index 00000000..b2b39a02 Binary files /dev/null and b/doc/source/_static/basic/Valve.gif differ diff --git a/examples/basic/topology_optimization_cantilever_beam.py b/examples/basic/topology_optimization_cantilever_beam.py index bb81ae5e..dcd15756 100644 --- a/examples/basic/topology_optimization_cantilever_beam.py +++ b/examples/basic/topology_optimization_cantilever_beam.py @@ -16,15 +16,9 @@ # Embed Mechanical and set global variables app = mech.App(version=232) -globals().update(mech.global_variables(app)) +globals().update(mech.global_variables(app, True)) print(app) -from Ansys.ACT.Automation.Mechanical import * -from Ansys.ACT.Interfaces.Common import * -from Ansys.ACT.Mechanical.Fields import * -from Ansys.Mechanical.DataModel.Enums import * -from Ansys.Mechanical.DataModel.MechanicalEnums import * - def display_image(image_name): path = os.path.join(os.path.join(cwd, image_name)) @@ -140,12 +134,13 @@ def display_image(image_name): ######## # Solve +# ~~~~~ TOPO_OPT_SLN = TOPO_OPT.Solution TOPO_OPT_SLN.Solve(True) assert str(TOPO_OPT_SLN.Status) == "Done", "Solution status is not 'Done'" -############################### +########## # Results # ~~~~~~~ @@ -164,9 +159,24 @@ def display_image(image_name): ) display_image("topo_opitimized_smooth.png") -########################################################################## -# Review the results +################################################################################### +# Export animation +animation_export_format = ( + Ansys.Mechanical.DataModel.Enums.GraphicsAnimationExportFormat.GIF +) +settings_720p = Ansys.Mechanical.Graphics.AnimationExportSettings() +settings_720p.Width = 1280 +settings_720p.Height = 720 + +TOPO_DENS.ExportAnimation( + os.path.join(cwd, "Topo_opitimized.gif"), animation_export_format, settings_720p +) +####################################### +# .. image:: /_static/basic/Topo_opitimized.gif + +##################### +# Review the results # Print topology density results print("Topology Density Results") diff --git a/examples/basic/valve.py b/examples/basic/valve.py index ba931be2..671b8b71 100644 --- a/examples/basic/valve.py +++ b/examples/basic/valve.py @@ -155,7 +155,10 @@ def display_image(image_name): stress.ExportAnimation( os.path.join(cwd, "Valve.gif"), animation_export_format, settings_720p ) -display_image("Valve.gif") + +############################################ +# .. image:: /_static/basic/Valve.gif + # Save project app.save(os.path.join(cwd, "Valve.mechdat"))