question

Ashmita G avatar image
0 Likes"
Ashmita G asked Ben Wilson commented

Create pallet using Flexscript

Hi, in this model I am trying to create Pallets and boxes using flexscript but I am not able to get the syntax right.

In the model I have two agvs, meant to deliver specific parts to specific queues as per the global table. My intention is to segregate the tokens (produced in the list "items"), using the agvno assigned to each, place them in pallets and transfer them via the assigned agv.

Can you please provide me with the syntax to create pallets and boxes for the above problem using flexscript.

Also if you can provide a sample model for the above problem statement, it will be highly appreciated. Thank you.

Doubt_PalletCreation.fsm

FlexSim 20.1.1
flexscriptflexsim 20.1.1customcodeobject creation
· 5
5 |100000

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

Joerg Vogel avatar image Joerg Vogel commented ·

Sometimes you must develop your code alone. There are plenty examples that shows how to fill pallets. Try to find them and then implement it in your model.

0 Likes 0 ·
Ashmita G avatar image Ashmita G Joerg Vogel commented ·

Hi @Jörg Vogel, thank you for the prompt advice and link. Appreciate it.

Will definitely strive for the same.

I have been through articles which suggested using "create object" activity, and use the insert in front of option. I was able to understand the same. However, my question is regarding the syntax in custom code.

Specifically the line:

Object newPallet = createinstance(library().find("?Pallet"), model());

//using which I intend to create a new pallet

I understand after this, I am required to provide the position (x,y axis) as to where the pallet needs to be created. I have a queue upon which I intend to create the pallet. How do I refer that?

Any link, or example for better understanding or guidance would be of great help as I am still new to flexsim.

Also do correct me if the create instance command is wrong. I followed the syntax of creating processors using custom code.

Thank you.

0 Likes 0 ·
Jason Lightfoot avatar image Jason Lightfoot ♦ commented ·
Why are you trying to do this in code? You're altready using process flow activities and there are many designed for the things you're asking to do in code.
0 Likes 0 ·
Ben Wilson avatar image Ben Wilson ♦♦ commented ·

Hi @Ashmita G, was Jörg Vogel's answer helpful? If so, please click the red "Accept" button at the bottom of their answer. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always unaccept and comment back to reopen your question.

0 Likes 0 ·

1 Answer

·
Joerg Vogel avatar image
1 Like"
Joerg Vogel answered

Ok, you create a pallet in the space of model. The coordinates are 0,0,0 for the location.

By command “moveobject” you initiate the entry of the pallet as an item into the queue. There are two other methods possible:

  1. you transport the pallet by a tasksequence through an operator into the queue.
  2. you put the node of the pallet as a subnode into the tree of the queue by the command “transfernodeobj” or dot syntax property ”up”. Then FlexSim won‘t notify the entry of the pallet.
Once an object is in a container like the model or an object like a queue it is in the scope of this object and its coordinates. You change a position by changing property settings of location. Spatial attributes of objects are properties of the flexscript class Vec3.

Sometimes you have to cast a reference into a different class. You do this with ”as”. There is small degree of difference when a method is done to an object or treenode. And sometimes an object must be introduced to a module by creating a reference in this class. Examples are the classes Storage for Warehousing, AGV or Conveyor.

5 |100000

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

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.