How to retrieve Beam element cross section properties?
Ayush Kumar
Member, Moderator, Employee Posts: 467
✭✭✭✭
Best Answer
-
Get the body associated with the element and then the properties of the cross-section assigned to the Geo. Body
body = element.GetBody() my_cs = filter(lambda x: (body.CrossSection.Name == x.Name), ExtAPI.DataModel.GetObjectsByType(Ansys.ACT.Automation.Mechanical.CrossSections)[0].Children)[0] # Cross-section area area = my_cs.PropertyByName("CrossSectionArea").StringValue # Polar moment of inertia Iyy iyy = my_cs.PropertyByName("CrossSectionIYY").StringValue # Polar moment of inertia Izz izz = my_cs.PropertyByName("CrossSectionIZZ").StringValue
2
Answers
-
This solution also show how to extract such information: https://stackoverflow.com/c/ansys-field-engineering/questions/421
6 -
This solution also show how to extract such information: https://stackoverflow.com/c/ansys-field-engineering/questions/421
0 -
This solution also show how to extract such information: https://stackoverflow.com/c/ansys-field-engineering/questions/421
2 -
In case we want to find the body associated with a specific element (myelId below):
model = ExtAPI.DataModel.Project.Model analysis=model.Analyses[0] meshData = analysis.MeshData elemList = meshData.Elements myelId=14 def getbodyname(myelId): for el in elemList: if el.Id == myelId: body=el.GetBody() elid=el.Id return body,elid mybodyel=getbodyname(myelId) print('Element ' + str(mybodyel[1]) + ' belongs to the body : ' + str(mybodyel[0].Name))
or with the filter:
model = ExtAPI.DataModel.Project.Model analysis=model.Analyses[0] meshData = analysis.MeshData elemList = meshData.Elements myelId=14 def getbodyname(myelId): el = filter(lambda el: (el.Id == myelId), elemList)[0] body=el.GetBody() elid=el.Id return body,elid mybodyel=getbodyname(myelId) print('Element ' + str(mybodyel[1]) + ' belongs to the body : ' + str(mybodyel[0].Name))
1