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
|
||||
|
||||
Drawing a Sankey Diagramm
Hi,
I want the path on the network to grow in width with every transporter driving over the network node. So I increase a label each time the transporter enters the networknode. Now I use the onDraw trigger of the networknode like this: double d_width; treenode t_obj; drawtomodelscale(current); for(int x=1;x<=nrop(current);x++) { t_obj=outobject(current,x); d_width=getlabelnum(current,x+1)/100; glLineWidth(d_width); drawline(view,xloc(current),yloc(current),zloc(cur rent),xloc(t_obj),yloc(t_obj),zloc(t_obj),0,1,0); } So this is working fine, but the origin of the lines is far away from the networknode. If I use xloc(current), yloc(current) and zloc(current) the line should start at the networknode??
__________________
kind regards Nico. |
#2
|
||||
|
||||
Nico,
your code is only working if the first NN has location (0,0,0). I modified your code a bit and it seems to work, but I am not sure, because if I change the location of NN2 it works in my little example, but does not work, if I change location of NN1. Then I need to change the location of NN2 and it works even if I put it on the same position. By the way, your code is not using label 1 but label x + 1, so I change this to x. Anyway, maybe my code give you some hints. Don't ask me about the commands, I have no clue what I am doing ... double d_width; treenode t_obj; drawtomodelscale(current); for(int x=1;x<=nrop(current);x++) { t_obj = outobject(current,x); d_width = getlabelnum(current,x)/100; glLineWidth(d_width); double dX = vectorprojectx(model(), xloc(t_obj),yloc(t_obj),zloc(t_obj), current); double dY = vectorprojecty(model(), xloc(t_obj),yloc(t_obj),zloc(t_obj), current); double dZ = vectorprojectz(model(), xloc(t_obj),yloc(t_obj),zloc(t_obj), current); drawline(view,0,0,0,dX,dY,dZ,0,1,0); }
__________________
tom the (A)tom: "We have solved our problems ... now we have to fight the solutions." |
The Following 3 Users Say Thank You to Tom David For This Useful Post: | ||
Simon Farsah (07-28-2009) |
#3
|
||||
|
||||
Hi Tom,
thanks for the hint. You have to project the coordinates of the starting object (current) as well. I now use a triangle to show the amount of transports. Attached you will find the working model.
__________________
kind regards Nico. |
The Following 3 Users Say Thank You to Nico Zahn For This Useful Post: | ||
Tom David (07-29-2009) |
#4
|
||||
|
||||
I an not sure, but in my case it is working. But maybe because I do it different.
Because it looks like that some people are interested in sankey diagram, I built also a small sample model. http://www.flexsim.com/community/for...do=file&id=212 There it is shown how I did it and I am sure we learned from each other. Thanks Nico. Yes, Flexsim can do a sankey diagram ...
__________________
tom the (A)tom: "We have solved our problems ... now we have to fight the solutions." |
The Following 2 Users Say Thank You to Tom David For This Useful Post: | ||
Simon Farsah (07-30-2009) |
#5
|
||||
|
||||
Hi Tom,
thank you for your modell. I looked at it and I just like to mention that when you are executing an offset travel the arrival trigger will be executed twice, but the toedge is 0, so there will be no counting on the lables. Just in case someone modifies your modell an forgets about this behavior...
__________________
kind regards Nico. |
#6
|
||||
|
||||
Hi,
in my last model was a bug, so the triangles where only shown correctly when the tow linked nodes where on the same x-coordinate. Attached you find the modell with columns which are now 3d(wow) and are rotated towards the linked node.
__________________
kind regards Nico. |
The Following User Says Thank You to Nico Zahn For This Useful Post: | ||
Tom David (08-05-2009) |
Thread | Thread Starter | Forum | Replies | Last Post |
Need explanation of Flexsim drawing commands | AlanZhang | Q&A | 2 | 04-17-2008 10:24 AM |
How to prepare an AutoCAD drawing for Flexsim import. | Regan Blackett | Tips and Tricks | 1 | 11-07-2007 07:08 PM |