TAGGED: apdl, mechanical, structures
-
-
February 14, 2023 at 3:14 pm
thermalsr71
SubscriberHello,
First time in this forum. I want to do a script that associates a part geometry from the Geometry tree to a named selection. It looks auite simple at first sight.
Here's my script.
model = ExtAPI.DataModel.Project.Model
geom = model.Geometry
selection_manager = ExtAPI.SelectionManagerfor part in geom.Children:
bodyName = body.Nameselection_manager.ClearSelection()
selection = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities)
selection.Ids = [part.ObjectId] ! at this point, I associate my part ID to the selection
selection_manager.NewSelection(selection)
new_namedSelection = model.AddNamedSelection()
new_namedSelection.Name = 'b_'+body.Namenew_namedSelection.Location.Ids= selection.Ids ! HERE IS THE PROBLEM
The problem here is that if I do a print(selection.ids), I'll get the Id associated to the part I want the named selection to be associated to. So far so good. But if I do a print(new_namedSelection.Name.Location.Ids), I'll get an empty list, when it should be a one-item list with the Id I'm interested in.
I don't understand why the last line does not work properly.
Thank for your time
-
February 15, 2023 at 10:39 am
Erik Kostson
Ansys EmployeeHi
This post is relevant.
https://forum.ansys.com/forums/topic/act-script-assign-items-to-a-named-selection/
All the best
Erik
-
February 15, 2023 at 10:43 am
thermalsr71
SubscriberHi Erik,
The GetGeoBody() was what I was missing. It worked.
Thanks
-
February 15, 2023 at 10:46 am
Erik Kostson
Ansys EmployeeYes we need the body id to define the NS. Great that it worked. Erik
-
February 15, 2023 at 1:53 pm
thermalsr71
SubscriberHowever, is there a method similar to NamedSelection.Location.Ids that gets the ids of the nodes associated to the name selection geometry, instead of the ids of the geometric entities?
Thanks in advance
-
- You must be logged in to reply to this topic.

Boost Ansys Fluent Simulations with AWS
Computational Fluid Dynamics (CFD) helps engineers design products in which the flow of fluid components is a significant challenge. These different use cases often require large complex models to solve on a traditional workstation. Click here to join this event to learn how to leverage Ansys Fluids on the cloud, thanks to Ansys Gateway powered by AWS.

Earth Rescue – An Ansys Online Series
The climate crisis is here. But so is the human ingenuity to fight it. Earth Rescue reveals what visionary companies are doing today to engineer radical new ideas in the fight against climate change. Click here to watch the first episode.

Ansys Blog
Subscribe to the Ansys Blog to get great new content about the power of simulation delivered right to your email on a weekly basis. With content from Ansys experts, partners and customers you will learn about product development advances, thought leadership and trends and tips to better use Ansys tools. Sign up here.
- How to do the frequency response of the nonlinear vibration of a flexible PCB?
- Importing Line and Solid Bodies from SpaceClaim to Mechanical
- how to open SendCommand in Ansys
- problems facing during solution
- Still facing the same issue
- Failed to move file from solver directory to scratch directory: file.rst
- Adaptive Sizing
- Stiffness factor
- Import DAT file
- Import pressure data (coordinates and value) to ansys workbench through excel
-
8808
-
4658
-
3153
-
1680
-
1470
© 2023 Copyright ANSYS, Inc. All rights reserved.