How to automate the extraction of STL files from total deformation results?
Erik Kostson
Member, Moderator, Employee Posts: 257
✭✭✭✭
Is it possible to use mechanical scripting to automate the extraction/creation of STL files from total deformation results?
Tagged:
0
Comments
-
Below is one of many ways of doing this (for all parts in the tree):
model = ExtAPI.DataModel.Project.Model analysis=model.Analyses[0] solution=analysis.Solution geometry = analysis.GeoData assemblies = geometry.Assemblies i=1 for assembly in assemblies: assembly_name = assembly.Name parts = assembly.Parts parts_count = parts.Count for part in parts: part_name = part.Name bodies = part.Bodies bodies_count = bodies.Count for body in bodies: selection = ExtAPI.SelectionManager.ClearSelection() selection = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities) selection.Ids=[body.Id] newns=ExtAPI.DataModel.Project.Model.AddNamedSelection() newns.Location=selection Graphics.ViewOptions.ResultPreference.DeformationScaleMultiplier = 1 res=solution.AddTotalDeformation() res.Location=selection res.Activate() res.EvaluateAllResults() Graphics.Export3D(r'D:\myslt_'+str(i)+ '.stl', Graphics3DExportFormat.BinarySTL) i=i+1 #res.ScopingMethod=GeometryDefineByType.NamedSelections # or if ns are to be used #res.Location=newns
0
This discussion has been closed.