|
[Sponsors] |
Script to assign PIDs to Parts in Model Browser |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
July 14, 2022, 09:42 |
Script to assign PIDs to Parts in Model Browser
|
#1 |
New Member
Matteo Rosellini
Join Date: Jul 2022
Posts: 1
Rep Power: 0 |
Hi,
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: Code:
import os import ansa from ansa import constants from ansa import base deck=constants.OPENFOAM def main(): #collect all entities ent = base.CollectEntities(deck,None,'SHELL_PROPERTY') filter=[] for i in ent: #find PIDs whose name matches a string named "string" if "string" in str(i._name): print(i._name) filter.append(i) #create a new part named "New_Part" part = base.NewPart('New Part') base.SetEntityPart(filter,part) if __name__ == '__main__': 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! |
|
|
|
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 |