Jump to content

Welcome to eMastercam.com
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account
Photo

Sequence Numbers in Canned cycles


16 replies to this topic

#1
VelocityMach

VelocityMach

    Member

  • Members
  • PipPip
  • 66 posts
I have a mori seki c-axis lathe, i am using the mpmaster post. Right now i have my sequence numbers going by 10's and only at the tool changes. I'm wondering if there is a way to get the N numbers in the canned cycles to match the sequence number plus 1. so if my facing cycle is...

N10 T0101

the canned cycle would be...

G71 P11 Q12 U.02 W.01 F.02

right now i have it posting...

G71 P21 Q22 U.02 W.01 F.02

how do i get it to reand the same sequence number as the block its posting for?

I have been messing with this for a while, thought its about time to ask the pros.

Thanks for any and all help

#2
K2csq7

K2csq7

    Advanced Member

  • Members
  • PipPipPip
  • 2,328 posts
  • Location:CT
"whatever your variable is" = n$

#3
VelocityMach

VelocityMach

    Member

  • Members
  • PipPip
  • 66 posts
i have it working on one canned cycle. but when i post anything else with it everything goes haywire. the next block starts at 100. like this...

G54
N10 T0202
G18 G99
M46
G97 S164 M03
G0 X10. Z.5 M8
G50 S2400
G96 S430
X8.074
Z.1
G71 U.5 R.1
G71 P11 Q12 U.02 W.01 F.02
N11 G0 X7.744 S430
G1 Z0.
X7.7815
G3 X7.874 Z-.0462 R.0462
G1 Z-7.2516
N12 X8.074
M9
G0 G53 X0. Z-45.
M05
M01

