question

Walter H2 avatar image
0 Likes"
Walter H2 asked Walter H2 commented

How to use Set Relative Location Using Array

I would like to place flowitems on an object and control their placement on the object. I was planning to use "change visual" tool process flow. I thought the Set Relative Location Using Array would be a good option to use, but I cannot find any documentation on how to use the function. Could you provide an example on how this is used? This would be done in a sub flow similar to the image below.

createobjectprocessflow.jpg

FlexSim 22.1.2
change visualset location
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

Jason Lightfoot avatar image
0 Likes"
Jason Lightfoot answered Walter H2 commented

Into what type of object are you placing them?

If it's a pallet or other flowitem container then you can use the packing method to specify the locations.

If it's a conveyor then you need to set the orientation on the entry transfer since the conveyor draw will override any positions you set using the change visual activity.


Now onto the trigger option you mention.

First you would create a label (example is 'values') like this:

token.values=[1,2,0] which will be interpreted as 1 distance unit in x, 2 in y and zero vertically.

Then you need to have a delay of zero time in case the object itself will set the position (you need to override it).

That should be it.

However it looks like that assumes the object is in the model and not placed in another object. Here's the corrected trigger code you can paste in by pressing the script icon (replace it all or just change line 13 to match):

Object current = param(1);
treenode activity = param(2);
Token token = param(3);
treenode processFlow = ownerobject(activity);
{ //************* PickOption Start *************\\
/***popup:SetRelativeLocArray*/
/**Set Relative Location Using Array*/
Object involved = /** \nObject: *//***tag:involved*//**/token.item/**/;
treenode reference = /** \nReference: *//***tag:reference*//**/model()/**/;
updatelocations(reference);
Array values = /** \nValues: *//***tag:values*//**/token.values/**/;
Vec3 loc = Vec3(values[1].as(double), values[2].as(double), values[3].as(double));
loc = loc.project(reference, involved.up);   //was model()
involved.setLocation(loc.x, loc.y, loc.z);
} //******* PickOption End *******\\





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

Walter H2 avatar image Walter H2 commented ·
That worked very well. Thank you!!

Walter Harper

0 Likes 0 ·