Define mesh sizing on a body in through Mechanical scripting
Pernelle Marone-Hitz
Member, Moderator, Employee Posts: 870
✭✭✭✭
Using ACT, I want to scan the geometry, select the body named "Body1" and insert a body mesh sizing scoped on this body
Tagged:
2
Best Answer
-
The following code can be used to that effect:
geo = ExtAPI.DataModel.GeoData mesh=ExtAPI.DataModel.Project.Model.Mesh for asm in geo.Assemblies: for part in asm.Parts: for body in part.Bodies: if body.Name == 'Body1': new_sizing=mesh.AddSizing() temp_sel=ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities) temp_list=[body.Id] temp_sel.Ids=temp_list new_sizing.Location=temp_sel
6
Answers
-
If we want to delete these (above mesh sizing):
meshc=ExtAPI.DataModel.Project.Model.Mesh.Children with Transaction(): for ms in meshc: ms.Delete() Tree.Refresh()
if Transaction is causing issues, please remove it.
0