-
-
February 28, 2023 at 1:37 pm
pavankonchada123
SubscriberWhen I am trying to record the macro for saving Total Deformation and Stress as images using image to file option, I found that script is same for both cases. But how to differentiate between Deformation and stress for automation
image_settings = Ansys.Mechanical.Graphics.GraphicsImageExportSettings()
image_settings.CurrentGraphicsDisplay = False
image_settings.Resolution = GraphicsResolutionType.NormalResolution
image_settings.Capture = GraphicsCaptureType.ImageAndLegend
image_settings.Background = GraphicsBackgroundType.White
image_settings.FontMagnification = 1
Graphics.ExportImage(r"""D:\Projects\ES.png""", GraphicsImageExportFormat.PNG, image_settings) -
February 28, 2023 at 1:41 pm
pavankonchada123
SubscriberI want to run this journal file to extract the images
result1 = system1.GetContainer(ComponentName="Results")
result1.Edit(Interactive=False)DSscript = open("D:scrt.py", "r")
DSscriptcommand=DSscript.read()
DSscript.close()
result1.SendCommand(Language='Python', Command = DSscriptcommand) -
February 28, 2023 at 2:57 pm
pavankonchada123
SubscriberI have used as this as scrt.py but images are not coming
Â
'''NOTE : All workflows will not be recorded, as recording is under development.'''
solu=Model.Analyses[0].Solution
Graphics.Camera.FocalPoint = Point([0.000000, 0.050126, 0.000000], 'm')
Graphics.Camera.ViewVector = Vector3D(0.57735, 0.57735, 0.57735)
Graphics.Camera.UpVector = Vector3D(0, 1, 0)
Graphics.Camera.SceneHeight = Quantity(0.126253, 'm')
Graphics.Camera.SceneWidth = Quantity(0.046775, 'm')image_settings = Ansys.Mechanical.Graphics.GraphicsImageExportSettings()
image_settings.CurrentGraphicsDisplay = False
image_settings.Resolution = GraphicsResolutionType.NormalResolution
image_settings.Capture = GraphicsCaptureType.ImageAndLegend
image_settings.Background = GraphicsBackgroundType.White
image_settings.FontMagnification = 1totdef = solu.AddTotalDeformation()
totdef.EvaluateAllResults()Graphics.ExportImage(r"""D:\Projects\TD.png""", GraphicsImageExportFormat.PNG, image_settings)
equstress = solu.AddEquivalentStress()
equstress.EvaluateAllResults()
Graphics.ExportImage(r"""D:\Projects\ES.png""", GraphicsImageExportFormat.PNG, image_settings)
#endregionÂ
-
- The topic ‘Python Script to save Total deformation and Stress in a specific location (image’ is closed to new replies.
-
3150
-
1013
-
956
-
858
-
797
© 2025 Copyright ANSYS, Inc. All rights reserved.