ATTENTIONThis 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 |
#1
|
|||
|
|||
How to change color when full?
What I need to do is be able to show the difference between a conveyor that is full and blocked (items are in queue), vs a conveyor that is full but still conveying. It's sometimes hard to tell the difference at certain model run speeds. So I'd like to change the color of the conveyor when it's full and backed up.
I don't have much experience in writing code, but so far I've got: Entry Trigger if ((content(current)==getvarnum(current,"maxcontent" )) && (getstatenum(current)==4)) { coloryellow(current); } else { colorwhite(current); } I can get the color to change to yellow and back to white, but only once. I need it to keep changing colors throughout the model run. I may be way off on the code. Any help would be appreciated! |
#2
|
||||
|
||||
Jamie,
Being that you only want the conveyor to change when you can view it, you could just use the OnDraw trigger. The main disadvantage to using the OnDraw trigger is that it will fire more frequently when you run the model slow; however, it will fire less frequently when you crank up the speed and not at all when you close the view window. Using the Convey End and Exit triggers will get you so far, but it is a little harder to ensure that it works right. This is especially true when you are using an accumulating conveyor that an be blocked at the end but still conveying at the other. The OnDraw code would look similar to what you have already: if(getstatenum(current) == STATE_BLOCKED) coloryellow(current); else colorwhite(current); This code will change the color to yellow when ever the conveyor is blocked. The problem with using the max content, like you did in the code that you posted, is that the max content is usually 1000 which is far more than can actually be contained in the conveyor. If you set the max content then you would have to assume that the flowitems would always be the same size and that the spacng value was never changed. Another option would be to check the filledlength variable on the conveyor and check that against the conveyorlength variable. Becareful there because a conveyor may be too full to accept more flowitems before the filledlength == conveyorlength because the flowitem length + spacing + filledlength is greater than the conveyor length. Good Luck, Brandon
__________________
thats not normal. |
The Following User Says Thank You to Brandon Peterson For This Useful Post: | ||
Jamie Santa Ana (09-23-2009) |
#3
|
|||
|
|||
Thanks for your response, Brandon. You're exactly right about inputting code on the other 2 triggers. Two actions happening at either end of the conveyor, almost simultaneously, was throwing me off. So, thanks for the solution!
|
Thread | Thread Starter | Forum | Replies | Last Post |
how to change color of 3D object made in 3D Max | qin tian | Q&A | 3 | 03-26-2013 10:27 PM |
3DS Changeable Color | Greig Marshall | Q&A | 4 | 06-25-2008 01:36 AM |
Changing the color of a .3ds shape made with autocad | Alexandre Ouellet | Q&A | 5 | 04-30-2008 08:48 AM |
How to get a full path of the current open Flexsim model file. | Regan Blackett | Tips and Tricks | 7 | 04-17-2008 10:39 AM |