Sort Co-Ordinates by Z and and Y (or a second factor) for Robtic Steel Printing

Hi,
I’m wokring on a script for the use in Steel printing with our robots . Right now I am printing dots, which means the robotic arm moves to point A, welds for Xseconds, turns off gun, moves to point B, switches on gun, welds etc. etc.

Right now I’ve managed to sort all the points by their Z Co-ordinates but as you can see from the video HERE the ordering still isn’t optimal - is there a way to sort points so that the list always goes to say the next closest, or say always go in a clockwise direction etc?

Attached GH script

Basically - I’m using Grasshopper to generate robotic language (these are old robots so no offline programming exists for them)… the basic structure looks like this:

MOVE LINEAR TO pnt0001p
arc_start (1)
delay 900
arc_end(1)
MOVE LINEAR TO pnt0002p
arc_start (1)
delay 900
arc_end(1)
MOVE LINEAR TO pnt0003p
arc_start (1)
delay 900
arc_end(1)

and so on… the problem is getting pnt001, pnt002 etc etc to actually be close to eachother

thanks!

SENDING.gh (11.1 KB)

1 Like

Nice project :slight_smile:
You can sort points along a curve. For example you could create a small circle in the center of your object. Than sort points along the curve. You can flip this curve to get the other way around :slight_smile:

Can’t look at your file atm, but this should work.

hi!
thanks for the quick response. Thing is it seems that it’s “either-or” - I tried two things:

  1. Adding a Vertical line in the center and sorting points according to that. This sorted everything for Z but then each point on the layer was called randomly

  2. Adding smaller circle in the center which then had a random listing of the Z value.

tried combining the two but still no luck :confused: !

I can’t open your file, there’s 2 plugins I don’t have or feel like installing.

How do you generate your points? I have a python script that sorts curves by checking for each start point what the next closest point is. And then afterwards I divide those curves into points for machine code.
If you want to input each and every one coordinate in there (how many do you have?) it’s gonna be very slow. I just tried it with something simple, 3 minutes for 5500 points. But I’m sure the Python and C# maniacs around here are able to improve the speed though.

Hi,
so the curves are generated using the Lunchbox plugin - it basically creates a Diagrid structure along a surface (attached)

the amount of co-ordinates depends on the size of the 3d print - something like the image attached is 15cm high with division every 2mm (layer height) has 3000 points. the plan is to print objects that are 3meters high - quick sketch of a simple diagrid that high has 50,000 points (and this is for a simple geometry)…

anything can help! sorting by the Z direction is no problem, it’s just the sorting each layer of points in a smart way that’s tricky

This works.


Sort.gh (15.9 KB)

thank you so much - this will save so much time…! Tomorrow I’ll prepare some prints and will weld a lattice piece this saturday - I’ll post a video here if interested

1 Like

Will be cool to see