question

Kari Payton avatar image
0 Likes"
Kari Payton asked Phil BoBo edited

Copy processes from one multiprocessor to others.

Is it possible to copy the processes from one multiprocessor to other multiprocessors?

Other
Other (please specify)
multiprocessor
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

Phil BoBo avatar image
1 Like"
Phil BoBo answered Phil BoBo edited

The MultiProcessor keeps information about its processes in both its "optable" variable and its custom state profile.

You need to copy both of those.

You can copy the "optable" variable using Edit Selected Objects, but there isn't currently a nice way to copy the custom state profile using a button. You will need to copy it using the tree view or using a script. This is the node you need to copy:

MODEL:/MultiProcessor1>stats/state_profiles/MultiProcessor States

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

Noah Z avatar image Noah Z commented ·

Following up on this answer. I have many multiprocessors in a model I'm building and would like to implement a script-based approach to copying over the custom state profiles from one key multiprocessor to the others. I know down the line I will have to make changes to the key multiprocessor and want to save future modelers the manual task of repeatedly copy and pasting from the tree view. Is the script to accomplish this able to be shared?

0 Likes 0 ·
Phil BoBo avatar image Phil BoBo ♦♦ Noah Z commented ·

You can use the createcopy() command:

// copy processes from one highlighted multiprocessor to red selected others
treenode view = activedocumentnode();
treenode highlightedObject = selectedobject(view);
if (isclasstype(highlightedObject, "MultiProcessor")) {
	forobjecttreeunder(model()) {
		treenode obj = a;
		if (switch_selected(obj, -1) && isclasstype(obj, "MultiProcessor")) {
			createcopy(getvarnode(highlightedObject, "optable"), getvarnode(obj, "optable"), 1, 0, 0, 1);
			createcopy(state_profiles(highlightedObject).first, state_profiles(obj).first, 1, 0, 0, 1);
		}
	}
} else {
	msg("Error", "The highlighted object is not a MultiProcessor.");
}
1 Like 1 ·