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:

WCS - T Plane compare


Smrk
 Share

Recommended Posts

I would like to warn programmer, that WCS and T-plane are different, so i added this into my post:

 

"string definition"

s_wcsnam
s_tplnam
 

and in pparameter$  section

 

    if prmcode$ = 20012, s_tplnam = sparameter$
    if prmcode$ = 20014, s_wcsnam = sparameter$
      [
         if s_tplnam <> s_wcsnam, mprint("WCS-TPlane !!!)

      ]

 

but i get this error:

 

PST LINE (914) - The post block output type processing has failed!, , Label has not been defined[32]
PST LINE (914) - The post block output type processing has failed!, , Illegal character(s) encountered
PST LINE (914) - The post block output type processing has failed!, , Label was expected but was not found[51], Illegal character(s) encountered

 

I think that boolean <> is allowed for strings and result is 0 or 1. I tried many options how to fix this, but it still doesnt work. Pleas, can you help me?

 

 

And the next level is how to capture WCS origin coordinates and compare them to warn programmer.

These values are in OP_VIEW003 parameter 15366-15368, but i dont have this output in NCI.

Any Idea?

 

Thanks,

Smrk

Link to comment
Share on other sites

In your post look for string definitions and define your variables;

# Misc strings
# --------------------------------------------------------------------------
smachinepath : ""    # Machine path
smachinename : ""    # Machine name
sgroupname : ""      # Group name
sOpSeqNo   : ""      # Operation manager operation number
s_wcsnam  : ""       # WCS Name  <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
s_tplnam  : ""        # Tool plane name   <<<<<<<<<<<<<<<<<<<<<<<<<<

Link to comment
Share on other sites

It's a great idea for 4AXIS and 5TH AXIS...  Here is exactly how I did and I hopt this helps.  I did not define new name because MP Post already has the name already (sconstplname, stoolplname).

 

# --------------------------------------------------------------------------
# Common User-defined Variable Initializations (not switches!)
# --------------------------------------------------------------------------

 

sConstructToolPlane: 0

 

# --------------------------------------------------------------------------
# Error Checks
# --------------------------------------------------------------------------

 

sConstructToolPlane = "CUT# "+sOpSeqNo+" TOOLPLANE and CONSTRUCTION PLANE are DIFFERENT"
                      +no2asc(13)+"TOOL#"+no2str(t$)+" ("+s20001+")"+no2asc(13)
                      +no2asc(13)+"                Tool Plane = "+(stoolplname)
                      +no2asc(13)+" Construction Plane = "+(sconstplname)+no2asc(13)
                      +no2asc(13)
                      +"Confirm Plane(WCS) in Page"+no2asc(13)
                      +no2asc(13)
                      +"Click OK to proceed posting."+no2asc(13)
                      +"Click CANCLE to abort posting."+no2asc(13)

 

 

Under...

fmt    5 year$
fmt    5 month$
fmt    5 day$
fmt    4 hour
fmt    5 min

 

         if sconstplname<>stoolplname, [if mprint(sConstructToolPlane, 2) = 2, exitpost$]

Link to comment
Share on other sites

Finally i programmed this:

 

#buffer definition
stplnam
size2 : 0
rc2 : 1
wc2 : 1
fbuf 2 0 80 0

swcsnam
size3 : 0
rc3 : 1
wc3 : 1
fbuf 3 0 80 0

 

 

pwrttparam$ #pre read routine

 

      if prmcode$ = 20014, sparameter$ = wbuf(3, wc3) #store WCS name to buffer 3
      if prmcode$ = 20012, sparameter$ = wbuf(2, wc2) #store T-plane name to buffer 2

 

 

pwcscheck # postblock to read and compare WCS - T-plane

 

    size2 = rbuf(2, 0)
    while rc2 <= size2,
    [
       stplnam = rbuf(2, rc2)
        size3 = rbuf(3, 0)
        while rc3 <= size3,
        [
        swcsnam = rbuf(3, rc3)
        ]
    if stplnam <> swcsnam, result = mprint("WCS - TPlane ARE DIFFERENT!!!")
        ]

 

psof$            #Start of file for non-zero tool number

 pwcscheck

...

...

It looks like it works, but i have another question:

is it possible to stop while loop after first postitive result? Because at this moment it gives me as many pop-up windows as many differences in plane names.

Thanks

  • Like 1
Link to comment
Share on other sites

Finally i programmed this:

 

#buffer definition

stplnam

size2 : 0

rc2 : 1

wc2 : 1

fbuf 2 0 80 0

 

swcsnam

size3 : 0

rc3 : 1

wc3 : 1

fbuf 3 0 80 0

 

 

pwrttparam$ #pre read routine

 

      if prmcode$ = 20014, sparameter$ = wbuf(3, wc3) #store WCS name to buffer 3

      if prmcode$ = 20012, sparameter$ = wbuf(2, wc2) #store T-plane name to buffer 2

 

 

pwcscheck # postblock to read and compare WCS - T-plane

 

    size2 = rbuf(2, 0)

    while rc2 <= size2,

    [

       stplnam = rbuf(2, rc2)

        size3 = rbuf(3, 0)

        while rc3 <= size3,

        [

        swcsnam = rbuf(3, rc3)

        ]

    if stplnam <> swcsnam, result = mprint("WCS - TPlane ARE DIFFERENT!!!")

        ]

 

psof$            #Start of file for non-zero tool number

 pwcscheck

...

...

It looks like it works, but i have another question:

is it possible to stop while loop after first postitive result? Because at this moment it gives me as many pop-up windows as many differences in plane names.

Thanks

 

Written that way I would say not. It would have to be done a condition loop and not a while loop. The while loop is looking for the condition till the end of the process is done. A condition loop can be set to look at per instance or per as many instances as you want. You have while less than or equal to for your while loop check. Not sure if it will work if you redo the logic to allow for a amount of errors or not? Maybe do a counter loop after your error reporting. That was the user could decide to see one at a time by hitting a key or keep it like it is hitting a different key. Kind of like PC did with his OK and Cancel which is pretty slick.

 

Oh yeah nice work and thanks for sharing I copied and pasted it into my book of knowledge.

Link to comment
Share on other sites
  • 4 weeks later...

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...