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
|
|||
|
|||
draw network nodes using data from an excel sheet
I saw a thread some time about getting and printing information about existing network nodes in a model.
now i have a need to create network nodes based on data from an excel sheet. Excel sheet has node id, x, y, and z coordinates. has some body done it before ? thanks, Vinay |
#2
|
||||
|
||||
Vinay,
I have written this code many times but am having trouble finding some that doesn't have a lot of other stuff built into it also. So, try the following code: treenode nnobj = node("/NetworkNode", library()); //This gets a pointer to the network nodes treenode tnode; //Create a pointer to use later to point to new nodes for(int row = 1; row <= gettablerows("Nodes"); row++) { tnode = createinstance(nnobj, model()); //Create the new node setname(tnode, gettablestr("Nodes", row, 1)); //Set the name of the node setloc(tnode, gettablenum("Nodes", row, 2), gettablenum("Nodes", row, 3), gettablenum("Nodes", row, 4)); //Set the location of the node } That code requires that you import the Data in Excel into a Flexsim global table called Nodes. The first column of the table needs to be text. Good Luck, Brandon
__________________
thats not normal. |
#3
|
||||
|
||||
Connect the Netwrok nodes
Hi Brandon
We are working on a project which has a similar kind of structure. We would like to know how to modify the code above, to get the network nodes connected to each other, like for instance, i would like to read this table as a globular table and get the network nodes connected . Station X coord Y coord No: of tracks Predecessor NN1 10 12 1 NN2 NN2 13 11 2 NN3, NN4 NN3 15 14 2 NN1, NN5 and so on....... Your code above helped us in displaying the nodes, but is it possible to get them connected........ |
#4
|
|||
|
|||
You should be able to connect them using the contextdragconnection command
|
The Following 2 Users Say Thank You to Jason Lightfoot For This Useful Post: | ||
Nischith Kashyap (01-24-2011) |
#5
|
|||
|
|||
Hi Jason,
Thanks for your reply. Is this code still applicable to the current FlexSim 7.3? Where should I implement the code on the OnModelOpen trigger?? Thanks a lot, Thomas |
#6
|
|||
|
|||
There is a small change to the create instance code as the address of the network node has changed
Quote:
|
#7
|
||||
|
||||
I would suggest to put your code into a user command because it's more convenient
A good place to use this command could be the "Post Import Code" in the "Excel Interface". This will execute the command if you import a new Excel table. Greetings, Carsten |
The Following 2 Users Say Thank You to Carsten Seehafer For This Useful Post: | ||
Phil BoBo (10-14-2014) |
#8
|
||||
|
||||
Quote:
Code:
createinstance(node("?NetworkNode",library()),model()); |
The Following 5 Users Say Thank You to Phil BoBo For This Useful Post: | ||
Steven Hamoen (10-14-2014) |
Thread | Thread Starter | Forum | Replies | Last Post |
Excel Data Import | Sung Kim | Q&A | 2 | 07-16-2010 10:41 AM |
Accessing Data of a Recorder and Referencing Nodes in the Tree | Jan Brandau | Q&A | 5 | 04-22-2008 07:05 AM |
Find all nodes toggled as C++ | Brandon Peterson | Tips and Tricks | 0 | 04-18-2008 03:36 PM |
Expertfit cannot find network key - Flexsim Network License | Kris Geisberger | Q&A | 0 | 02-05-2008 05:10 PM |
Excel and global tables | Bill Nordgren | Q&A | 2 | 10-15-2007 04:36 AM |