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.

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:

  1. Object path=Model.find("AGVNetwork/Path1"); //param(1)
  2. double splitPercent=50; //param(2)
  3. Vec3 startLoc=path.getProperty("StartLocation");
  4. Vec3 endLoc=path.getProperty("EndLocation");
  5. Vec3 vec=endLoc-startLoc;
  6. double magnitude=vec.magnitude;
  7. double shortlen=magnitude*splitPercent/100;
  8. Vec3 midLoc=startLoc+vec.normalized*magnitude*splitPercent/100;
  9. treenode temp=nodeinsertinto(Model.find("Tools"));
  10. Table.query("SELECT * FROM Objects() WHERE Object=$1",path).as(Table).cloneTo(temp);
  11. Table(temp)[1]["StartLocation"]=midLoc;
  12. Table(temp)[1]["Name"]+="_new";
  13. 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);
  14. temp.destroy();
  15. Object newpath=path.up.last;
  16. treenode points=getvarnode(path,"pathPoints");
  17. treenode tcs=getvarnode(path,"transferClusters");
  18. treenode newPoints=getvarnode(newpath,"pathPoints");
  19. treenode newTCs=getvarnode(newpath,"transferClusters");
  20. treenode point=points.last;
  21. Object cp;
  22. while (point && point.subnodes["distAlong"].value>shortlen){
  23. point.up=newPoints;
  24. point.subnodes["distAlong"].value-=shortlen;
  25. //treenode tc=point.value.up.up;
  26. // if (tc&&tc.up==tcs) // do I need to move transfer clusters?
  27. //tc.up=newTCs;
  28. //cp=findownerobject(point.value);
  29. //if (cp.getProperty("Class")=="AGV::ControlPoint") // re-finalize control points?
  30. // function_s(cp,"finalizaSpatialChanges");
  31. point=points.last;
  32. }
  33. setvarnum(path,"length",shortlen);
  34. path.setProperty("EndLocation",midLoc);
  35. setcursor(3);
  36. function_s(path, "refreshAllPathLinks", 0);
  37. function_s(path, "refreshAllPathLinks", 0); //twice
  38. 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.

Your Opinion Counts

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