question

Alireza Hashemloo avatar image
1 Like"
Alireza Hashemloo asked Jacob Gillespie commented

How to assign a large number of locations to a target area in the model all at once?

Hello,

Using Flexsim Healthcare, I need to assign all locations in a given area to a different area in the model. I am aware of the "Copy from Highlighted" menu allowing for copying a particular variable such as the area name from a highlighted object to a group of selected objects. However, it is not easy to find and select a large number of locations (unless they are grouped) in the model to use the "Copy from Highlighted" menu.

I was wondering if there is a script that can find all locations that are under a given area name and assigned them to another existing area in the model.

Please let me know if further description is required.Thank you,

Alireza

FlexSim HC 5.1.0
locationarealarge numbersareaname
5 |100000

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

Matthew Gillespie avatar image
1 Like"
Matthew Gillespie answered Jacob Gillespie commented

You can run this script:

string curArea = "ComputerTableArea";
string newArea = "BedArea";

for(int i = 1; i <= content(model()); i++)
{
	treenode obj = rank(model(), i);	
	if(getvarstr(obj, "AreaName") == curArea)
	{
		applicationcommand("createGlobalAreaPointer", obj, curArea, newArea);
		UpdateReferences(curArea, newArea);
		TransferSingleAreaConnections(obj, newArea);
	}
}
· 4
5 |100000

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

Alireza Hashemloo avatar image Alireza Hashemloo commented ·

@Matthew Gillespie Thank you! I have tested the script and worked with no issues.

0 Likes 0 ·
Tiffany Pecson avatar image Tiffany Pecson commented ·

@Matthew Gillespie I have this same question, need to change the BedArea names of multiple beds. Where do I go to run this script?

0 Likes 0 ·
Jacob Gillespie avatar image Jacob Gillespie ♦ Tiffany Pecson commented ·

@Tiffany Pecson Go to DebugScript Console

1 Like 1 ·
scriptconsole.png (5.7 KiB)
Tiffany Pecson avatar image Tiffany Pecson Tiffany Pecson commented ·

Oops nevermind, figured it out, I went to Debug > Script Console, copied and pasted, hit execute and it worked!

0 Likes 0 ·
Joerg Vogel avatar image
0 Likes"
Joerg Vogel answered Alireza Hashemloo commented

You can adapt the method of Tom David to suit your quest. Once you have selected the objects under the area, maybe in a script console, you place them as a group and use the group as you like.

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

Alireza Hashemloo avatar image Alireza Hashemloo commented ·

@Jörg Vogel Thanks for the reference.

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.