View Full Version : How to check for offset-mode inside a sbp file... ?

Marc F. Lupien
07-18-2020, 12:18 PM
Need some help figuring this one out.

I wrote a custom post processor for vcarve for my laser. Everything fine but... yesterday I wanted to burn multiple copies of the same logo so I manually created a new sbp file with multiple FP command from different origin using the 2D offset mode of the FP command.

The problem is that I need to change my post processor in order to check if the file is running in 2D offset mode or not and I don't know how.

I tried check if system variables %(61) or %(62) are not zero but this does not work because the previous offset is still in there from the last time an offset mode was used even though the current execution is not in offset mode.

I need this to skip a pause in my laser sbp file if it's running in offset mode because the idea is to be able to make multiple copies without user intervention. On the other hand, when I run just a single file (not in offset mode), I want a user confirmation before starting the laser and tell him not to forget to wear the safety goggles.

Any help would be appreciated.

07-18-2020, 01:07 PM
Have you looked at the VO command...

VO -Value Temporary Tool Offset {Activate Offset, Offset-X, Offset-Y, Offset-Z, Offset-A, Offset-B, Offset-C}

This command turns on or off a temporary off-setting of movement in each of the axis given a designated offset.All moves are offset from the time the command is activated until it is turned off or the Part File exited.The offsets are added to the current display such that the true current position is displayed in the position readout. The temporary offsets are added to whatever other offsetting or proportioning may be applicable within the file. This command is typically used with a second head such as a dual Z or an air drill.ActivateTool Offset (1 -ON, 2 -OFF)Turns the Temporary Tool Offset ON or OFF. Can be used with or without axis offset parameters. Offset parameters are those most recently entered. Offset Distance X ... C Distance to offset any axis given in the next 6 parameters. Inches or mm.

It's been a while since I've run SB3 and I had many custom files like this, but if a file is run in 2D offset, doesn't it automatically turn it off when finished? I've use the VO command with variables for the desired offset for cutting multiple parts from 4 x 8 sheets and it worked nicely.

You could possibly use an unused output that you turn off/on and then check the status of it.

I'm sure that there are numerous ways to do what you want, just need to find the one that works as desired.

Marc F. Lupien
07-18-2020, 01:50 PM
Hi srwtlc,

I did not know of the VO command but it does not solve my problem. I am french canadian so my english is probably not crystal clear.

I need to be able to check, inside a sbp file, whether an offset is being applied because I need the sbp file to perform alternate instructions in case we are in a situation where the file is being repeated for multiple copies of a toolpath. The VO command is yet another way to restart a toolpath from a different starting origin but it does not tell me how to test if the current file is being run «under the influence of VO» or not.

07-18-2020, 02:47 PM
Could you set a variable (True/False) when you are doing multiples or not and then check for it?

Turn on a unused output and check for it with %101-%108 and show a msgbox if needed. Turn it off at the end of the file that is being run in offset mode when it's done.

Marc F. Lupien
07-18-2020, 02:51 PM
Yes, that could work. I'll look into it.

At first I was hoping to get the current mode from one of the system variables but your idea might be viable too. Thanks for the input.

Marc F. Lupien
07-21-2020, 09:45 PM
I feel really stupid when I find out that things did not work as expected because I made an obvious programming error...

So in case it can benefit others, in a sbp file, it is possible to detect that we are running with an offset for X and Y by testing system variables 61 (for x offset) and 62 (for y).
What I do is something like this:

&tmpoff = abs(%(61)) + abs(%(62))
if &tmpoff > 0.001 then goto runningwithoffset

sorry again for creating this post for nothing really.

07-22-2020, 10:16 AM
Good job, glad you got it worked out! What was your error, just a little syntax?

It wasn't for nothing, someone else may come across a similar situation and now there's answer.

07-22-2020, 12:31 PM
Hey Mark, I'm genuinely curious as to why you didn't just repeat the job in VCarve/Aspire instead of writing a custom post? I'm sure there's a reason, I'd be interested in knowing what it is.

Marc F. Lupien
07-23-2020, 11:22 PM
[QUOTE=srwtlc;207356]Good job, glad you got it worked out! What was your error, just a little syntax?

The error was that I forgot the first line «&tmpoff = abs(%(61)) + abs(%(62))» at one point in time in my tests so I was always testing with a previous value for &tmpoff... silly me

Marc F. Lupien
07-23-2020, 11:44 PM
Hi Eric,

I'm not sure I understand your question but I hope this clears things:

