Jump to content

Welcome to eMastercam

Register now to participate in the forums, access the download area, buy Mastercam training materials, post processors and more. This message will be removed once you have signed in.

Use your display name or email address to sign in:

Program number issues


Leigh @ Kodiak
 Share

Recommended Posts

First of all, let me say thanks for this great forum, as it has been a tremendous help in learning the ins and outs of Mastercam during this first month. My dream has finally come true and I no longer have to use GibbSCAM! smile.gif

 

So, the problem I have run into is this:

 

I am posting a toolpath group that consists only of transform operations in order to get subprogram output for use on my multiple fixture offsets. Everything is ok, except that the way my main programs and subprograms are numbered are not to my liking.

 

I am working on editing the post to get things the way I would like, but I cant figure out why my main program number is always outputting as 0, regardles of what I have set it as in my op manager. My main program number is fine when I dont have any subs involved....can anybody help poin me in the right direction here?

Link to comment
Share on other sites

Can you put up a section of your post giving you this problem. Also have you contect your dealer to see if they have an off the shelf post that may be doing all you need without effort on your part. Now if you are doing this to learn something look here in MPMASTER:

 

code:

psub_call_s$     #Call to sub level

result = nwadrs(strp, sub_prg_no$)

sub_prg_no$ = sub_prg_no$ + sav_progno + 1000 #Add sub number offset

if sav_progno = sub_prg_no$, result = mprint(sprgnerror)

pbld, n$, "M98", *sub_prg_no$, e$

 

psub_st_s$ #Header in sub level

result = nwadrs(stro, sub_prg_no$)

*e$

*sub_prg_no$, e$

spaces$ = 0

if scomm_sav <> snull, scomm_str, *scomm_sav, scomm_end, e$

spaces$ = sav_spc

pbld, n$, sgabsinc, e$

 

psub_end_s$ #End in sub level

n$, "M99", e$

prv_absinc$ = -1

If you have changed something by accident it might be giving you this problem. Could be something as little as a format statement ot a character. Now if you look at this line:

code:

      sub_prg_no$ = sub_prg_no$ + sav_progno + 1000 #Add sub number offset  

This is doing all the math for the numbers so if you only want an increment of 1 change the 1000 to 1 if you want 5 change accrondinly.

 

HTH

 

BTW Welcome to the forum!!! cheers.gifcheers.gif

Link to comment
Share on other sites

I am just using a modified generic Hass post, and I have not made any changes to the subprogram postblocks whatsoever.

 

 

code:

# --------------------------------------------------------------------------

#Subprogram postblocks

#sub_trnstyp - 0=mirror, 1=rotate, 2=scale, 3=translate

#sub_trnmthd (mirror) - 0=X axis, 1=Y axis, 2=line

#sub_trnmthd (rotate) - 0=tplane, 1=tplane origin only, 2=coordinates

# --------------------------------------------------------------------------

psub_call_m$ #Call to main level, single tool

psub_call_trans

 

psub_call_mm$ #Call to main level, multiple tools

psub_call_trans

 

psub_call_trans #Translate level calls from toolchange, user

if mi1$ <= one, result = mprint(shomeserror)

sav_absinc = absinc$

pindex

#Mirror or Rotate Coord's

if sub_trnstyp$ = zero | (sub_trnstyp$ = one & mr_rt_actv),

[

#The original pattern is not mirrored or rotated

if sub_sec_no$,

[

absinc$ = zero

if sub_trnstyp$, psub_rotate

else, psub_mirror

]

mr_rt_actv = three

]

else, #Translate

[

if sub_mny_t$,

[

if mi1$ > one, absinc$ = zero

pbld, n$, *sgcode, *sgabsinc, pwcs, pfxout, pfyout, pfzout, pfcout, e$

pe_inc_calc

ps_inc_calc

]

]

absinc$ = sav_absinc

result = nwadrs(strp, main_prg_no$)

#if progno$ = main_prg_no$, result = mprint(sprgnerror)

pbld, n$, "M98", *main_prg_no$, e$

prv_feed = c9k #Force feed in sub

 

psub_mirror #Mirror start code, user

#Mirror Y axis

if sub_trnmthd$, pbld, n$, *sgabsinc, strns_mir_on, *sub_trnsx$, e$

#Mirror X axis

else, pbld, n$, *sgabsinc, strns_mir_on, *sub_trnsy$, e$

 

psub_rotate #Rotate start code, user

pbld, n$, *sgcode, *sgabsinc, strns_rot_on, *sub_trnsx$, *sub_trnsy$,

[absinc$ = one], *sgabsinc, *rt_cinc, e$

 

psub_st_m$ #Header in main level

