Can maximum arc length or line length be specified in SC

Having problems with or questions about SheetCam? Post them here.
Post Reply
mancavedweller
Posts: 161
Joined: Tue Feb 25, 2014 6:53 am

Can maximum arc length or line length be specified in SC

Post by mancavedweller »

Hi Les, or anyone else if they know the answer.

This may sound like a very unusual request/querie, but I have a very good reason to have lines and arcs limited to a maximum length.

So, is there any way in SC or the post processor to specify a maximum line/arc length.

Then for example, if I specified a maximum line/arc length of 100mm, a 2 metre long line or arc would be automatically split up into twenty 100mm lengths, and subsequently would have twenty separate gcode commands generated for these 100mm lines/arcs.

Thanks,

Keith
mancavedweller
Posts: 161
Joined: Tue Feb 25, 2014 6:53 am

Post by mancavedweller »

Les,

any chance of an answer on the above.

I've tried splitting a long arc / circle up in CAD (two completely different softwares) so it's made up of multiple arcs, but the strange thing is when I import it into Sheetcam, some of these individual arcs may be joined into one longer arc, then I don't get the required individual G02/G03 commands for each arc I drew in cad.

Thanks,

Keith
User avatar
Les Newell
Site Admin
Posts: 3660
Joined: Thu May 11, 2006 8:12 pm

Post by Les Newell »

Oops, sorry about that. The only way to do that would be to make a custom post processor. SheetCam normally does it's best to reduce the number of g-code lines produced.

Why do you need to shorten the moves?
mancavedweller
Posts: 161
Joined: Tue Feb 25, 2014 6:53 am

Post by mancavedweller »

Cheers Les,

Mid cut re-starts due to flameouts when plasma cutting, require that you do a “Run From Hereâ€￾ / “Set Next Lineâ€￾ in the gcode.

I’m using UCCNC and the ultimate method would be if you could back up the path in the current gcode move/block, but UCCNC can’t do that, it can only go back to the start of the move/block.

To avoid restart divots I normally do a dry run along the already cut path and fire the torch a few mm before the flameout point. First, however I’d touch off at the flameout point to make sure my height is good.

Now imagine this gcode line was a 2m (or longer) straight line or arc, and the flameout happened near the end of this line/arc. The Run From Here would cause the torch to go all the way to the start of this line/arc gcode block. Not only is this time wasting but if the metal is not perfectly flat on the table or is/has warped, the torch could be hitting the metal during the dry run. Even if your table is made flat, thinner sheet can warp during cutting, or there’s slag build up on the slats, etc, etc.

The solution is to start the dry run as close as possible to the flameout point.

So my idea was to have “pre-emptiveâ€￾ gcode generated where I never have a line or arc longer than a specified distance.

I realise this will generate some extra gcode but the advantages for plasma cutting outweigh the disadvantage of a little extra file size, at least for me.

Hope that made sense.

Keith
User avatar
Les Newell
Site Admin
Posts: 3660
Joined: Thu May 11, 2006 8:12 pm

Post by Les Newell »

What post are you using?
It is pretty easy to break arcs into lots of short line segments. Edit the post and look for function OnArc().
Delete everything up to the end of the function and replace it with this:
function OnArc()
post.ArcAsMoves(0.1)
end

Breaking lines is a bit more complicated. Check if breaking arcs works on your setup. If so I'll take a look at breaking lines.
mancavedweller
Posts: 161
Joined: Tue Feb 25, 2014 6:53 am

Post by mancavedweller »

Thanks Les.

I tried that but it's not really an ideal solution. Instead of G02/3 shorter arcs, I'm just getting G01 straight lines around 7-10 mm in length.

The ideal solution would be a setting in the post processor where the user can enter a max arc length and line length, and then any arc or line longer than this distance is broken up into shorter arcs (not straight lines) and lines.

I understand this may be a lot of re-coding and I may be the only guy who asks for such a change, so if it's a lot of work, I'll just sort out the arcs and lines in cad.

I played with some of the Drawing Import settings and that seemed to help with getting all the arcs I'd created in cad, to show up in Sheetcam. So I can probably get by like this. Prior to that some of the arcs were being joined into a longer arc when I imported the drawing into Sheetcam.

Keith.
mancavedweller
Posts: 161
Joined: Tue Feb 25, 2014 6:53 am

Post by mancavedweller »

Les Newell wrote: Breaking lines is a bit more complicated. Check if breaking arcs works on your setup.

If so I'll take a look at breaking lines.
Hi Les,

when you are back into the swing of things after Xmas/New Year, could I take you up on your offer of adding the capability to break up lines into shorter lengths.

Having looked into this further since my last post, I've come to realise that breaking up arcs into smaller straight line segments should be perfectly acceptable. I also realise now that internally, most CNC controllers break up a G02/G03 command internally into lots of tiny straight line moves in any case.

I played with the setting in:

OnArc()
post.ArcAsMoves(0.1)

until I got short enough line segments so that the overall arc smoothed out. Yes, the file size was increased substantially but only to some tens of Kb which is nothing for modern hard drive storage. Plus my CNC controller has smoothing settings in any case to blend the short straight lines.

So apologies for my previous ignorance and could I ask that you also add the capability to break up straight lines into shorter distances.

Wishing you a great Xmas and New Year, and thanks for a great product.

Keith.
mancavedweller
Posts: 161
Joined: Tue Feb 25, 2014 6:53 am

Re: Can maximum arc length or line length be specified in SC

Post by mancavedweller »

Hi Les,

I see you are back in action on the forum so I'm guessing my request (post before this one) has got "buried" by the later ones.

No rush if you are chilling out for the holiday season. Whenever you are back at work in January is OK.

I've tried drawing a long line as a series of shorter lines but when I export as either DXF or SVG and import into Sheetcam, the lines are all joined together. In any case it's very tedious and time consuming doing things that way.

Cheers,

Keith
User avatar
Les Newell
Site Admin
Posts: 3660
Joined: Thu May 11, 2006 8:12 pm

Re: Can maximum arc length or line length be specified in SC

Post by Les Newell »

Sorry about that. OK, this should do it. Replace your function OnMove with this one:

Code: Select all

function OnMove()
   local maxLen = 5 --this is the maximum line length in mm
   local incX = endX - currentX;
   local incY = endY - currentY;
   local len = math.hypot(incX, incY)
   local nSegs = math.toint((len / maxLen) + 0.5)
   if(nSegs < 1) then nSegs = 1 end
   incX = incX / nSegs
   incY = incY / nSegs
   post.ModalText (" G01")
   for c=1,nSegs do
      currentX = currentX + incX
      currentY = currentY + incY
      post.ModalNumber (" X", currentX * scale, "0.0000")
      post.ModalNumber (" Y", currentY * scale, "0.0000")
      post.ModalNumber (" Z", (endZ + toolOffset) * scale, "0.000")
      post.ModalNumber (" F", feedRate * scale, "0.0###")
      post.Eol()
   end
end
This specifies a maximum line length of 5mm. You can change it by changing maxLen on the scond line. I have't thoroughly tested it but it should work.
mancavedweller
Posts: 161
Joined: Tue Feb 25, 2014 6:53 am

Re: Can maximum arc length or line length be specified in SC

Post by mancavedweller »

Les, that is fantastic.

Thank you very much, that is my Xmas present for this year.

I had a job with a lot of flameouts a couple of years ago. This new "power" will make life a lot easier and faster now.

Hope you have a great New Year.

Keith.
Post Reply