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 06-23-2014
andrecorreia andrecorreia is offline
Flexsim User
 
Join Date: Feb 2013
Location: Brisbane City
Posts: 12
Downloads: 12
Uploads: 0
Thanks: 11
Thanked 3 Times in 3 Posts
Rep Power: 89
andrecorreia is on a distinguished road
Default getbundlevalue in the DLL

Hey there,
I'm trying to use getbundlevalue in a DLL to get a string type field from a bundle but apparently this overload was not exposed in the DLL. I can only get a number type field from a bundle.

From "declaration.h": (no getbundlevalue returning string)
Code:
inline double getbundlevalue(treenode x, int entrynr, char* fieldname){return getbundlevaluealias1(x, entrynr, fieldname);}
inline double getbundlevalue(treenode x, int entrynr, int fieldnr){return getbundlevaluealias2(x, entrynr, fieldnr);}

Does anyone know a workaround for that?

Thanks.
Andre.
  #2  
Old 06-23-2014
Jörg Vogel's Avatar
Jörg Vogel Jörg Vogel is offline
Flexsim User
 
Join Date: Sep 2007
Location: Hannover, Germany
Posts: 643
Downloads: 35
Uploads: 0
Thanks: 802
Thanked 665 Times in 410 Posts
Rep Power: 642
Jörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond repute
Default

Hello Andre,

have you tried to store your string to a node directly in the model tree? Then you return this node as number from your DLL, convert the number back to a node and get access to the string with the command getnodestr(obj/node).

Jörg
  #3  
Old 06-24-2014
Esther Bennett Esther Bennett is offline
Flexsim User
 
Join Date: Mar 2008
Posts: 115
Downloads: 27
Uploads: 0
Thanks: 103
Thanked 116 Times in 50 Posts
Rep Power: 271
Esther Bennett is a name known to allEsther Bennett is a name known to allEsther Bennett is a name known to allEsther Bennett is a name known to allEsther Bennett is a name known to allEsther Bennett is a name known to all
Default

Hello Andre,

You could also cast the value to a string (I got this info from FlexSim):
"string varsting = apchar((void*)(size_t)getbundlevalue(bundlenode, entrynumber, "fieldname"));

char* varcharpointer = apchar((void*)(size_t)getbundlevalue(bundlenode,
entrynumber, "fieldname"));

The (size_t) will cast the variable from a double to a pointer, the (void*) will cast that pointer as a void pointer, and the apchar() command is a FlexSim command that takes a void pointer as its parameter and will either return a string or a char pointer. This is why I have the assigned variable (either varstring or varcharpointer) type as either a string or a char pointer.


You just need to make sure the entrynumber and "fieldname" variables in the getbundlevalue() command are set correctly."


Esther
The Following 7 Users Say Thank You to Esther Bennett For This Useful Post:
Steven Hamoen (06-24-2014)
  #4  
Old 06-24-2014
andrecorreia andrecorreia is offline
Flexsim User
 
Join Date: Feb 2013
Location: Brisbane City
Posts: 12
Downloads: 12
Uploads: 0
Thanks: 11
Thanked 3 Times in 3 Posts
Rep Power: 89
andrecorreia is on a distinguished road
Default

Thanks Esther, that worked perfectly!!



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.