From: EBo <eb...@sa...> - 2009-01-31 19:55:08
|
Jst, That is so cool. I have some pointer on how to solve a couple of problems you either have stumbled against or will soon enough. Also, I missed Jeff Epler's posts on biarcs, etc., otherwise I would have jumped in earlier. First regarding hard coded linearizations, one of the best ways to linearize a spline is to subdivide the spline. Since Jeff's implementation appears to be based on quadratic Bezier splines, we can use the property that all spines are guaranteed to fit with the bounding box of the control polygon. You can simply fit a line between the two end points and calculate the Euclidean distance from the other two control points to determine what the maximum divergence from that line is. From there you can choose some arbitrary epsilon, check to see if the current spline falls out side that and subdivide the spline if the inner control points fall outside this epsilon. That will allow you to generate as many approximation lines to follow the Bezier spline as you need to stay within your chosen epsilon. You can do better than this however by then taking the number of linear segments and resubdivide trying to balance out the positions of the break points so you do not have a relatively short segment always at the end (this improves visual quality). This is all callable from within Inkscape. Back in 2004 I had a filter program which would take the spline output from Inkscape, then linearize it into standard g-code for a 2.5D engraver using this technique. I was just about to make a comment on how Jeff's work could be used as a basis for implementing spline contours, but a quick search came up with a paper "CAD/CAM INTEGRATION FOR NURBS PATH INTERPOLATION ON PC BASED REAL-TIME NUMERICAL CONTROL" by Leto, Licari1, Lo Valvo1, and Piacentini1. Which demonstrates NURBS working within EMC2. HURRAAAYYY! Did you know that it is a relatively trivial issue to get helical interpolation (read point threading in in both milling machines and lathes), and lots of other things besides... Actually, assuming that the NURBS code has been integrated back into EMC2, then you should be able to write a Bezier to NURBS converter and be able to read any PDF or PS image directly into the NURBS -- since Bezier splines is a subclass of B-splines. So, I think this is doable directly in EMC ***provided*** NURBS have been integrated into the core. This, for me at least, is WAY EXCITING NEWS!!!!! EBo -- Johnny Stenback <em...@js...> said: > Hello all, > > I just wanted to share one of my recent late-night hacking outcomes. I > recently started looking into G-code generation of various kinds, and I > stumbled across Inkscape and Jeff Epler's gcode extension, and his work > on biarcs. I started playing around and eventually got the extension to > work in the latest version of Inkscape (0.46). I then made gcode produce > arcs (from circular arcs in Inkscape), and later on got Jeff's biarc.py > incorporated, so now the extension exports curves as biarcs (hard coded > to 5 per curve segment atm)! > > The code is by no means complete, and I'm fairly new to Python, so > there's probably some retarded stuff in there. The Z-axis movement isn't > always quite right (I might have broke that, but that's a detail that'll > work itself out over time here), but I wanted to share the fact that > generating G-code arc commands from biarcs, generated from curves in > inkscape works! > > The code is available to play with here: > > http://dp.jstenback.com/gcode/ > > I'd be interested to hear if anyone has thoughts or suggestions on this. > And a huge thanks to Jeff for his initial extension, and biarc.py! > > (this was sent to the emc-users list as well, but I figured maybe > there's people here who'd have thoughts too) > > -- > jst > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by: > SourcForge Community > SourceForge wants to tell your story. > http://p.sf.net/sfu/sf-spreadtheword > _______________________________________________ > Emc-developers mailing list > Emc...@li... > https://lists.sourceforge.net/lists/listinfo/emc-developers > -- |