result = nwadrs(stro, main_prg_no$)

" ", e$

*main_prg_no$, e$

#G51/G68 requires absolute position on first move

if mr_rt_actv & absinc$ = one,

[

sav_absinc = absinc$

absinc$ = zero

prv_absinc$ = m_one

prv_xabs = m_one

prv_yabs = m_one

]

else, pbld, n$, sgabsinc, e$

 

psub_end_m$ #End in main level

n$, "M99", e$

prv_absinc$ = -1

#Reset update variables for subs at main level

#Mirror or Rotate cancel, output is forced

if (sub_trnstyp$ = zero & esub_sec_no$ > zero)

| (sub_trnstyp$ = one & esub_sec_no$ = esub_totl_no$-one

& sub_trnmthd$ = two),

[

subout$ = zero

no_nc_out$ = m_one

sav_absinc = absinc$

#Mirror cancel

if sub_trnstyp$ = zero,

[

absinc$ = zero

pbld, n$, *sgabsinc, strns_mir_off, *sub_trnsx$, *sub_trnsy$, e$

]

else, #Rotate cancel

[

pbld, n$, strns_rot_off, e$

]

absinc$ = sav_absinc

no_nc_out$ = zero

]

end_sub_mny = sub_mny_t$

 

psub_end_mny #End in main level for many tools sub, user

#Check for coming out of xform with stage tool.

if end_sub_mny & stagetool = one,

[

*t$

end_sub_mny = zero

]

 

psub_call_s$ #Call to sub level

result = nwadrs(strp, sub_prg_no$)

sub_prg_no$ = sub_prg_no$ + 1000 #Add sub number offset

#if progno$ = sub_prg_no$, result = mprint(sprgnerror)

pbld, n$, "M98", *sub_prg_no$, e$

 

psub_st_s$ #Header in sub leveln

result = nwadrs(stro, sub_prg_no$)

" ", e$

*sub_prg_no$, e$

pbld, n$, sgabsinc, e$

 

psub_end_s$ #End in sub level

n$, "M99", e$

prv_absinc$ = -1


Now that I think about it, shouldnt my subs be comming out 1001,1002...etc? Currently they are 0001,0002...

 

NOTE: My main issue it seems at the moment is My MAIN program # comes out as 0, regardles of what has been specified in Mastercam.

 

Thanks for you help!

Link to comment
Share on other sites

quote:

Did you add your program number in your machine group properties? If you have highlight your operations, right click Edit selected operations, change program number. The program number should be the same as in your properties unless you added it after making toolpaths. If it does read 0 just change it to what you want.


Yes, this is indeed how I am already numbering each toolpath group. Groups that do NOT have transform operations post out the program number properly.

Link to comment
Share on other sites

Ron, you have mail

 

Here is what I'm looking at:

 

GOOD

workingxw9.png

 

code:

 O1000( ALIAS_016_DRILLING_OP1 )   <-----This is OK

( DATE=DD-MM-YY - 21-09-07 TIME=HH:MM - 12:55 )

( MCX FILE - S:CNCA SHOPMASTERCAM PROJECTSGUIDESCOMACTALIASALIAS_016.MCX )

( NC FILE - C:DOCUMENTS AND SETTINGSLWEITZELDESKTOPALIAS_016_DRILLING_OP1.NC )

( T11 | .5 INCH TURBOMILL W/.03125 RAD INSERTS | H11 | D11 | WEAR COMP | TOOL DIA. - .5 | XY STOCK TO LEAVE - .02 | Z STOCK TO LEAVE - 0. )

( T6 | 1/2 82 DEG SPOTDRILL | H6 )

( T8 | 1 INCH DRILL | H8 )

( T17 | 3/8 DRILL | H17 )

( T16 | 39/64 DRILL | H16 )

( T15 | 5/8 REAMER | H15 )

N1000 G20

N1005 G0 G17 G40 G49 G80 G90

N1010 M8

N1015 T11 M6

N1020 T6

N1025 G0 G90 G54 X11.7469 Y-6.9043 S2000 M3

N1030 G43 H11 Z1.

N1035 Z.1

N1040 G1 Z-.005 F20.

BAD

notworkingxc8.png

 

code:

 O0( ALIAS_016_4_PARTS_CONTOUR_OP2 )        <<<< no program number! OH NOES!!

( DATE=DD-MM-YY - 21-09-07 TIME=HH:MM - 12:56 )

( MCX FILE - S:CNCA SHOPMASTERCAM PROJECTSGUIDESCOMACTALIASALIAS_016.MCX )

( NC FILE - S:CNCA SHOPMASTERCAM CODEGUIDESCOMACTALIASALIAS_016_4_PARTS_CONTOUR_OP2.NC )

