X and Y components of the Named Selection object.
sombodyfromtheworld
Member Posts: 32
**
Hi
I'm adding the remote force and assigning a named selection edge as a scoping method.
Then I need to set X an Y coordinates to be equal to Centroids X and Y of the same edge. At the moment they are located at the origin of the global coordinate system.
MESH = ExtAPI.DataModel.Project.Model.Mesh ANALYSIS = ExtAPI.DataModel.Project.Model.Analyses[0] select_NS_load = DataModel.GetObjectsByName('load') add_force = ANALYSIS.AddRemoteForce() # force add_force.Name = 'force' add_force.Location = select_NS_load[0]
How to to return the coordinates of the named selection point/edge like below?
add_force.XCoordinate = CentroidX of the select_NS_load[0].Geometry
same for YCoordinate
0
Best Answer
-
NS.Entities for all the edges in the named selection
For each edge: E.Centroid property
This returns the XYZ centroid of the edge in the GeoData unit.
If you have multiple edges in the selection use the E.Length to get also a weighted average of the centroids.1
Answers
-
@Mike.Thompson Thanks
This solution works for me:ANALYSIS = ExtAPI.DataModel.Project.Model.Analyses[0] select_NS_load = DataModel.GetObjectsByName('load') add_force = ANALYSIS.AddRemoteForce() # force x_coord = select_NS_load[0].Entities[0].Centroid[0] y_coord = select_NS_load[0].Entities[0].Centroid[1] add_force.Location = select_NS_load[0] add_force.XCoordinate = Quantity(x_coord, 'm') add_force.YCoordinate = Quantity(y_coord, 'm')
0