Z surface bending

Here's the place for discussion related to CAM/CNC and the development of the Path module.
User avatar
Gegsite
Posts: 10
Joined: Mon Jun 16, 2014 6:21 am
Location: Hungary
Contact:

Z surface bending

Postby Gegsite » Wed Jul 08, 2020 1:47 pm

Hello!

Just wanted to make an engraving a text on a cylinder (mounted in a vice) and I have run into a problem that Freecad cannot make it.

The part I wanted to make is too big for the 4th axis.
There is a dress-up made by Brad (sliptonic) but it lacks the manual data input option.
https://www.youtube.com/watch?v=dY8SIL1cdmA

So it would be nice to be able to give the radius or the tilting of the Z to compensate the path.
(now it uses a probe-head to scan the surface and have to save the file of point and load it.)

I had a rectangle shape part with round ends (about 6") and I needed to engrave to the round surface.

Hope it is clear what I want.
Sorry for my English.

Bye,
Gergő
User avatar
sliptonic
Posts: 1793
Joined: Tue Oct 25, 2011 10:46 pm

Re: Z surface bending

Postby sliptonic » Thu Jul 09, 2020 3:21 pm

This should be pretty easy to implement. The way the dressup works is to take the probe input data, construct a surface and then use the surface to bilinear interpolate the gcode points.

It should be easy to just make the dressup take an existing surface and use that instead. So you could model the cylinder or other surface however you want and then select it as the shape to interpolate against.

I'll take a look at it.
User avatar
sliptonic
Posts: 1793
Joined: Tue Oct 25, 2011 10:46 pm

Re: Z surface bending

Postby sliptonic » Thu Jul 09, 2020 9:08 pm

I sent a PR https://github.com/FreeCAD/FreeCAD/pull/3687.

If you don't want to wait for it to get merged, it's a simple one-line change that just un-hides the interpsurface property.

To use it, you'll need to somehow model the curve you want. I get weird results with a complete cylinder but something like this works:
2020-07-09_16-04.png
2020-07-09_16-04.png (16.16 KiB) Viewed 250 times
Add the dressup to an existing path. Use the interpsurface property in the treeview to select the face and recompute the dressup.
2020-07-09_16-05.png
2020-07-09_16-05.png (8.59 KiB) Viewed 250 times
User avatar
Gegsite
Posts: 10
Joined: Mon Jun 16, 2014 6:21 am
Location: Hungary
Contact:

Re: Z surface bending

Postby Gegsite » Fri Jul 10, 2020 12:58 pm

Hello!

Wow, it was pretty fast solving issue than.
I will try it out.

Hope this dress-up will be useful in other path/CAM works too.
I think this stuff is really helpful on datum-plane and rounded part engraving and slot making. Also could be used it in making lithography / Lithophane.

Thanks again!
User avatar
freman
Posts: 1160
Joined: Tue Nov 27, 2018 10:30 pm

Re: Z surface bending

Postby freman » Mon Jul 20, 2020 7:53 am

That's cool, I hadn't seen the Z correction dress-up.

I was intending to add this to GRBL at some stage but if I can do it in FC, it may save the effort.

You will probably find that Catmull-Rom interpolation gives a smoother result, if you are ever interested. That would not be that relevant to bed correction but examples like the rounded lump of wood in the video would probably gain accuracy. I just mention that in case it is of interest. I guess you could always just increase the density of sampling with the current code until the error is small enough.

Catmull-Rom is used a lot in image processing for up-scaling or resampling. It is a four point spline fit. The algo is fairly simple and computation light enough to do on megapixel images.

Widely used in games also. IIRC it is often included in GPU instructions, it is that widely used.

That reminds me I do need to spend some time adjusting the bed of my CNC.