CFD Online Logo CFD Online URL
Home > Forums > Mesh Generation & Pre-Processing Software > ANSA

ANs Scripting with base.collectEntities

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree2Likes
  • 2 Post By acurley31

LinkBack Thread Tools Search this Thread Display Modes
Old   November 14, 2018, 04:43
Post ANs Scripting with base.collectEntities
New Member
kishan Dholariya
Join Date: Nov 2018
Location: Ingolstadt
Posts: 2
Rep Power: 0
Kdhol is on a distinguished road
I want to Show the particular node numbers, that numbers I know.
there is error in my code.

TypeError: CollectEntities: argument 2 must be an iterable of ANSA objects.

here is my code
grids = base.CollectEntities(constants.NASTRAN, inc_gridlist1, "GRID")

whatshould be on the secondplace in base.collectentities ?
what is object in ANSA?

Last edited by Kdhol; November 14, 2018 at 11:19.
Kdhol is offline   Reply With Quote

Old   November 17, 2018, 07:32
New Member
Join Date: Sep 2016
Posts: 9
Rep Power: 5
acurley31 is on a distinguished road
Hi Kdhol,

The second object in the CollectEntities function is the container from which ANSA will search to find the type of entities you are looking for. You have two options to pass: (1) "None" which will tell ANSA to search the entire domain or (2) a list of ANSA objects/entities to search from. See below for some examples.

For example, to find all "GRID" entities in the domain. The second object would be None:
all_grids = ansa.base.CollectEntities(ansa.constants.NASTRAN, None, "GRID")
Now, say you had a particular group of SHELLs (FE-Mesh) and you wanted to get the associated GRIDs. In this case, the second argument would be the list of SHELL entities to search from:
shells = [shell_1, shell_2, ..., shell_n] # List of SHELL entities, possibly gathered using the "CollectEntities" function
shell_grids = ansa.base.CollectEntities(ansa.constants.NASTRAN, shells, "GRID")
Also, looking at the code you provided, the two lines "ansa.base.All()" followed by "ansa.base.Invert()" cancel each other out. The first one shows all entities in the model and the second (invert) shows any object that isn't currently shown. This means that it would show nothing.

rmaries and MRAJALIN like this.
acurley31 is offline   Reply With Quote

Old   November 19, 2018, 07:45
Default Collecting Nodes using ANSA script
Mahmoud Aboukhedr
Join Date: Feb 2014
Location: London
Posts: 41
Rep Power: 8
Mahmoud_aboukhedr is on a distinguished road

If I understand correctly, you have a list of Nodes, and you want to show only this nodes using a script.

You will not be able to show only the (Nodes), but you will be able to show only the (faces that carry this node). So for example, if you have a list of two nodes for example (135, 141)
You can use this the script below to collect the nodes, then show only the nodes, which will give you the faces at which this node belongs.

     nodeID = [135,141] % list of nodes
     nodeID_1 = [] % empty list 
     for ID in nodeID:
         % collect the nodes in the empty list 
         nodeID_1.append(base.GetEntity(constants.NASTRAN, "GRID", ID)) 
     for i in nodeID_1:
         % print full information about the collected nodes 
     % show only the collected nodes
All the Best
Mahmoud_aboukhedr is offline   Reply With Quote



Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
[ANSYS Meshing] Need help with selection of edges using scripting studentzz ANSYS Meshing & Geometry 1 March 5, 2017 16:49
Glyph Scripting Origin Pointwise & Gridgen 3 July 9, 2015 16:57
record actions via scripting Marabelle ANSYS 0 July 31, 2013 11:57
Macro scripting in netbeans, importing star libraries laurensvd STAR-CCM+ 2 March 31, 2013 10:02
[DesignModeler] change import by scripting dragonwei ANSYS Meshing & Geometry 0 September 17, 2012 05:08

All times are GMT -4. The time now is 21:43.