Using ACT, how can I create a result plot scoped to a path and a specific body?
Options
![Pernelle Marone-Hitz](https://us.v-cdn.net/6037473/uploads/userpics/4AG2SAGAOHUA/nTB4DQJCWAJV4.jpg)
Pernelle Marone-Hitz
Member, Moderator, Employee Posts: 831
![Ansys Employee](https://us.v-cdn.net/6037473/uploads/badges/RVRDV39KPJ91.png)
![Solution Developer Community of Practice Member](https://us.v-cdn.net/6037473/uploads/badges/274G8C56SBE6.png)
Using ACT, how can I create a result plot scoped to a path and a specific body ?
Tagged:
0
Answers
-
The following code will create a maximum principal stress plot scoped to a path named "my_path" and to a body named "my_body":
solu=ExtAPI.DataModel.Project.Model.Analyses[0].Solution # refer to solution my_stress_path=solu.AddMaximumPrincipalStress() # add maximum principal stress plot path=ExtAPI.DataModel.GetObjectsByName("my_path")[0] # obtain reference to path by name # obtain reference to body thanks to its display name geo = ExtAPI.DataModel.GeoData for asm in geo.Assemblies: for part in asm.Parts: for body in part.Bodies: if body.Name=="my_body": my_body=body # create temporary list of Ids for the body temp_sel=ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities) temp_list=[my_body.Id] temp_sel.Ids=temp_list # modify result to define location (path and bodies) my_stress_path.Location = Ansys.Mechanical.Selection.PathLocation(path, temp_sel) # define location to selected path and bodies
2