algorithmic modeling for Rhino
Hello,
I am trying to create my own custom g-code writer for 3d printing, and I first have a basic question which I hope someone can help me with - I would like to split a list of points based on their z value. For example, I have contoured a shape at a desired height and I would like to separate each contour - is this possible? I was unsuccessful with the Sublist & Member Index commands. I have attached a sample definition. Any help would be appreciated.
Something like this...
G1 X81.78 Y-5.38 Z40
G1 X81.79 Y-5.61 Z40
G1 X81.51 Y-6.21 Z40
G1 X81.41 Y-6.55 Z40
G1 X81.43 Y-6.8 Z40
G1 X81.3 Y-7.1 Z40
G1 X81.3 Y-7.1 Z41.25
G1 X82.53 Y0.06 Z41
G1 X82.46 Y1.68 Z41
G1 X82.27 Y3.2 Z41
G1 X81.93 Y4.75 Z41
G1 X81.46 Y6.22 Z41
G1 X81.13 Y7.05 Z41
G1 X80.71 Y7.95 Z41
Tags:
see attached
One way I like to compare items in a list without scripting is to generate a list of those items from index 0 to list length - 2 and index 1 to list length -1 (using series and list items).
Then you can compare those lists with equality, smaller, larger, or other components and use a member index to retrieve the indices where certain conditions are met. In this case i'm looking for the index when the z values of the points aren't equal. Those indices are used to generate sublists of the strings that were formatted. I'm not sure if the strings are exactly the way you want them but hopefully they are set up enough for you to tweak them.
good luck
Chris is right, I didn't even look at the right half of the definition - I just dealt with the points after they were flattened.
Here is a much shorter method using brep contour instead (so you only have to specify distance between contours. It doesn't create null values either).
For some reason the string formatting was a little weird - it would put the negative sign (-) in front of the string I added before each number. For example:
Format("{0:G1 X0.00 }{1:Y0.00 }{2:Z0.00}",x,y,z)
Is generating results like:
-G1 X23.56 -Y5.23 Z42.00
I'm not sure why these negative signs are where they are, but I used a replace string component as a quick fix.
By measuring curvature at point and its neigbours (or angle between normal vectors) you can change interpolation and get G02 and G03
For clarification, years later, I think you mean...
Format("G1 X{0:0.00} Y{1:0.00} Z{2:0.00}",x,y,z)
Thanks for the tip!
Hi Serifos,
I'm currently working on the same thing. What kind of printer are you writing the script for? Do you know of anyone else who has done something similar?
I did a NC-Code-Generator-Def a while ago.
It's meant for 3Axis-CNC-Mill.
Glad if you can benefit from it.
cheers,
frank
hi, all
hi, brian
first upload
full nc generator , fomatted type "shopbot"
this one is working and has been tested, it works.The approach of frank is wonderfull, but his program does not yet work.
simple way > convert to your specific code
the replicatorG opensource produces g code for 3d printing
The conversion to my code (shopbot) is in that file
same strategy can be used to generate g-code from sbp.code
look closely at where data is collected and use FrankS formatting
hope this will help
dingenis
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by