Is there a code to hide/show all object's connections?

Is there a code to hide/show all object's connections?

enrique.elizaga
Advocate Advocate
16 Views
6 Replies
Message 1 of 7

Is there a code to hide/show all object's connections?

enrique.elizaga
Advocate
Advocate

[ FlexSim 17.2.2 ]

Hi, what is the code to change the "view settings>hide/show connections". I tried to do it using the eyedrop tool but couldn't.

Also, is what is the way to show/hide path network through code? (instead of using "x" key)

Thank you for your valuable help!

0 Likes
Accepted solutions (1)
17 Views
6 Replies
Replies (6)
Message 2 of 7

jing_chen
Not applicable

Hi, @Enrique Elizaga

Try this code:

treenode activedoc = activedocumentnode();
setnodenum(viewhideallconnectors(activedoc),1);

When you keep the model view(3d) active, it will works~

May it helps~

0 Likes
Message 3 of 7

arunTTT2P
Explorer
Explorer
Accepted solution

Hi @Enrique Elizaga,

To hide connectors of fixed and mobile resources

int display = 1;//1-  Hide // 0 - Show
for(int k=1;k<=model().subnodes.length;k++)
{
treenode ChildNodes = model().subnodes;
if(isclasstype(ChildNodes,CLASSTYPE_FIXEDRESOURCE)||isclasstype(ChildNodes,CLASSTYPE_TASKEXECUTER))
		{
		switch_hideconnectors(ChildNodes,display);
	        }
}

To hide network node paths and shape

int display = 1;//1-  Hide // 0 - Show
for(int k=1;k<=model().subnodes.length;k++)
{
treenode ChildNodes = model().subnodes;
if(isclasstype(ChildNodes,CLASSTYPE_NETWORKNODE))
		{
		switch_hideshape(ChildNodes,display);
	        }
}

Regards,

Arun KR

0 Likes
Message 4 of 7

enrique.elizaga
Advocate
Advocate

@jing.chen thank you. The code worked just perfectly. I combined it with @Arun KR's to crack the two issues I had.

Message 5 of 7

marcos_p4
Not applicable

Hi @Arun KR ,

I was looking for a code to hide and show network nodes, as it is usually done with the layout, and I found your code, but it hides them irreversibly.

Would you know what to add in the code to hide with the first click and show with the second and so on?

Thanks in advance

0 Likes
Message 6 of 7

philboboADSK
Autodesk
Autodesk
int display = -1;
forobjecttreeunder(model()) {
    treenode childNode = a;
    if (isclasstype(childNode, CLASSTYPE_NETWORKNODE)) {
        if (display == -1)
            display = !switch_hideshape(childNode, -1);
        switch_hideshape(childNode, display);
    }
}


Phil BoBo
Sr. Manager, Software Development
Message 7 of 7

marcos_p4
Not applicable

Thanks!!

0 Likes