ATTENTION

This FlexSim Community Forum is read-only. Please post any new questions, ideas, or discussions to our new community (we call it Answers) at https://answers.flexsim.com/. Our new Question & Answer site brings a modern, mobile-friendly interface and more focus on getting answers quickly. There are a few differences between how our new Q&A community works vs. a classic, threaded-conversation-style forum like the one below, so be sure to read our Answers Best Practices.


flexsim.com

Go Back   FlexSim Community Forum > FlexSim Software > Q&A
FAQ Downloads Calendar Search Mark Forums Read

Q&A Using Flexsim and building models

Reply
 
Thread Tools Display Modes
  #1  
Old 02-20-2008
KelvinHo KelvinHo is offline
Flexsim User
 
Join Date: Jan 2008
Location: Hong Kong
Posts: 129
Downloads: 18
Uploads: 1
Thanks: 44
Thanked 23 Times in 7 Posts
Rep Power: 168
KelvinHo will become famous soon enough
Default change 3D shape of a packed flow item

Hi all,

Since I'm not similar with programing, I think it should be a very simple question.

I would like to change the 3D shape of one of the packed flowitem (e.g. a packed flowitem with 2 boxes in a pallet, I would like to change the 3D shape of the boxes) after a process, if I use the code in picklist, only the shape of the pallet is changed, I would like to know how to change the shape of the boxes only. Thanks.

Regards,
Kelvin
Attached Files
File Type: zip change 3D shape question.zip (43.2 KB, 397 views)
Reply With Quote
  #2  
Old 02-21-2008
Paul Toone's Avatar
Paul Toone Paul Toone is offline
Flexsim Technical Support
 
Join Date: Jul 2007
Posts: 13
Downloads: 59
Uploads: 31
Thanks: 0
Thanked 7 Times in 4 Posts
Rep Power: 157
Paul Toone is on a distinguished road
Default

Kelvin,

The reason that the pallet shape is changed is that when you reference 'item' from the code in the processor it is referencing the pallet. To reference the items on the pallet you have to use a command such as:
first(item); //which references the first ranking item on the pallet.
or
last(item); //which references the last ranking item on the pallet.
or
rank(item,1); //which references the first ranking item on the pallet.
or
rank(item,5); //which references the fifth ranking item on the pallet.
and so on.....

For your situation you would need to use a for loop to change the shape of all the flowitems in the pallet. A simple version of the code would be the following:

for(int i = 1; i <= content(item); i++)
{
setobjectshapeindex(rank(item,i),6);
setsize(rank(item,i));
}

As you can see the for loop will run until 'i' is equal to the content of item, and every time the code loops 'i' will be incremented by one. Another thing to note is that we have used the variable 'i' in the rank command.

I have modified the picklist you used to use this idea. If you copy and paste the following code into your OnProcessFinish tab, you'll be able to change the shape index on all the flowitems located in a pallet:

treenodeitem = parnode(1);
treenode current = ownerobject(c);
{ //************* PickOption Start *************\\
/**Change 3D Shape*/
/** \nObject: */
for(int i = 1; i <= content(item); i++)
{
treenode involved = /**/rank(item,i)/**/;
/** \nShape Index Number: */
double theindex = /**/6/**/;
setname(shape(involved),"_shape");
setobjectshapeindex(involved,theindex);
/** \n\nIndex values for 3D shapes can be found through the Tools>Media Files menu, but keep in mind that index values can change when new media is loaded, so it is better to define the index with a global variable that gets set during reset using the getshapeindex() command.*/
/**\n\n*/
} //******* PickOption End *******\\
{ //************* PickOption Start *************\\
/**Set Location, Rotation, or Size*/
/** \nCommand: */
/**/setsize/**list:setloc~setrot~setsize*/(
/** \nObject: *//**/rank(item,i)/**/,
/** \nx: *//**/2/**/,
/** \ny: *//**/2/**/,
/** \nz: *//**/2/**/
);
/**\n\n*/
}
} //******* PickOption End *******\\

This code should do what you are requesting. Let me know if it works for you.

Paul

Last edited by Paul Toone; 02-21-2008 at 10:01 AM.
Reply With Quote
The Following User Says Thank You to Paul Toone For This Useful Post:
arunkrmahadeva (01-25-2014)
  #3  
Old 02-27-2008
KelvinHo KelvinHo is offline
Flexsim User
 
Join Date: Jan 2008
Location: Hong Kong
Posts: 129
Downloads: 18
Uploads: 1
Thanks: 44
Thanked 23 Times in 7 Posts
Rep Power: 168
KelvinHo will become famous soon enough
Default

It works, thanks for your detailed reply, Paul.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting an imported shape into the yellow selection box Brenton King Tips and Tricks 23 07-24-2009 08:44 PM
Flow items with states AlanZhang Q&A 16 11-30-2007 10:32 AM
Adjusting 3d shape of a crane Maurits Brandt Tips and Tricks 3 09-14-2007 12:25 AM


All times are GMT -6. The time now is 03:11 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.
Copyright 1993-2018 FlexSim Software Products, Inc.