(TOOL - 12 OFFSET - 12)
(4" CORE BORE)
G54
N100 T1212
G18 G99
G97 S150 M03
G0 X0. Z.25 M8
(DRILL BORE)
G83 Z-9. R-.15 F.01
G80
M9
G0 G53 X0. Z-45.
M05
M01

how do i get the next block to be 20? this is how my sequence numbers are setup now.

pheader$ #Start of file
pheader_custom
if tseqno = 1 & omitseq$ = 1,
[
seqno$ = 10
seqinc$ = 1
n$ = seqno$
]

#4
K2csq7

K2csq7

    Advanced Member

  • Members
  • PipPipPip
  • 2,328 posts
  • Location:CT
Under the NC output settings branch of the control def there is another Posted Image place to set them up.
Though if your not outputting them on each line you will need to create a counter type thingamabob to get it.

What do you want the N # to match? Is it the Q# ?
Use the debugger to find the line that outputs the Q, then at the beginning of that line in the post you need to call your new counter variable (which needs to be defined before you can use it).

And just before you output it, you need to say (new counter variable) = (Q's variable).


Hope I'll be here to help tomorrow, just put 85" dia. 410 SS part on the machine & it's like .800 outta flat... ugggghhhhh

BTW, just looking at the bit you posted at the end.... seqno I would assume to be the starting value for your N#'s, seqinc I would assume to be the increment at which it increases.

#5
VelocityMach

VelocityMach

    Member

  • Members
  • PipPip
  • 66 posts
85 inch diameter?!?!? what are ya making? sounds like you got your stainless from china...

i am trying to get the n number to post out in increments of 10. and the canned cycles to follow in increments of 1. like the canned cycle i posted. excpet instead of n20 t1212 posting out it gave me n100 t1212. i'll keep messing with it and post any results.

good luck with your part, thanks for the help.

#6
K2csq7

K2csq7

    Advanced Member

  • Members
  • PipPipPip
  • 2,328 posts
  • Location:CT
Ok, someone did some work to your post. I don't have that seqno stuff in the stock mpfan.
If you can pin down where your N numbers are coming from (may be different for 1st toolpath in file)
Then put this in a line above it.
seqno$ = seqno$ +1

then directly below the output line

seqno$ =seqno$ -1

You may have to put it inside a conditional statement if that same output line is used for other situations (non-canned cycle paths).

if opcode$ = (canned cycle),
  [  
  seqno$ = seqno$ +1
  ]




same thing with the -1 after the output line.

if opcode$ = (canned cycle),
  [  
  seqno$ = seqno$ +1
  ]



Let me know what you run into!!! I can help you find the opcodes or whatever else you can think of that would be unique to the path (your trigger for the conditional statement) that you want the special sequence number for.

#7
VelocityMach

VelocityMach

    Member

  • Members
  • PipPip
  • 66 posts
my canned cycles are reading from this block

if omitseq$ = one,
[
ng70s = n$
ng70e = n$ + 1
]

ng70s is for the p value and ng70e is for the q value. that part seems to be working.

its number the other - non canned cycle toolpaths that are giving me grief. i will keep trying new things but i thought maybe that would help you understand whats going on.

#8
K2csq7

K2csq7

    Advanced Member

  • Members
  • PipPipPip
  • 2,328 posts
  • Location:CT
So we are on the same page, in the code above all that is happenning is the P value gets set to whatever the sequence number variable is at that point of the post processing process, and the Q value is set to the the same as the sequence # + 1. (i.e. if n$ happens to be 700, P will be 700 and Q will be 701.)

I would....
Try setting up a new variable for the canned cycle sequence numbers (i.e. ncan$)
Just search for and find all the formatting/initializing for the n$ variable & copy it right below but replace n$ with ncan$
Then change all the calls for n$ (only for the canned cycles) to your new variable.


But honestly.....
Something like this I would generally send to whomever did the original post mods.
You never know what kinda stuff they did and where it all is.

#9
VelocityMach

VelocityMach

    Member

  • Members
  • PipPip
  • 66 posts
i kind of wanted to avoid making any new variables. i have done something similar to what you are saying and had it working but was scared of the unknowns. your right, you never know whats all hidden in these things. especially when you start getting into live tooling posts. seems they have you jumping all over the place. if i do come up with some solution i will post it. thanks, your input def helped.

#10
K2csq7

K2csq7

    Advanced Member

  • Members
  • PipPipPip
  • 2,328 posts
  • Location:CT

i kind of wanted to avoid making any new variables. i have done something similar to what you are saying and had it working but was scared of the unknowns.


I was also scared, then I grew some ...... Posted Image
Posted Image

J/K, Good luck & let me know if I can help.

#11
JerryBenoit

JerryBenoit

    Member

  • Members
  • PipPip
  • 99 posts
Hi,

I have done this. I have my post outputting a block number at the start of every tool change sequence increasing by +1, then changed the sequence Numbers to start with N1000 and start to increase +1 on every can-cycle I produce then going back to the original sequence. You will need to create a new variable to accomplish this. The trick to this is create a new variable to store the current n$, that will allow you to maniplulate the n$ to what you desire, then recall the new variable to reastablish the n$ to the original value. What I used as a variable was "sav_numb". If you like more info on this just asked.

Jerry

#12
CADCAM3D5AXIS

CADCAM3D5AXIS

    Advanced Member

  • eMC Learning Group
  • PipPipPip
  • 385 posts
Hi Jerry
that looks like what i would like to do on a mplmaster lathe post do you have any code i could look at to complete this with the least amount of edits. this is a X6 mplmaster post running on a Fanuc control .
TIA :coffee:

#13
JerryBenoit

JerryBenoit

    Member

  • Members
  • PipPip
  • 99 posts
CADCAM3D5AXIS,

Do you omit sequance numbering, meaning you only post block numbers at the start of every tool change not on every line?

Jerry

#14
JerryBenoit

JerryBenoit

    Member

  • Members
  • PipPip
  • 99 posts
Hi CADCAM3D5AXIS,


First make sure you


Attached File  omit.gif   83.18KB   53 downloads

click on image to enlarge


Then start at the list at General user variables list this should be at line 482 in your post (+/- dependending if you have other modification within your post, just look for the comment line). At the end of this list add the variable you wish to use (use something that makes sense, like “sav_numb”). Now if you like to use N1000 and so on for can-cycles and keep that number increasing each time you do another roughing operation insert two variables. Remember variables are case sensitive. After I set a variable search the entire post to see if that variable is being used (use the find case sensitive). If you only find it once you are alset to continue.


#General user variables
xia         : 0     #Formated absolute value for X
yia         : 0     #Formated absolute value for Y
zia         : 0     #Formated absolute value for Z
cia         : 0     #Formated absolute value for C
 “          “ “     #Formated 
 “          “ “     #Formated 
 “          “ “     #Formated 
 “          “ “     #Formated 
rslt_plc    : 0     #Return value from plcval
rslt_upd    : 0     #Return value from updstr
sav_numb    : 0     #Used to save number sequence before can-cycle
pnumb       : 0     #Used to save can-cycle number 

Ok after that search the program down around line 3884 for prcc_call_end$ add the lines marked >>>

prcc_call_end$   #Rough canned cycle end
      # Restore cc_1013 to the value it held prior to the rough  # 1/17/03
      # groove canned cycle. cc_1013 was changed in ptoolend.    # 1/17/03
      if tool_op$ = 208 | tool_op$ = 62, cc_1013$ = sav_cc_1013     # 1/17/03

      if tool_op$ <> 208,
        [
        omitseq$ = sav_omitsq
        if omitseq$ = no$ & cc_seqno, n$ = sav_cc_st_seq     #reset start of canned cycle sequence number
        #Close the ext file
        result = fclose (sbufname3$)
        #Open the ext file as a buffer
        #Use the size to determine the start and end sequence
        subout$ = sav_subout
        size3 = rbuf(three, zero)
        if omitseq$ = one,
          [
>>>>      sav_numb = n$
>>>>      if pnumb = 0, pnumb = 1000  #This set-up the first block number of a can cycle to N1000
>>>>      n$ = pnumb
          ng70s = n$
          ng70e = n$ + 1
          ]
        else,
          [
          if old_new_sw = zero, ng70s = n$ + seqinc$
          else, ng70s = n$ + (seqinc$ * two)
          ng70e = ng70s + (seqinc$ * (size3 - one))
          ]
        pwrite_g70
        ]
      #Setup the stock and clearance directions
      g73x = vsub (lcc_xcst,lcc_xcend)
      if old_new_sw = zero, g73x = g73x * pl_ax_m0x
      else, g73x = g73x * dia_mult
      g73z = g73z * pl_ax_m0z
      xstckcc =  xstckcc * dia_mult * lccdirx
      zstckcc =  zstckcc * lccdirz * pl_ax_m0z
      clearcc =  clearcc * lccdirz * pl_ax_m0z
      #Write the cycle definition
      sav_feed = feed
      sav_ipr = ipr_actv$
      feed = sav_feedcc
      ipr_actv$ = sav_iprcc
      if lathecc = three,
        [
        #Setup the previous position for inc. in G74/G75 cycle
        sav_xa = vequ(xabs) #Save the cycle end
        copy_x = vequ(lcc_xcst) #The cycle start raw
        pshft_map_xa
        pxyzcout  ##The cycle start in machine terms
        ps_inc_calc #Recalculate incremental
        pe_inc_calc #Update previous at start
        xabs = vequ(sav_xa) #Restore the cycle end
        ps_inc_calc #Recalculate incremental
        ]
      if old_new_sw = zero,
        [
        if gcodecc < three, pg71old
        if gcodecc = three, pg73old
        if gcodecc > three, pg74old
        ]
      else,
        [
        if gcodecc < three, pg71new
        if gcodecc = three, pg73new
        if gcodecc > three, pg74new
        ]
      if lathecc = three,
        [
        #Set the cycle end position at the original start
        copy_x = vequ(lcc_xcst) #The cycle start raw
        pshft_map_xa
        pxyzcout  ##The cycle start in machine terms
        ps_inc_calc #Position at start
        pe_inc_calc #Update previous
        ps_inc_calc #Recalculate incremental
        ]
      feed = sav_feed
      ipr_actv$ = sav_ipr
      if tool_op$ <> 208,
        [
        #Bug2 is off to prevent execution crashes with long strings
        bug2$ = zero
        #Write the cycle profile, sequence are written now
        rc3 = one
        while rc3 <= size3,
          [
          sav_eob = eob$           #save out eob character as it's getting lost
          eob$ = 32                #save out eob character as it's getting lost
          prv_eob$ = 32            #save out eob character as it's getting lost   
          #Write the lathe canned cycle profile
          string3 = rbuf (three, rc3)
          if rc3 = two,
            [
            #Add the finish spindle speed to the first move
            speed = n1_ss
            #Mastercam is reporting 0 and 2 backwards for parameter 10124
            #Note that G71 type 1 and 3 are never allowed (can't change Z dir)
            if g71type = 2 | g71type = 3, pbld, *n$, *string3, *speed, e$
            if g71type = 1 | g71type = 0, pbld, *n$, *string3, *speed, "W0.", e$
            ]
          else,
            [
            if omitseq$ = one & rc3 = size3 + one, pbld, *n$, *string3, e$
            else, pbld, n$, *string3, e$
            ]
          eob$ = sav_eob          #save out eob character as it's getting lost     
          canneddone = one
          ]
        #Close the buffer
        result = fclose (three)
        #Remove the ext file
        result = remove (sbufname3$)
        bug2$ = sav_bug2
        ]
      sav_seq = n$
>>>   if omitseq$ = one,
>>>       [
>>>       pnumb =n$  + 1
>>>       if sav_numb > 0, n$ = sav_numb
>>>       ]

now your first can cycle number will be P1000 to Q1001 the next can cyle will be P1002 Q1003


Jerry

PS if you have any trouble or need more info just ask.

#15
CADCAM3D5AXIS

CADCAM3D5AXIS

    Advanced Member

  • eMC Learning Group
  • PipPipPip
  • 385 posts
Thanks Jerry when i get a chance i will update the post as above!
TIA
:thumbsup:

#16
CADCAM3D5AXIS

CADCAM3D5AXIS

    Advanced Member

  • eMC Learning Group
  • PipPipPip
  • 385 posts
Yes i only have it post at the start right now ie N1 = T0101

CADCAM3D5AXIS,

Do you omit sequance numbering, meaning you only post block numbers at the start of every tool change not on every line?

Jerry



#17
chip

chip

    'WORTH' is determined by the company you keep! CH1P

  • Members
  • PipPipPip
  • 1,199 posts
  • Location:Ventura co.
I took a post that didn't have a any variables for "n numbers" and I couldn't get her to go.... I could manipulate some of the numbers like start with N10 (instead of N1000) and stat with 11 and inc x 1 in the output something like that. Anyway I had to...

if g71type = 2 | g71type = 3, pbld, *n$, *string3, *speed, e$ if g71type = 1 | g71type = 0, pbld, *n$, *string3, *speed, "W0.", e$ ] else, [

if omitseq$ = one & rc3 = size3 + one, pbld, *n$, *string3, e$ else, pbld, n$, *string3, e$

I remove the (multiply) *n$ to-----> n$ (in these three strings)

And she goes.....

Way kuhl. :ice:

I really miss being a full time programmer..... :book:



Reply to this topic