I'd like to generate AGV paths from coordinates in an imported Excel file.
Are there commands to create paths from code for example: createpath(x1,y1,z1,x2,y2,z2,a,b,c)?
I can't find such a command.
Thanks,
I'd like to generate AGV paths from coordinates in an imported Excel file.
Are there commands to create paths from code for example: createpath(x1,y1,z1,x2,y2,z2,a,b,c)?
I can't find such a command.
Thanks,
@Patrick Cloutier, did either of these solutions work for you?
This was a question from a potential client who wants to buy Flexsim. I only needed to know if it can be done. Since I was pretty confident that one of these methods will work I told him YES.
But I didn't try these. Yet.
So I don't know which answer to accept.
You can create AGV paths the same way you create other objects: using createinstance(). See: How to create and join AVG paths in flexscript
For example, the following code creates a straight path and a curved path:
treenode path1 = createinstance(node("/AGV/StraightPath",library()),model()); setsize(path1,3,1,1); setloc(path1,1,0,0); function_s(path1, "finalizeSpatialChanges"); treenode path2 = createinstance(node("/AGV/CurvedPath",library()),model()); setloc(path2,4,1,0); setvarnum(path2, "radius", 1); setvarnum(path2, "startAngle", -90); setvarnum(path2, "sweepAngle", 90); function_s(path2, "finalizeSpatialChanges");
There are no commands to do it. The view does it through edit modes. You could try to replicate the edit modes, but I couldn't get it to work. Here is some code for a user command that might be able to get you started, but that I can't get to work correctly for the curved parts:
/**Custom Code*/ Vec3 point1 = Vec3(param(1), param(2), param(3)); Vec3 point2 = Vec3(param(4), param(5), param(6)); int isCurved = param(7); int xFirst = isCurved && param(7) == 1; treenode view = param(8); treenode agvNetwork = node("/AGVNetwork", model()); treenode container = agvNetwork; if (!objectexists(container)) container = model(); string className = isCurved ? "AGV::CurvedPath" : "AGV::StraightPath"; int appendNr = 1; string name = "Path"; while (objectexists(node(concat(name, numtostring(appendNr, 0, 0)), agvNetwork))) appendNr++; treenode theClass = findmatchintree(library(), getname(first(classes(a))) == className); if (!objectexists(theClass)) return 0; treenode path = setname(createinstance(theClass, container), concat(name, numtostring(appendNr, 0, 0))); set(spatialsx(path), 0); setcenter(path, point1.x, point1.y, point1.z + 0.5 * zsize(path)); setselectedobject(view, path); if (xFirst) { function_s(path, "dragEnd", point2.x, point1.y, point1.z, view); } else { function_s(path, "dragEnd", point1.x, point2.y, point1.z, view); } function_s(path, "dragEnd", point2.x, point2.y, point2.z, view); function_s(path, "finalizeSpatialChanges", view);
And here's an example using that code:
treenode view = node("VIEW:/active/MainPanel/BackPanel/SplitterXPane/SplitterYPane/TabPane/TabControl/Perspective>viewwindowtype/Perspective/1/../../.."); createAGVPath(0, 0, 0, 5, 0, 0, 0, view); createAGVPath(5, 0, 0, 6, 1, 0, 2, view); createAGVPath(6, 1, 0, 6, 2, 0, 0, view); createAGVPath(6, 2, 0, 5, 3, 0, 1, view); // This curve doesn't work right
Note that it requires the active view. Also note that I can't guarantee that this approach will really work long term, because it isn't designed for people to do this outside the drag-drop interface. But good luck!
An approach using Table.query() to insert objects can be found here for conveyors - AGV paths are similar and should be able to use the same arc functions described there.
6 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 | © Autodesk Inc. All rights reserved