I want to delete networknodes ,but the following code does't work.
forobjecttreeunder(model()) { if (comparetext(getnodename(node(">classes/1", a)),"NetworkNode")) destroyobject(a); }
I want to delete networknodes ,but the following code does't work.
forobjecttreeunder(model()) { if (comparetext(getnodename(node(">classes/1", a)),"NetworkNode")) destroyobject(a); }
Use this code:
for (int i = content(model); i > 1; i--) { if (isclasstype(rank(model,i),CLASSTYPE_NETWORKNODE)) destroyobject(rank(model,i)); }
That's right and I got a new command "isclasstype", Thank you very much.
But I want to know why it does't work with "forobjecttreeunder"?
Because while it is searching into the tree you destroy an object and it doesn't work anymore. So, using it, you destroy only the first network node found.
3 People are following this question.
FlexSim can help you understand and improve any system or process. Transform your existing data into accurate predictions.
FlexSim is a fully 3D simulation software environment. FlexSim can be used to simulate any process in any industry.
FlexSim®, FlexSim Healthcare™, Problem Solved.®, the FlexSim logo, the FlexSim X-mark, and the FlexSim Healthcare logo with stylized Caduceus mark are trademarks of FlexSim Software Products, Inc. All rights reserved.
Privacy | Do not sell or share my personal information | Cookie preferences | Report noncompliance | Terms of use | Legal | © Autodesk Inc. All rights reserved