question

Matthew Gillespie avatar image
0 Likes"
Matthew Gillespie asked Matthew Gillespie commented

Rename area without losing connections

I have an area that contains lots of locations and is connected up to lots of other areas. I would like to rename the area, but the only way I can see to do that is to change the area name on each object which will delete all the connections.

FlexSim HC 5.1.0
hcarearename
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

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

Currently there isn't an easy way to do this through the interface, but here's a script you can run that will rename the area:

string oldName = "BedArea";
string newName = "MyArea";

for(int i = 1; i <= content(model()); i++)
{
	treenode obj = rank(model(), i);	
	if(getvarstr(obj, "AreaName") == oldName)
		setvarstr(obj, "AreaName", newName);
}

setname(node(oldName, AreasNode), newName);

treenode globalVar = node(concat("MODEL:/Tools/ModelLibraries/FlexsimHC/globalvariables/", oldName));
setname(globalVar, newName);
sets(first(globalVar), newName);

refreshglobalvariables();
UpdateReferences(oldName, newName);

Just replace BedArea with the name of the area you want to rename and MyArea with the new name.

· 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.

Sam Stubbs avatar image Sam Stubbs ♦ commented ·
0 Likes 0 ·
Alireza Hashemloo avatar image Alireza Hashemloo commented ·

Thank you @Sam Stubbs. I will run the script and let you know should I encounter any issues.

Alireza

0 Likes 0 ·

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.