ATTENTION

This 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

Go Back   FlexSim Community Forum > FlexSim Software > Q&A
Downloads

Q&A Using Flexsim and building models

  #1  
Old 05-25-2010
Nico Zahn's Avatar
Nico Zahn Nico Zahn is offline
Flexsim User
 
Join Date: Sep 2007
Location: Bingen am Rhein, Germany
Posts: 179
Downloads: 19
Uploads: 4
Thanks: 66
Thanked 60 Times in 32 Posts
Rep Power: 201
Nico Zahn has a spectacular aura aboutNico Zahn has a spectacular aura about
Default 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  
Old 05-25-2010
Steven Hamoen's Avatar
Steven Hamoen Steven Hamoen is offline
Talumis, Flexsim Distributor, The Netherlands
 
Join Date: Aug 2007
Location: Soest, NL
Posts: 854
Downloads: 43
Uploads: 0
Thanks: 391
Thanked 661 Times in 379 Posts
Rep Power: 684
Steven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond repute
Default

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  
Old 05-25-2010
Nico Zahn's Avatar
Nico Zahn Nico Zahn is offline
Flexsim User
 
Join Date: Sep 2007
Location: Bingen am Rhein, Germany
Posts: 179
Downloads: 19
Uploads: 4
Thanks: 66
Thanked 60 Times in 32 Posts
Rep Power: 201
Nico Zahn has a spectacular aura aboutNico Zahn has a spectacular aura about
Default

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  
Old 05-25-2010
Nico Zahn's Avatar
Nico Zahn Nico Zahn is offline
Flexsim User
 
Join Date: Sep 2007
Location: Bingen am Rhein, Germany
Posts: 179
Downloads: 19
Uploads: 4
Thanks: 66
Thanked 60 Times in 32 Posts
Rep Power: 201
Nico Zahn has a spectacular aura aboutNico Zahn has a spectacular aura about
Default

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  
Old 05-25-2010
Jason Lightfoot Jason Lightfoot is offline
Flexsim Consultant
 
Join Date: Aug 2007
Location: Somerset, UK
Posts: 719
Downloads: 20
Uploads: 0
Thanks: 123
Thanked 953 Times in 446 Posts
Rep Power: 773
Jason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond repute
Default

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  
Old 05-25-2010
Steven Hamoen's Avatar
Steven Hamoen Steven Hamoen is offline
Talumis, Flexsim Distributor, The Netherlands
 
Join Date: Aug 2007
Location: Soest, NL
Posts: 854
Downloads: 43
Uploads: 0
Thanks: 391
Thanked 661 Times in 379 Posts
Rep Power: 684
Steven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond repute
Default

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


All times are GMT -6.
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Copyright 1993-2018 FlexSim Software Products, Inc.