Idea

Iago MF avatar image
7 Likes"
Iago MF suggested Iago MF commented

AGV Network Split Paths Tool

Hi,

when creating models using AGV network, I have often encountered situations where certain behaviors or path restrictions become better defined during development. Since the layout has already been created without this information, it sometimes means that certain paths need to be divided into multiple segments, that is, into several path objects, in order to define different characteristics within them.

It would be highly beneficial to have a tool that can automatically divide a single path into multiple segments, allowing users to define a cutting point, for example.

Thanks in advance!

agvnetworkagvpathpath
· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Patrick Zweekhorst avatar image Patrick Zweekhorst commented ·
That would indeed be super useful. We have made different user commands in different models to cut AGV paths. But that was always under some assumptions, such as that the path was not rotated, or assumptions about the travel direction. Keeping all the control point on their original place is a must I think when cutting paths.
0 Likes 0 ·

1 Comment

·
Jason Lightfoot avatar image
1 Like"
Jason Lightfoot commented

Here's a script/command you can test that uses a percentage of the original length for the split point:

Object path=Model.find("AGVNetwork/Path1");   //param(1)
double splitPercent=50;                               //param(2)
Vec3 startLoc=path.getProperty("StartLocation");
Vec3 endLoc=path.getProperty("EndLocation");
Vec3 vec=endLoc-startLoc;
double magnitude=vec.magnitude;
double shortlen=magnitude*splitPercent/100;
Vec3 midLoc=startLoc+vec.normalized*magnitude*splitPercent/100;
treenode temp=nodeinsertinto(Model.find("Tools"));
Table.query("SELECT * FROM Objects() WHERE Object=$1",path).as(Table).cloneTo(temp);
Table(temp)[1]["StartLocation"]=midLoc;
Table(temp)[1]["Name"]+="_new";
Table.query("INSERT INTO Objects() (Class, Container, Name, StartLocation, EndLocation, PathClass, AGVOrientation, AccumulationType) SELECT Class, Container, Name, StartLocation, EndLocation, PathClass, AGVOrientation, AccumulationType FROM $1",temp);
temp.destroy();
Object newpath=path.up.last;
treenode points=getvarnode(path,"pathPoints");
treenode tcs=getvarnode(path,"transferClusters");
treenode newPoints=getvarnode(newpath,"pathPoints");
treenode newTCs=getvarnode(newpath,"transferClusters");
treenode point=points.last;
Object cp;
while (point && point.subnodes["distAlong"].value>shortlen){
    point.up=newPoints;
    point.subnodes["distAlong"].value-=shortlen; 
   //treenode tc=point.value.up.up;  
   // if (tc&&tc.up==tcs)   // do I need to move transfer clusters?
//tc.up=newTCs;
//cp=findownerobject(point.value);
//if (cp.getProperty("Class")=="AGV::ControlPoint")   // re-finalize control points?
//  function_s(cp,"finalizaSpatialChanges");
    point=points.last;
}
setvarnum(path,"length",shortlen);
path.setProperty("EndLocation",midLoc);
setcursor(3);
function_s(path, "refreshAllPathLinks", 0);
function_s(path, "refreshAllPathLinks", 0);  //twice
setcursor(1);

Alternatively you could specify a coordinate and change the code to project that onto the line at 90 degrees to find the intersection point.

· 7
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Iago MF avatar image Iago MF commented ·

Thanks Jason! This works with straight paths. Control points move but this can be solved.

0 Likes 0 ·
Jason Lightfoot avatar image Jason Lightfoot ♦ Iago MF commented ·

In my small test the control points and areas were transferred correctly. Can you share your test? It's just different logic to find the midpoint of a curve based on the sweep angle and start angle - should be simple enough - the location and radius will be the same.

0 Likes 0 ·
Iago MF avatar image Iago MF Jason Lightfoot ♦ commented ·

This is the layout i've tested in FlexSim 23 Update 1:

1693812669903.png

And this is the result: 1693812711007.png

I attach the model

23.1 Split Paths Test.fsm

0 Likes 0 ·
Show more comments
Paula LG avatar image Paula LG commented ·
Hi Jason,


While trying to implement this code, I realized that there's a spelling mistake on line 22; it says "finalizaSpatialChanges", instead of "finalizeSpatialChanges". When I changed it, FlexSim wasn't able to run the code and it shut down. Any thoughts on why this happens?

Thank you in advance!

0 Likes 0 ·
Jason Lightfoot avatar image Jason Lightfoot ♦ Paula LG commented ·
It looks like that's not needed from the most recent test. I've updated the script above to reflect that and included the correct (now commented) references to path point objects. Also commented is code where I tried moving the transfer clusters in case that was needed but I think refreshAllPathlinks takes care of those for us.
0 Likes 0 ·
Iago MF avatar image Iago MF Jason Lightfoot ♦ commented ·
Now it's working fine. Thank you Jason!
0 Likes 0 ·

Write a Comment

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Your Opinion Counts

Share your great idea, or help out by voting for other people's ideas.