I'm aware of the contextdragconnection() command. But i want to disconnect each 3d object from one another. Is there a way to do that in code?
I'm aware of the contextdragconnection() command. But i want to disconnect each 3d object from one another. Is there a way to do that in code?
I don't know of any single command, but there is a command named contextdragconnection() that could be used to mimic the actions used by pressing a key (for example the Q key to delete a connection) and then dragging with the mouse. Using this command in conjunction with script that loops through your model and loops through the output ports of each object should do the trick.
Here's a script that deletes all 3D connections:
Object o=model.subnodes[2]; while (o) { if (objectexists(connectionsout(o))) connectionsout(o).subnodes.clear(); if (objectexists(connectionsin(o))) connectionsin(o).subnodes.clear(); if (objectexists(connectionscenter(o))) connectionscenter(o).subnodes.clear(); forobjecttreeunder(o) { if (objectexists(connectionsout(a))) connectionsout(a).subnodes.clear(); if (objectexists(connectionsin(a))) connectionsin(a).subnodes.clear(); if (objectexists(connectionscenter(a))) connectionscenter(a).subnodes.clear(); } o=o.next; }
@jason.lightfoot Awesome, Thanks. it works! Can you post it as a reply instead of a comment?
13 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