CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Mesh Generation & Pre-Processing Software > ANSA

ANs Scripting with base.collectEntities

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 2 Post By acurley31

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 14, 2018, 05:43
Post ANs Scripting with base.collectEntities
  #1
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
ansa.base.SetCurrentDeck(constants.NASTRAN)
base.All()
base.Invert()
grids = base.CollectEntities(constants.NASTRAN, inc_gridlist1, "GRID")
base.Or(grids)
base.Neighb("ALL")



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

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

Old   November 17, 2018, 08:32
Default
  #2
New Member
 
Join Date: Sep 2016
Posts: 9
Rep Power: 10
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:
Code:
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:
Code:
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.


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

Old   November 19, 2018, 08:45
Default Collecting Nodes using ANSA script
  #3
Member
 
Mahmoud Aboukhedr
Join Date: Feb 2014
Location: London
Posts: 40
Rep Power: 12
Mahmoud_aboukhedr is on a distinguished road
Hello,

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.

Code:
     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 
         print(i)
     % show only the collected nodes
     base.Or(i)
All the Best
MA
Mahmoud_aboukhedr is offline   Reply With Quote

Reply

Tags
collecctentities


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
Macro scripting in netbeans, importing star libraries laurensvd STAR-CCM+ 3 October 31, 2020 23:06
[ANSYS Meshing] Need help with selection of edges using scripting studentzz ANSYS Meshing & Geometry 1 March 5, 2017 17:49
Glyph Scripting Origin pdp.aero Pointwise & Gridgen 3 July 9, 2015 17:57
record actions via scripting Marabelle ANSYS 0 July 31, 2013 12:57
[DesignModeler] change import by scripting dragonwei ANSYS Meshing & Geometry 0 September 17, 2012 06:08


All times are GMT -4. The time now is 09:55.