question

Cliff King avatar image
1 Like"
Cliff King asked Matthew Gillespie commented

Bug with undo/redo of HC path nodes

Have you seen this error before?

FlexSim HC 5.0.12
FlexSim 16.0.1
network nodesflexsim hchcpathundo
patherror.png (8.4 KiB)
bugfix.gif (469.2 KiB)
· 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.

Cliff King avatar image Cliff King commented ·
0 Likes 0 ·

1 Answer

·
Matthew Gillespie avatar image
0 Likes"
Matthew Gillespie answered Matthew Gillespie commented

This is a known problem that is sometimes caused by undoing (Ctrl-Z) to restore deleted path nodes. The issue has been fixed in the next release (v5.0.14).

To fix the problem and stop the errors in a model in the current version:

Paste the following script into a script editor and run it:

for(int i = 2; i <= content(model); i++)
{
	treenode nn = rank(model, i);
	
	if(getobjecttype(nn) != OBJECT_Path)
		continue;
		
	treenode connectionsOut = connectionsout(nn);
	for(int j = 1; j <= content(connectionsOut); j++)
	{
		treenode conn = rank(connectionsOut, j);
		treenode splines = node("spline", conn);
		
		if(content(splines)) 
		{
			treenode firstSpline = first(splines);
			treenode pointer = first(connectionsout(firstSpline));
			
			if(!objectexists(node("+", pointer)))
				nodepoint(pointer, first(connectionsin(last(splines))));
		}
	}
}

bugfix.gif (469.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.

Lincoln Sellers avatar image Lincoln Sellers commented ·

@Matthew Gillespie ,

I got this bug on a model in Flexsim 7.5.4..I copied and pasted the script provided but the error is continuing to show up, every time I even move the mouse. It will not let me delete nodes, either. What can I do to fix this?

0 Likes 0 ·
Matthew Gillespie avatar image Matthew Gillespie ♦♦ Lincoln Sellers commented ·

The problem is that this line of code is HC specific:

if(getobjecttype(nn) != OBJECT_Path)

and needs to be switched to this:

if(!isclasstype(nn, "NetworkNode"))

This modified script should work in either FlexSim 7.5 or HC 5:

for(int i = 2; i <= content(model); i++)
{
	treenode nn = rank(model, i);
	
	if(!isclasstype(nn, "NetworkNode"))
		continue;
		
	treenode connectionsOut = connectionsout(nn);
	for(int j = 1; j <= content(connectionsOut); j++)
	{
		treenode conn = rank(connectionsOut, j);
		treenode splines = node("spline", conn);
		
		if(content(splines)) 
		{
			treenode firstSpline = first(splines);
			treenode pointer = first(connectionsout(firstSpline));
			
			if(!objectexists(node("+", pointer)))
				nodepoint(pointer, first(connectionsin(last(splines))));
		}
	}
}

1 Like 1 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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