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 |
|
Downloads |
User Development User developed add-ons to Flexsim |
I would use better graphing options frequently | 5 | 55.56% | |
I would use better graphing options some of the time | 4 | 44.44% | |
I don't use the current graphing options | 0 | 0% | |
Voters: 9. You may not vote on this poll |
#1
|
|||
|
|||
data display
With the new Flexscript OpenGL commands, we now have more ability to better display data. We could always use all the OpenGL commands in C++ and some draw commands in Flexscript, but now we have a little more control of drawing. These could be used to make new ways to display data in a model, instead of just using the recorder object.
I've attached three models that draw 3D graphs. There's a cartesian 3d graph of a function of x, y, and time, a polar function of theta, phi, and time, and an actual practical application that draws a 3D bar graph of a global table. Most of the code is in the OnDraw triggers of the visual tools. This code can be adapted to make some cool data displays. Last edited by Brandon Peterson; 06-06-2008 at 11:47 AM. |
The Following 7 Users Say Thank You to Alex Christensen For This Useful Post: | ||
tobias.biemueller (06-09-2008) |
#2
|
||||
|
||||
Thanks, Alex. This is really great! The cartesian model (and polar model) shows a great way of visualizing functions with parameter t.
The different of Flexscript and C++ is so dramatic here. If I change it to Flexscript, Flexsim almost hang on. I guess here is the case that a DLL could be used. Here is one interesting but simpler pattern (an ideal water wave) by using the following code: Code:
double t=10*sqrt(time()/100); double z00=5+cos(y0+t); double z01=5+cos(y1+t); double z10=z00; double z11=z01; Code:
double t=10*sqrt(time()); glColor3d(sin(t+x00),cos(t+y00),(sin(t+z00)+cos(t+z00))/sqrt(2.0)); Some questions: What glDisable(2884); and glNormal3D do?
__________________
Best, Alan Last edited by AlanZhang; 06-07-2008 at 01:39 AM. |
The Following User Says Thank You to AlanZhang For This Useful Post: | ||
Cliff King (06-09-2008) |
#3
|
|||
|
|||
First of all, here's an updated bar graph code. Copy it into any OnDraw trigger (especially a visual tool), and it will fully display any global table with a nice picklist option.
Code:
treenode current = ownerobject(c); treenode view = parnode(1); /**draw global table bar graph \n*/ /**table name: */ string tablename=/**/"processtimes"/**/; /**\nbar width:*/ double barwidth=/**/2/**/; /**\nbar height:*/ double barheight=/**/2/**/; int tablenum=getrank(ownerobject(reftable(tablename))); for(int row=1;row<=gettablerows(tablenum);row++){ for(int col=1;col<=gettablecols(tablenum);col++){ double value=gettablenum(tablenum,row,col); drawcube((col-1)*barwidth/get(spatialsx(current)),//x -(row-1)*barheight/get(spatialsy(current))+barheight*gettablerows(tablenum),//y 0.000001, //z barwidth/get(spatialsx(current)), //sx barheight/get(spatialsy(current)), //sy value/10, //sz 0, //rx 0, //ry 0, //rz 0, //red min(value*11,255), //green 0, //blue 0,0,0); //no texture } } GL_CULL_FACE is supposed to be #defined to 2884, but just manually entering its integer value does the same thing as glDisable(GL_CULL_FACE); Back-face culling is an optimization that makes it not draw polygons that are facing away from the camera. It makes it look bad in the Cartesian graph, so I disabled it. Last edited by Alex Christensen; 06-10-2008 at 01:03 PM. Reason: spelling error (with-->width) |
The Following User Says Thank You to Alex Christensen For This Useful Post: | ||
AlanZhang (06-09-2008) |
#4
|
|||
|
|||
Hi Alex, I need to turn off back face culling, however, either glDisable(GL_CULL_FACE) or glDisable(2884) doesn't work on my machine using Flexsim 5.02.
The glDisable(2884) works. Last edited by dalin cai; 10-06-2011 at 08:35 PM. |