I'm using:

Camworks 2001 plus
Solidworks 2001 plus

When I try to use the "Insert Post Operation", there isn't anything listed there.

I was expecting the mandatory and optional stop commands (M00/M01), but those aren't there either.

The Camworks post processor architecture is poorly documented and disorganized. I'm an experienced programmer and this is garbage. I scoured the internet and all I could find were several versions of the same document, which basically just lists all the identifiers, commands, and variables, but doesn't provide an overall picture of the structure.

The files that play a role are:

your_machine.SRC
your_machine.LIB
MILL.LIB
MASTER.ATR

"your_machine" means whatever the filename for your particular machine is.

The above files are all human readable. I'm not going to attempt to "describe" them since they all seem to have similar aspects and its not clear to me what can or cannot go in any of them. And good luck finding any documentation on that.

NOTE: before you try any of this junk you should at least figure out how to edit the relevant files in notepad, compile them using UPG, and then reload your post processor in camworks.

So, here are the steps:

STEP 1: Getting something to appear in the "Insert Post Operation" dialog box.

Add another operation in your_machine.SRC after all the existing operations. It looks like Camworks puts whatever additional operations you add into the Insert Post Operation dialog box.

:OPERID=Option stop
:OPEREND

Add an entry in MASTER.ATR which gives the new operation an "ID", and also update the HIGH_ID number in that file.

:OPERID=Option stop
:ATTRID=17506 <--------- use the next highest ID number above whatever is at the bottom of your MASTER.ATR
:ATTREND

:IDHIGH=17506 <---------- this is at the top of MASTER.ATR. Edit it to make sure its equal to the highest ID in MASTER.ATR

."Option stop" will now appear in the Insert Post Operation dialog box, but it wont do anything.

STEP 2: Getting your new post operation to DO something.

Now lets add what we need to make "Option stop" actually output an M01 in the NC code.

Add a new "SECTION" to MILL.LIB that inserts the M01 code.

find this line in MILL.LIB:

:SECTION=CALC_START_OPERATION

and right after it, put this:

:C: IF OPR_TYPE=OPTION_STOP THEN <-------notice how its all in caps and now has an "_" instead of space? all that matters.
:C: CALL(OPTION_STOP)
:C: CALL(CALC_CHECK_OPER_COMMENTS)
:C: RETURN
:C: ENDIF

Next, add a new "SECTION" that will output the M01 code:

Go to where all the SECTIONS are in your_machine.SRC, and add this somewhere:

:SECTION=OPTION_STOP
:T:M01<EOL>


Now recompile, reload your post processor in camworks, and insert a new post operation. Select the "Option Stop".

Now post process, and look at your code. You should see an M01 wherever you inserted the post operation.

Some other things I've learned, that if someone asks I will gladly post instructions for:

How to make it so you can have a list of predefined options to select from when you insert the post operation. I.e. instead of "option stop" it would be "Stop" and the list would have "Mandatory Stop M00" and "Optional Stop M01".

How to make it so on the Post tab of each operation you can enter a value directly or use a list and have it output and/or modify NC code based on that.

IMPORTANT NOTES:

Notice how I called it "option stop" instead of something more logical like "optional stop"? Well it turns out there is already a bunch of "optional stop" "program stop" crap inside all those text files and if you use an existing name and it conflicts it wont work and you'll be wondering why. So either cleanup all the files so they aren't using the names you want to use, or use names that are definitely unique and make sure they arent already in the files.

Also, it seems that you may need to CAPITALIZE and use "_" underscores instead of spaces sometimes even when referring to an identifier that is elsewhere lowercase and with spaces.