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:

Why would someone do this?


Recommended Posts

I have been working my way through a bunch of posts that my company paid someone (not going to say who) to make. But there are some really weird things in here. Look at this and see if you can figure it out. Note mi1$ is not named in the CD.

psof$
      if mi1$ > one, absinc$ = zero
      pwcs, sgcode, sgabsinc, pfxout, pfyout, pfcout, pstagetool, e$

ptlchg0$
      if mi1$ > one & workofs$ <> prv_workofs$,
        [
        sav_absinc = absinc$
        absinc$ = zero
        pbld, n$, sgabsinc, pwcs, pfxout, pfyout, pfzout, pfcout, e$
        pe_inc_calc
        ps_inc_calc
        absinc$ = sav_absinc
        ]
pwcs            #G54+ coordinate setting at toolchange
      if mi1$ > one,
        [
        sav_frc_wcs = force_wcs
        if sub_level$ > 0, force_wcs = zero
        if workofs$ <> prv_workofs$ | (force_wcs & toolchng),
          [
          if workofs$ < 6,
            [
            g_wcs = workofs$ + 54
            *g_wcs
            ]
          else,
            [
            p_wcs = workofs$ - five
            "G54.1", *p_wcs
            ]
          ]
        force_wcs = sav_frc_wcs
        !workofs$
        ]

Edit: post mi1 is pre set to have a value of 2

I kinda want to PM the guy who made this post but he hasn't been on here for two years. He still works for our re-seller though.

Link to comment
Share on other sites

Here is the whole pwcs block untouched.

pwcs            #G54+ coordinate setting at toolchange
      if mi1$ > one,
        [
        sav_frc_wcs = force_wcs
        if sub_level$ > 0, force_wcs = zero
        if workofs$ <> prv_workofs$ | (force_wcs & toolchng),
          [
          if workofs$ < 6,
            [
            g_wcs = workofs$ + 54
            *g_wcs
            ]
          else,
            [
            p_wcs = workofs$ - five
            "G54.1", *p_wcs
            ]
          ]
        force_wcs = sav_frc_wcs
        !workofs$
        ]

That's all of it. Nothing but another block comes after.

Link to comment
Share on other sites

Are you asking why he removed some, but not all, of the conditions?

 

The 'pwcs' post block is pretty much "standard". Compare it to the Generic Fanuc 4X Mill Post:

pwcs            #G54+ coordinate setting at toolchange
      if mi1$ > one,
        [
        sav_frc_wcs = force_wcs
        if sub_level$ > 0, force_wcs = zero
        if workofs$ <> prv_workofs$ | (force_wcs & toolchng),
          [
          if workofs$ < 6,
            [
            g_wcs = workofs$ + 54
            *g_wcs
            ]
          else,
            [
            p_wcs = workofs$ - five
            "G54.1", *p_wcs
            ]
          ]
        force_wcs = sav_frc_wcs
        !workofs$
        ]

pgear           #Find spindle gear from lookup table
      if use_gear = one,
        [
        gear = frange (one, speed)
        *gear
        ]

I think what you'll see is that it is almost exactly the same, if not identical.

 

So "why" did he take out some of the 'mi1$' logic, but not in other areas? Because he likely only made the edits he needed, at the time, to get the code he wanted for a particular job.

 

The only really "suspect" thing for me is:

        pbld, n$, sgabsinc, pwcs, pfxout, pfyout, pfzout, pfcout, e$
        pe_inc_calc
        ps_inc_calc

'pe_inc_calc' is a post block name that stands for 'end of incremental calculations'. Then 'ps_inc_calc' is the "start of incremental calculations". So he called the "end" block, before the start block.

Link to comment
Share on other sites

Yeah, I guess I was just a little annoyed with the post and didn't give all the info. Combined the code before with this code.

      pbld, n$, "G0 G91 G28 Z0", e$ 
      #pbld, n$, *smetric, e$
      #pbld, n$, *sgcode, *sgplane, scc0, sg49, sg80, *sgabsinc, e$
      sav_absinc = absinc$
      #if mi1$ <= one, #Work coordinate system
      #  [
      #  absinc$ = one
      #  pfbld, n$, sgabsinc, *sg28ref, "Z0.", e$
      #  pfbld, n$, *sg28ref, "X0.", "Y0.", e$
      #  pfbld, n$, sg92, *xh$, *yh$, *zh$, e$
      #  absinc$ = sav_absinc
      #  ]
      pcom_moveb
      pcheckaxis

That shows it a little better. It's just that there are a lot of shortcuts and some stuff works and other stuff doesn't. I guess I was just always taught to not break code when you are trying to fix code. If you chose to shut off a function then shut it off, don't leave stuff hanging around waiting for someone else to fix later. I get how hard it can be to get something to work just the way you want and how quick it is to hard code lines in but it just makes more work down the line as new features come out, posts are updated and as they are duplicated for new machines that the company buys. Maybe my nose is stuck a little to high in the air to see the reality of this but to me, it's just added to my work load, combing through posts and identifying broken links. Do you think I am being unreasonable?

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