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 color network node
Hi,
I want to distiguish two networks by coloring the network nodes... Any Ideas how to do this in a simple way?
__________________
kind regards Nico. |
#2
|
||||
|
||||
Nico,
The color is pretty fixed in the code. If you have a very dark background (black for instance) the node gets white otherwise it is always black. Maybe the easiest is to do your own thing on the ondraw. In the code Flexsim just draws a point: glBegin(GL_POINTS); glVertex3f(0,0,0); glEnd(); only it compensates for the zooming so that it always looks the same size and it uses the glPointSize to do that. Steven |
The Following User Says Thank You to Steven Hamoen For This Useful Post: | ||
Nico Zahn (05-25-2010) |
#3
|
||||
|
||||
Hi Steven,
the problem is that if you put your own drawcode to the NN, it loses the functionality to draw connections between the nodes and you can not switch the showmode of the network. It would be nice if there would be something like a color attribute to change and the rest of the NN-functionality would stay the same...
__________________
kind regards Nico. |
#4
|
||||
|
||||
So changeing the color of the NN is not really working, but I can draw something on top of the connections which is also pretty..
In the Ondrawcode of the NN I put the following : /**colored column*/ treenode current = ownerobject(c); treenode view = parnode(1); // If this function returns a true, the default draw code of the object will not be executed. if(getvarnum(current,"showmode")!=0) { double d_width; treenode t_obj; double d_length; double d_winkel; drawtomodelscale(current); for(int x=1;x<=nrop(current);x++) { t_obj=outobject(current,x); d_width=0.1; double d_tc_x = vectorprojectx(model(), xloc(current),yloc(current),zloc(current), current); double d_tc_y = vectorprojecty(model(), xloc(current),yloc(current),zloc(current), current); double d_ta_x = vectorprojectx(model(), xloc(t_obj),yloc(t_obj),zloc(t_obj), current); double d_ta_y = vectorprojecty(model(), xloc(t_obj),yloc(t_obj),zloc(t_obj), current); d_length = sqrt(d_ta_x*d_ta_x+d_ta_y*d_ta_y); d_winkel= radianstodegrees(acos(d_ta_y/sqrt((d_ta_x*d_ta_x)+(d_ta_y*d_ta_y)))); if(d_ta_x<0) { d_winkel=-d_winkel; } drawcolumn(d_tc_x,d_tc_y,0,6,d_width,d_width,d_len gth,270,d_winkel,0,0,255,0); } } Color and width can be changed in the drawcolum command
__________________
kind regards Nico. |
The Following User Says Thank You to Nico Zahn For This Useful Post: | ||
Tom David (05-25-2010) |
#5
|
|||
|
|||
It should be okay. Try this:
Code:
treenode current = ownerobject(c); treenode view = parnode(1); drawtomodelscale(current); drawsphere(0,0,0,.1,200,100,0); drawtoobjectscale(current); return 0; |
The Following User Says Thank You to Jason Lightfoot For This Useful Post: | ||
Nico Zahn (05-25-2010) |
#6
|
||||
|
||||
Nico,
This was more or less what I meant, just be sure to return 0; ! and not a 1 because if you return a 0 the standard code is still executed. So just draw the point over the existing point and return a 0. Steven Just noticed that Jason beats me! Last edited by Steven Hamoen; 05-25-2010 at 07:05 AM. Reason: Someone was faster |
The Following 3 Users Say Thank You to Steven Hamoen For This Useful Post: | ||
Tom David (05-25-2010) |
Thread | Thread Starter | Forum | Replies | Last Post |
Create Network Node At Reset | Sung Kim | Q&A | 1 | 04-13-2010 08:42 AM |
Network Node Question | Gavin Douglas | Q&A | 1 | 10-16-2008 02:24 PM |
Release from Network Node | Gavin Douglas | Q&A | 2 | 06-12-2008 12:39 PM |
Tools for ojbect connect to network node | KelvinHo | Q&A | 6 | 04-24-2008 08:37 AM |
Moving Network Node Information into a Table | Brandon Peterson | Q&A | 2 | 02-15-2008 09:46 AM |