April 18, 2023 at 12:18 pm
Subscriber
Hello Akshar Maniyar,
sorry for my bad despriction of my problem. I didn't mention that I'm doing this in a script. And trying to get the Items in the Named Selection via script. It looks like follows:
model = ExtAPI.DataModel.Project.Model
mesh = model.Mesh
materials = model.Materials
analysis = model.Analyses[0]
solution = analysis.Solution
nsel = DataModel.GetObjectsByType(DataModelObjectCategory.NamedSelection)
nsel_str = [obj_nsel.Name for obj_nsel in nsel]
base_NSel = ['Example1', 'Example2', 'Example3']
for i in nsel:
for j in base_NSel:
if i.Name == j:
coordinate_system = Model.CoordinateSystems.AddCoordinateSystem()
coordinate_system.OriginDefineBy = CoordinateSystemAlignmentType.Component
coordinate_system.OriginLocation = i
coordinate_system.CoordinateSystemType = CoordinateSystemTypeEnum.Cylindrical
# Here I need some code to assign the Items of the Named Selection (since you can just assign coordinate systems to bodies not Named Selections)
# to the just created cylindrical coordinate system
# The thing is I don't know how to get the ID of the body that is in a Named Selection
# Here I need some code to assign the Items of the Named Selection (since you can just assign coordinate systems to bodies not Named Selections)
# to the just created cylindrical coordinate system
# The thing is I don't know how to get the ID of the body that is in a Named Selection
else:
pass
I hope this made it a bit clearer.
Best regards,
Toni