I am using a custom post processor because the toolpath that I am running using a laser to engrave some logo.

Last year, when I installed my laser, I had to write a new post processor for VCarve because the way my laser is turned on and off is different than the way a router (or spindle) is turned on or off.

Because of those differences, I had to add a couple of lines at the beginning of my post-processor to PAUSE the operation and remind the user to put on his protective goggles and so on.

Everything was fine until recently wher I had to put the same logo on multiple wood pieces. So I manually wrote a small sbp file with a series of M2 commands followed by an FP command. With the FP command, you can set an offset-mode and tell it to run the specified sbp file from the current x,y without having to change anything in the sbp file. I think this can also be done with another command (VO maybe??).

The problem was that the PAUSE and the warning from my laser sbp file was popping for every part I wanted to engrave, not just the first one - so it was impossible to leave the shop and have the shopbot do all the work. Now, I changed my laser post processor in order to check whether the sbp file is being run with an offset - meaning it's probably a multiple copy operation and therefore avoid the PAUSE statement.

Note that I never had to do multiple part with a standard router-cut file so I don't know whether a standard sbp file (one with one of the provided post-processor) have the same issue that I had with the file I created from my laser post-processor.

Is this clearer ?

07-24-2020, 07:25 AM
Ahh! That makes a lot of sense!

I had to do something similar when I had an air drill setup on my SB controller. Did you ever look into any of the air drill offset stuff?

It sounds like what you did totally solved the problem. When I had the air drill setup I had to hack my Vectric post a lot to get it to work like I wanted to, but then when I went to use Fusion 360 it didn't work the way I wanted, so for me I went back and messed around a lot with the built in air drill scripts. That way no matter what CAM I used my drill would work the same way.

Changing the Vectric post like you did is in my opinion the much easier way to do it, but if you ever wanted to use a different CAM software there is some more hackery you could do :)

07-24-2020, 07:38 AM
Might it be worthwhile to see if Vectric's new "Laser Module" might be worth your while?

Marc F. Lupien
07-25-2020, 06:30 PM
Hello Scottp55,

I was not aware of those features, thanks.

I guess that works for the latest VCarve version like 10.something... I am still using 8.5 and I don't want to pay that much money for the new version...

Now I do most of my work with Fusion but I find myself going back to Vcarve often anyway.

07-26-2020, 05:32 AM
Yes Marc...That was brand new with 10.5**
Price WAS steep going from Shopbot Edition, but I'm active on the Vectric Forum and like to be able to open all the files.
After the sticker shock was gone.....I'm still glad I stayed current so my file drawing speed stays up with the new features:)

Just thought I'd mention that.

07-26-2020, 08:50 AM
Marc, what are you designing and cutting in Fusion? And what brings you back to Vcarve instead of Fusion?

Marc F. Lupien
07-26-2020, 12:31 PM
Well Eric, most of my work is lutherie. I build mostly archtop guitars and some solidbody (electric) ones. Note that I don't do this professionnally. I sold only a very few right now but I am working on producing more as I get better at it and wish to sell some of my limited production.

I am retired from computer engineering, always palyed guitar and had some woodworking experience. Learning software like Fusion is not that difficult for me neither is the numeric technology.

So in Fusion, I design some guitar parts that are 3D like necks and bodies for electric guitars. I use it also for tools or jigs that I need (like radius blocks for the fretboard, etc.). I tend to prefer Fusion when the design has 3D, when it needs more precision and when I plan on reusing a design for a long time.

Sometimes I just need to create a simple toolpath, like facing a small block of wood for glueing or cutting a simple template, so I tend to go back to VCarve for that. I feel that for a very simple 2D one-shot job, VCarve might be faster. Also, for engraving, I often feel that the VCarve Guick Engraving toolpath is easier to use than the equivalent in Fusion.

But I really like how Fusion integrates the design, rendering, manufacturing and also the drawings, not to mention the more powerfull toolpath options.

What to YOU do in Fusion ? I am curious too.

07-27-2020, 01:22 PM
That answer makes a lot of sense to me. Fusion is pretty good at stuff like guitars, and it makes sense to use the built in CAM for that sort of thing.

I find where Fusion really falls down is multi-part stuff. Big sheets of material, stuff that you want to move around a lot, etc are all doable in Fusion, but a pain.

My use case is about the same as you, if I'm doing a single part thing that's pretty complex, or my source file is a STEP file I'll use Fusion. The rest of the things I cut are wither with my own CAM software or Aspire.