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
|
|||
|
|||
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
|
||||
|
||||
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
|
|||
|
|||
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) |