question

Enrique Elizaga avatar image
0 Likes"
Enrique Elizaga asked MarcPost commented

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

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!

FlexSim 17.2.2
codeconnectionspath network
5 |100000

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

Arun Kr avatar image
0 Likes"
Arun Kr answered MarcPost commented

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[k];
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[k];
if(isclasstype(ChildNodes,CLASSTYPE_NETWORKNODE))
		{
		switch_hideshape(ChildNodes,display);
	        }
}

Regards,

Arun KR

· 3
5 |100000

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

MarcPost avatar image MarcPost commented ·

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 0 ·
Phil BoBo avatar image Phil BoBo ♦♦ MarcPost commented ·
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);
    }
}
2 Likes 2 ·
MarcPost avatar image MarcPost Phil BoBo ♦♦ commented ·

Thanks!!

0 Likes 0 ·
jing.c avatar image
0 Likes"
jing.c answered Enrique Elizaga commented

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~

· 1
5 |100000

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

Enrique Elizaga avatar image Enrique Elizaga commented ·

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

1 Like 1 ·