( T11 | 1.25" TURBOMILL W/.03125 RAD INSERTS | H11 | D11 | WEAR COMP | TOOL DIA. - 1.25 | XY STOCK TO LEAVE - .02 | Z STOCK TO LEAVE - 0. )

( T2 | 2 INCH 45 DEG FACEMILL | H2 )

( T6 | 1/2 82 DEG SPOTDRILL | H6 )

( T7 | 13/64 DRILL | H7 )

( T5 | 3/4 CHAMFER MILL | H5 | D5 | WEAR COMP | TOOL DIA. - .91 )

( T4 | 1 INCH FLAT ENDMILL | H4 | D4 | WEAR COMP | TOOL DIA. - 1. )

N1000 G20

N1005 G0 G17 G40 G49 G80 G90

N1010 M8

N1015 T11 M6

N1020 T2

N1025 G0 G90 G54 X-4.1577 Y-1.8519 S1200 M3

N1030 G43 H11 Z1.

N1035 M98 P0001

N1040 /G90 G55 X-4.1577 Y-1.8519 Z1.

N1045 /M98 P0001

N1050 /G90 G56 X-4.1577 Y-1.8519 Z1.

N1055 /M98 P0001

N1060 /G90 G57 X-4.1577 Y-1.8519 Z1.

N1065 /M98 P0001

N1070 M09

N1075 M5

N1080 G91 G28 Z0.

Link to comment
Share on other sites

Well just looking at your screen you are not pulling those operations from the same group you are pulling them from your 2nd group. Also the program number for that transform operation will not work the post will take it's information from the Transformed operation not from the Program number for that operation. I will look at it but re-look at the 2nd operation group while I do so.

 

 

Edited:

 

Yes I was correct you have no program number in the 2nd group operation.

 

Also you have 5 transform operation for group tool. You only need one and change it to operation type and that will help you there.

 

HTH

Link to comment
Share on other sites

Ok, since this thread is already active, I'm wondering if I could get some thoughts as to how to acomplish this:

 

I want to take this section of code,

code:

N1335 T5 M6

N1340 T4

N1345 G0 G90 G54 X2.7763 Y5.9795 S2500 M3

N1350 G43 H5 Z1.

N1355 M98 P2005

N1360 G90 G55 X2.7763 Y5.9795 Z1.

N1365 M98 P2005

N1370 G90 G56 X2.7763 Y5.9795 Z1.

N1375 M98 P2005

N1380 G90 G57 X2.7763 Y5.9795 Z1.

N1385 M98 P2005

N1390 M09

N1395 M5

N1400 G91 G28 Z0.

and have the post add block deletes before the fixture offsets after G54, so it looks like ths:

 

code:

N1335 T5 M6

N1340 T4

N1345 G0 G90 G54 X2.7763 Y5.9795 S2500 M3

N1350 G43 H5 Z1.

N1355 M98 P2005

/N1360 G90 G55 X2.7763 Y5.9795 Z1.

/N1365 M98 P2005

/N1370 G90 G56 X2.7763 Y5.9795 Z1.

/N1375 M98 P2005

/N1380 G90 G57 X2.7763 Y5.9795 Z1.

/N1385 M98 P2005

N1390 M09

N1395 M5

N1400 G91 G28 Z0.

Link to comment
Share on other sites

Don't it happens all the time to me. I want to point out some thing to you here. With transform you can use it to do everything they way you are doing it now you will have the 2nd op program then you will have a tranform operation after. Change it to like so and all of your positions will be sub programs locations.

 

Step 1 change to operation type also click to copy operations and disable posting in operation:

 

 

Transform_1.jpg

 

Step 2 You will see your operation on the screen Ghost out this is what you want:

 

Transform_2.jpg

 

Now the last step go into the Transfrom op and tell it 5:

 

Transform_3.jpg

 

See if this does what you are trying to do with op2 and 5 transform operations. I think this is what you are after. I also did this to help others who my not be sure what is the best way in which to approach this.

 

HTH

Link to comment
Share on other sites

I had already tried what you have suggested Ron, and it's close, but unfortunately, it wont do all the operations for one tool at each home position before moving to the next.

 

Ie:

OP1, tool1 on G54,G55 etc

OP2, tool1 on G54,G55 etc

 

wheras I would like

cheers.gif

OP1,TOOL1 -->OP2,TOOL1 on G54

OP1,TOOL1 -->OP2,TOOL1 on G55

OP1,TOOL1 -->OP2,TOOL1 on G56

etc

 

 

I am already close to getting what I want for the block delete thing...I will be sure to post back if I get it to work. Thanks again for this awesome forum! cheers.gif

Link to comment
Share on other sites

Ok, I got it! biggrin.gif

 

Here is what I did incase it's useful to anybody else.

 

initialized this:

code:

sub_tracker  : 0	 #Keeps track of Work coordinate offset during translated subprograms  

edited this section of psub_call_trans:

code:

  main_prg_no$ = main_prg_no$ + progno$  <---here is where I got my subs numbered the way I want (FINALLY)

if sub_tracker > 1, pbld, "/" <----added this line

pbld, n$, "M98", *main_prg_no$, e$

prv_feed = c9k #Force feed in sub

edited this section of ptlchg0$:

code:

if mi1$ > one & workofs$ <> prv_workofs$,

[

sav_absinc = absinc$

absinc$ = zero

if sub_tracker > 0, pbld, "/" <---- ADDED THIS LINE

pbld, n$, sgabsinc, pwcs, pfxout, pfyout, pfzout, e$#pfcout,

pe_inc_calc

ps_inc_calc

absinc$ = sav_absinc

]

added this line to ptlchg$:

code:

sub_tracker = 0  

What a nice productive Friday!

Link to comment
Share on other sites
  • 15 years later...
On 9/21/2007 at 8:52 AM, crazy^millman said:
psub_call_s$     #Call to sub level
result = nwadrs(strp, sub_prg_no$)
sub_prg_no$ = sub_prg_no$ + sav_progno + 1000 #Add sub number offset
if sav_progno = sub_prg_no$, result = mprint(sprgnerror)
pbld, n$, "M98", *sub_prg_no$, e$

 

psub_st_s$ #Header in sub level
result = nwadrs(stro, sub_prg_no$)
*e$
*sub_prg_no$, e$
spaces$ = 0
if scomm_sav <> snull, scomm_str, *scomm_sav, scomm_end, e$
spaces$ = sav_spc
pbld, n$, sgabsinc, e$

 

psub_end_s$ #End in sub level
n$, "M99", e$
prv_absinc$ = -1

I'm gonna drag this 2007 post to the top of the list to ask a beginner question.  In the lines:

sub_prg_no$ = sub_prg_no$ + sav_progno + 1000 #Add sub number offset
if sav_progno = sub_prg_no$, result = mprint(sprgnerror)
 
where does sav_progno come from? I'm looking at one of our posts with the same code in it but I don't see it defined anywhere. Is it taken directly from Mastercam?
 
I ask this question out of curiosity more than anything. Again, I'm a beginner to post editing so I'm also guessing this is an elementary question. 
 
Thanks in advance for any help or tips.
Not sure if it matters but I'm running Mastercam 2022.
Link to comment
Share on other sites
4 minutes ago, Jake L said:

Why use sav_progno instead of just using progno$?

When you want to save a value like that, it is typically done becasue it may also get called and used in a different post block or it maybe be updated along the way...it is saved to make sure the original value is what is captured.

  • Thanks 1
  • Like 1
Link to comment
Share on other sites

Myself, I use internal subs, they are posted at the bottom of my programs, after the M30...as such, every program can have the exact sames used again and again becasue you're going to call an external sub....my 1st sub is always N40001, N40002, N40003...etc...

I have programs that have 150 subs in there....the question method could work but in some case, no one is going to want to answer the same question over and over and over, when you can automate it and never worry about it again.

JM2C YMMV

Link to comment
Share on other sites
On 12/10/2022 at 8:07 AM, JParis said:

Internally within MP most variables have available a sav_*variable" name

 

Hi John,

The "sav_" Variables are all User Defined in the Post Instructions File (*.PST). All variables in MP (both Predefined and User-Defined), have a "Previous Variable Slot" that is created during initialization.

If you define "my_var : 0", MP will create two slots in memory > "my_var", and "prv_my_var". It is the "prv_" prefix which gets automatically created for every variable.

I would expect that somewhere within the Post the OP is referencing, that "sav_progno" was defined as a User Defined variable. (So, technically, there would be a 'sav_progno' and a 'prv_sav_progno' variable defined by MP, although it is often the case that the "previous" variable slot is never used by whomever wrote the Post...)

Examples of User-Defined "Saved" variables:

 

sav_spc      : 0     #Save spaces
sav_gcode    : 0     #Gcode saved
sav_absinc   : 0     #Absolute/Incremental Saved Value
sav_coolant  : 0     #Coolant saved
sav_frc_wcs  : 0     #Force work offset flag saved
  • Like 2
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.

Join us!

eMastercam - your online source for all things Mastercam.

Together, we are the strongest Mastercam community on the web with over 56,000 members, and our online store offers a wide selection of training materials for all applications and skill levels.

Follow us

×
×
  • Create New...