February 14, 2023 at 3:14 pmthermalsr71Subscriber
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.SelectionManager
for part in geom.Children:
bodyName = body.Name
selection = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities)
selection.Ids = [part.ObjectId] ! at this point, I associate my part ID to the selection
new_namedSelection = model.AddNamedSelection()
new_namedSelection.Name = 'b_'+body.Name
new_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 amErik KostsonAnsys Employee
This post is relevant.
All the best
February 15, 2023 at 10:43 amthermalsr71Subscriber
The GetGeoBody() was what I was missing. It worked.
February 15, 2023 at 10:46 amErik KostsonAnsys Employee
Yes we need the body id to define the NS. Great that it worked. Erik
February 15, 2023 at 1:53 pmthermalsr71Subscriber
However, 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.
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
© 2023 Copyright ANSYS, Inc. All rights reserved.