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 > Flexsim Student Forum
Downloads

Flexsim Student Forum Forum for discussion for Flexsim Students using the Flexsim Textbook.

  #1  
Old 02-23-2013
Ayoub EL BOUCHTILI Ayoub EL BOUCHTILI is offline
Flexsim User
 
Join Date: Dec 2012
Posts: 6
Downloads: 5
Uploads: 0
Thanks: 2
Thanked 0 Times in 0 Posts
Rep Power: 0
Ayoub EL BOUCHTILI is on a distinguished road
Question Multiple objects Released by one source.

Greeting,

It has been a while now since I've started trying to write a code in the source triggers to make it release several different objects (Both Box and Sphere for example) but It seems to be much more delicate than what I though. Does any one have a clue or a starting point?
Thank you in advance.
  #2  
Old 02-23-2013
Kris Geisberger Kris Geisberger is offline
Flexsim Canada, Forum Moderator
 
Join Date: Aug 2007
Location: Canada
Posts: 209
Downloads: 54
Uploads: 1
Thanks: 99
Thanked 389 Times in 133 Posts
Rep Power: 451
Kris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud of
Default

If your boxes and spheres have different arrival rates or schedules then you would simply use two Source objects.

Otherwise (and if you want to write code) start by looking at the code behind the OnCreation (or OnExit) trigger called "Change 3D Shape".

All you really need is:
Code:
setname(shape(item),"_shape");
set(shapeindex(item), 3);
where 3 is the shapeindex you want to change to (the Media Files interface is found under Tools)


Example: 40% Boxes, 60% Spheres
Since querying whether the shape of an item is not as simple as looking at the itemtype, I will set the itemtype first then base the shape on it.

Code:
int boxindex = getshapeindex("fs3d\\General\\Box.3ds");
int sphereindex = getshapeindex("fs3d\\General\\Sphere.3ds");
int thistype = bernoulli(40,1,2);
setitemtype(item,thistype);
setname(shape(item),"_shape");
if(getitemtype(item)==1)
	set(shapeindex(item), boxindex);
else
	set(shapeindex(item), sphereindex);


Another option for the shape indexes is to use a global variables and getshapeindex() OnReset of the model.

Other threads on the topic:
http://www.flexsim.com/community/for...read.php?t=217
http://www.flexsim.com/community/for...read.php?t=643
Attached Files
File Type: fsm different shapes from one source.fsm (29.9 KB, 113 views)
The Following User Says Thank You to Kris Geisberger For This Useful Post:
Ayoub EL BOUCHTILI (02-23-2013)
  #3  
Old 02-23-2013
Ayoub EL BOUCHTILI Ayoub EL BOUCHTILI is offline
Flexsim User
 
Join Date: Dec 2012
Posts: 6
Downloads: 5
Uploads: 0
Thanks: 2
Thanked 0 Times in 0 Posts
Rep Power: 0
Ayoub EL BOUCHTILI is on a distinguished road
Default

Thank you so much, that was so helpfull. I finally made it work with your code. Thank's also for the quick replay.


Thread Thread Starter Forum Replies Last Post
Unable to highlight multiple objects jspeece Q&A 2 09-23-2011 12:52 AM
Creating a stacked bar chart for the states of multiple objects Kris Geisberger Tips and Tricks 6 08-11-2011 09:40 PM
Flexsim HC version 1.0 has been released Bill Nordgren FlexSim HC: Product Announcements 0 07-06-2009 11:25 AM
Pulling multiple objects Roland Tainton Q&A 0 03-24-2009 06:05 AM
Flexsim v4.32 is released Anthony Johnson Gripes and Goodies 0 03-14-2008 09:01 AM


All times are GMT -6.
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Copyright 1993-2018 FlexSim Software Products, Inc.