I'm trying to create an animated process flow diagram for an assembly line, where each process is represented by a color-changing shape. white=empty. blue,green,and yellow=different product types occupying each process. outlined in red=finished and waiting on the next process to advance.
I can't really upload the code, since it's full of specific company info., but it basically loops once a second (actual line speed, not animation playback speed) through each job from finish to start, checking to see whether the job is complete, and advances if the next job is open. Once it advances, the elapsed time for the current job resets to 0. DoEvents occurs at the end of each time step to refresh the graphics.
This seems to work efficiently enough for a small number of processes (about 8-10), but when I try to go full-scale and add about 100 processes, it just slows to a crawl, and DoEvents fails to refresh the image. I tried switching between Application.ScreenUpdating = False/True, but it caused a lot of flickering and ran even slower.
I've been looking into creating a ''process" class or dictionary, but I'm not sure if it would be any more efficient than the current array setup.
I'm also considering processing all of the data first, storing it into large 2d arrays spanning the course of about 20 minutes, ColorAtTime(100,1200), and retrieving that info later for the animation.
What's the most efficient way to change the colors of so many shapes at once? Right now, the colors for each job are stored as byte variables in an array. Is it possible to make a shaperange for each different color and update all of the shapes at the same time without having to loop through each one individually?
Bookmarks