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

Script to assign PIDs to Parts in Model Browser

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

LinkBack Thread Tools Search this Thread Display Modes
Old   July 14, 2022, 09:42
Default Script to assign PIDs to Parts in Model Browser
New Member
Matteo Rosellini
Join Date: Jul 2022
Posts: 1
Rep Power: 0
mrosellini is on a distinguished road

I need to write a py script to create a new part in the Model Browser and assign certain PIDs to it. My code is the following:

import os
import ansa
from ansa import constants
from ansa import base


def main():
        #collect all entities
	ent = base.CollectEntities(deck,None,'SHELL_PROPERTY')
	for i in ent:
                #find PIDs whose name matches a string named "string"

		if "string" in str(i._name):

	#create a new part named "New_Part"						
	part = base.NewPart('New Part')
if __name__ == '__main__':

The code prints correctly the name of the filtered PIDs and creates the part "New_Part" in the Model Browser but does not assign any entity, so "New_Part" remains an empty part. How can I fix it?

Thank you in advance!
mrosellini 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
viewFactor radiation model stuck shach934 OpenFOAM 1 May 25, 2021 12:01
Validation of CFD model flow_CH Main CFD Forum 4 November 4, 2019 11:30
[ANSYS Meshing] Script Model - Mechanical USER1234 ANSYS Meshing & Geometry 33 September 25, 2015 10:19
Superlinear speedup in OpenFOAM 13 msrinath80 OpenFOAM Running, Solving & CFD 18 March 3, 2015 06:36
DPM model w/ Wave model - errors in documentation HS FLUENT 0 April 12, 2006 05:37

All times are GMT -4. The time now is 23:04.