Hi @Mark S3, was Jordan Johnson's answer helpful? If so, please click the "Accept" button at the bottom of their answer. Or if you still have questions, add a comment and we'll continue the conversation.
If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always unaccept and comment back to reopen your question.
Use the Vec3 constructor that takes 3 parameters.
- Variant loc = A->labels["LOC"]->value;
- Vec3 oldLOC = Vec3(loc[1], loc[2], loc[3]);
Since an Array doesn't have x, y, or z properties, the constructor that it is trying to use is returning compiler errors.
- Variant loc = A->labels["LOC"]->value;
- Vec3 oldLOC = Vec3(loc[1], loc[2], loc[3]);
- Vec3 newLOC = oldLOC.project(station1, station2);
- Array arrayLoc = Array();
- arrayLoc[1] = newLOC.x;
- arrayLoc[2] = newLOC.y;
- arrayLoc[3] = newLOC.z;
- A->labels["LOC"]->value = arrayLoc;
Vec3 is not a Datatype for a label. You can only cast it as an array. If you need a Vec3 variable you have to cast it from your array.
Maybe you should try to test your coding in FlexSim directly before you implement it a DLL. So you can see what FlexSim supports.
You can only use objectAs() when you are casting the data on a treenode to a SimpleDataType*, a CouplingDataType* or an ObjectDataType*, or a derivative of those classes.
Vec3 isn't one of those classes. You can, however, cast it as an Array (which can be stored on a node because it is a Variant), and then cast the Array back to a Vec3:
- // You can explicitely cast a Variant as an array. Then the compiler should be able to implicitly cast the array to a Vec3
- Vec3 oldLoc = (Array)A->labels["LOC"]->value;
Jordan's answer presumes you are using the Module SDK to build your DLL with the latest FlexSim header files.
If you are using the DLL Maker instead of the Module SDK, then you won't have access to all of those properties and methods.
19 People are following this question.
FlexSim can help you understand and improve any system or process. Transform your existing data into accurate predictions.
FlexSim is a fully 3D simulation software environment. FlexSim can be used to simulate any process in any industry.
FlexSim®, FlexSim Healthcare™, Problem Solved.®, the FlexSim logo, the FlexSim X-mark, and the FlexSim Healthcare logo with stylized Caduceus mark are trademarks of FlexSim Software Products, Inc. All rights reserved.
Privacy | Do not sell or share my personal information | Cookie preferences | Report noncompliance | Terms of use | Legal | © 2025 Autodesk Inc. All rights reserved