question

Pinakin K avatar image
0 Likes"
Pinakin K asked Pinakin K edited

Is there one code to delete all connections in 3d?

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?

FlexSim 20.2.3
flexsim 20.2.3delete connections
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

Cliff King avatar image
0 Likes"
Cliff King answered Pinakin K edited

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.


1608755700884.png (129.2 KiB)
· 2
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Jason Lightfoot avatar image Jason Lightfoot ♦♦ commented ·

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;
}


2 Likes 2 ·
Pinakin K avatar image Pinakin K Jason Lightfoot ♦♦ commented ·

@jason.lightfoot Awesome, Thanks. it works! Can you post it as a reply instead of a comment?

0 Likes 0 ·