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:

Stock Dimensions


Recommended Posts

Yes, there are. This code snippet is from the MPMaster Post, in the Variable Format Assignment section of the Post:

fmt  "L" 2 stck_ht$
fmt  "W" 2 stck_wdth$
fmt  "H" 2 stck_thck$

Here is a section from the same post, that makes decisions about "is the stock rectangular or cylindrical", and then outputs the Min/Max stock dimensions. Hopefully you can adapt this code to your needs.

ppredstck  # Predator stock
           spaces$=0
           q1
           if stock_typ = 1,
             [
             cyl_typ = rot_on_x
             q2
             ]
           if stock_typ = 0, ppredbox
           if stock_typ = 1,
             [
             if cyl_typ = 1, ppredcylx
             if cyl_typ = 2, ppredcyly
             if cyl_typ = 3, ppredcylz
             ]
           spaces$=sav_spc

ppredbox   # Predator Box Stock
           if stck_crnr$ = 0,
             [
             stck_x_min = stck_x$ - stck_ht$/2
             stck_y_min = stck_y$ - stck_wdth$/2
             ]
           if stck_crnr$ = 1 | stck_crnr$ = 5,
             [
             stck_x_min = stck_x$
             stck_y_min = stck_y$ - stck_wdth$
             ]
           if stck_crnr$ = 2 | stck_crnr$ = 6,
             [
             stck_x_min = stck_x$ - stck_ht$
             stck_y_min = stck_y$ - stck_wdth$
             ]
           if stck_crnr$ = 3 | stck_crnr$ = 7,
             [
             stck_x_min = stck_x$ - stck_ht$
             stck_y_min = stck_y$
             ]
           if stck_crnr$ = 4 | stck_crnr$ = 8,
             [
             stck_x_min = stck_x$
             stck_y_min = stck_y$
             ]
           if stck_crnr$ <= 4, stck_z_min = stck_z$ - stck_thck$
           else, stck_z_min = stck_z$

           scomm_str, "SBOX ", *stck_x_min, " ", *stck_y_min, " ", *stck_z_min, " ", *stck_ht$, " ", *stck_wdth$, " ", *stck_thck$, scomm_end

ppredcylx  # Predator Cyl-X Stock
           if stck_crnr$ = 0,
             [
             stck_x_min = stck_x$ - stck_ht$/2
             stck_y_min = stck_y$
             ]
           if stck_crnr$ = 1 | stck_crnr$ = 5,
             [
             stck_x_min = stck_x$
             stck_y_min = stck_y$ - stck_wdth$/2
             ]
           if stck_crnr$ = 2 | stck_crnr$ = 6,
             [
             stck_x_min = stck_x$ - stck_ht$
             stck_y_min = stck_y$ - stck_wdth$/2
             ]
           if stck_crnr$ = 3 | stck_crnr$ = 7,
             [
             stck_x_min = stck_x$ - stck_ht$
             stck_y_min = stck_y$ + stck_wdth$/2
             ]
           if stck_crnr$ = 4 | stck_crnr$ = 8,
             [
             stck_x_min = stck_x$
             stck_y_min = stck_y$ + stck_wdth$/2
             ]
           if stck_crnr$ <= 4, stck_z_min = stck_z$ - stck_thck$/2
           else, stck_z_min = stck_z$ + stck_thck$/2

           stck_diam = stck_wdth$
           if stck_thck$ > stck_wdth$, stck_diam = stck_thck$
           stck_ht$ = stck_ht$
           scomm_str, "SCYL ", *cyl_typ, " ", *stck_x_min, " ", *stck_y_min, " ", *stck_z_min, " ", *stck_diam, " ", *stck_ht$, scomm_end

ppredcyly  # Predator Cyl-Y Stock
           if stck_crnr$ = 0,
             [
             stck_x_min = stck_x$
             stck_y_min = stck_y$ - stck_wdth$/2
             ]
           if stck_crnr$ = 1 | stck_crnr$ = 5,
             [
             stck_x_min = stck_x$ + stck_ht$/2
             stck_y_min = stck_y$ - stck_wdth$
             ]
           if stck_crnr$ = 2 | stck_crnr$ = 6,
             [
             stck_x_min = stck_x$ - stck_ht$/2
             stck_y_min = stck_y$ - stck_wdth$
             ]
           if stck_crnr$ = 3 | stck_crnr$ = 7,
             [
             stck_x_min = stck_x$ - stck_ht$/2
             stck_y_min = stck_y$
             ]
           if stck_crnr$ = 4 | stck_crnr$ = 8,
             [
             stck_x_min = stck_x$ + stck_ht$/2
             stck_y_min = stck_y$
             ]
           if stck_crnr$ <= 4, stck_z_min = stck_z$ - stck_thck$/2
           else, stck_z_min = stck_z$ + stck_thck$/2

           stck_diam = stck_ht$
           if stck_thck$ > stck_ht$, stck_diam = stck_thck$
           stck_ht$ = stck_wdth$
           scomm_str, "SCYL ", *cyl_typ, " ", *stck_x_min, " ", *stck_y_min, " ", *stck_z_min, " ", *stck_diam, " ", *stck_ht$, scomm_end

ppredcylz  # Predator Cyl-Z Stock
           if stck_crnr$ = 0,
             [
             stck_x_min = stck_x$
             stck_y_min = stck_y$
             ]
           if stck_crnr$ = 1 | stck_crnr$ = 5,
             [
             stck_x_min = stck_x$ + stck_ht$/2
             stck_y_min = stck_y$ - stck_wdth$/2
             ]
           if stck_crnr$ = 2 | stck_crnr$ = 6,
             [
             stck_x_min = stck_x$ - stck_ht$/2
             stck_y_min = stck_y$ - stck_wdth$/2
             ]
           if stck_crnr$ = 3 | stck_crnr$ = 7,
             [
             stck_x_min = stck_x$ - stck_ht$/2
             stck_y_min = stck_y$ + stck_wdth$/2
             ]
           if stck_crnr$ = 4 | stck_crnr$ = 8,
             [
             stck_x_min = stck_x$ + stck_ht$/2
             stck_y_min = stck_y$ + stck_wdth$/2
             ]
           if stck_crnr$ <= 4, stck_z_min = stck_z$ - stck_thck$
           else, stck_z_min = stck_z$

           stck_diam = stck_ht$
           if stck_wdth$ > stck_ht$, stck_diam = stck_wdth$
           stck_ht$ = stck_thck$
           scomm_str, "SCYL ", *cyl_typ, " ", *stck_x_min, " ", *stck_y_min, " ", *stck_z_min, " ", *stck_diam, " ", *stck_ht$, scomm_end

pmetastck  # MetaCut View stock
           if stck_crnr$ = 0,
             [
             stck_meta_ox = stck_x$ * m_one - (tox$ * m_one)
             stck_meta_oy = stck_y$ * m_one - (toy$ * m_one)
             ]
           if stck_crnr$ = 1 | stck_crnr$ = 5,
             [
             stck_meta_ox = (stck_x$ + stck_ht$/2) * m_one - (tox$ * m_one)
             stck_meta_oy = (stck_y$ - stck_wdth$/2) * m_one - (toy$ * m_one)
             ]
           if stck_crnr$ = 2 | stck_crnr$ = 6,
             [
             stck_meta_ox = (stck_x$ - stck_ht$/2) * m_one - (tox$ * m_one)
             stck_meta_oy = (stck_y$ - stck_wdth$/2) * m_one - (toy$ * m_one)
             ]
           if stck_crnr$ = 3 | stck_crnr$ = 7,
             [
             stck_meta_ox = (stck_x$ - stck_ht$/2) * m_one - (tox$ * m_one)
             stck_meta_oy = (stck_y$ + stck_wdth$/2) * m_one - (toy$ * m_one)
             ]
           if stck_crnr$ = 4 | stck_crnr$ = 8,
             [
             stck_meta_ox = (stck_x$ + stck_ht$/2) * m_one - (tox$ * m_one)
             stck_meta_oy = (stck_y$ + stck_wdth$/2) * m_one - (toy$ * m_one)
             ]
           if stck_crnr$ <= 4, stck_meta_oz = stck_z$ * m_one - (toz$ * m_one)
           else, stck_meta_oz = (stck_z$ + stck_thck$) * m_one - (toz$ * m_one)

           stck_meta_ht = stck_ht$
           stck_meta_wdth = stck_wdth$
           stck_meta_thck = stck_thck$

           #(NWDSTOCK X8. Y8. Z1.25 OTC OX-4. OY-4. OZ0.)
           spaces$=0
           scomm_str, "NWDSTOCK ", *stck_meta_ht, " ", *stck_meta_wdth, " ", *stck_meta_thck,
           " OTC ", *stck_meta_ox, " ", *stck_meta_oy, " ", *stck_meta_oz, scomm_end
           spaces$=sav_spc

I prefer to start with the "MPMaster" Posts for any 3X or 4X Mill, due to the extra logic that In-House Solutions includes to do the following:

  • Stock Descriptions
  • Min/Max Z Height for each Op, and/or the whole program
  • Correct management of Machine High-Speed Modes (enabling in the correct location: before/after G43 at tool start, and before/after G49 at tool end)
  • Separate "Retract Blocks", one for Tool Change, and one for "Null Tool Change", to allow different retract behaviors if necessary
  • Many other "little" options, which are controlled with "variable switches" at the top of the Post

 

Link to comment
Share on other sites
9 hours ago, eltklas said:

Thanks you. I will Try that. Is there any Generic mpmaster post for Heidenian?. 

Thanks again

No, not for the "free" version of MPMaster. MPMaster is a Fanuc-Based Post, and is made by In-House Solutions (Mastercam Reseller, and hosts of this forum.)

CNC Software does produce a "Generic Heidenhain 530 Post", but you'll need to contact your Reseller for a copy. It also might be available on the Tech Exchange part of the official Mastercam Forum...

Link to comment
Share on other sites
9 hours ago, eltklas said:

That code write de dimension that you have in the stock definition program or is the max measurements of the axes for that machining?

Thanks

That code is is used to "Build Stock" for external simulation. In this case, either Predator, or MetaCut Utilities. Both of which are fairly "old" pieces of software. I believe Predator is still being enhanced, but I could be wrong.

I just posted it, because it shows examples of using the 'stock' variables in MP. You can certainly write different logic to just output the Length, Width, and Height, of the block which you define inside "Stock Setup". However, keep in mind that you'll need additional logic to handle "cylindrical stock" versus just a rectangle. MP actually re-uses the same Length, Width, and Height variables, and populates them based on how the cylinder is oriented in 3D space.

In one of the first "predator stock" blocks, you can see they check the value of 'stock_typ', which is set somewhere else inside the Post. So there needs to be some logic to handle "rectangular versus cylindrical" stock, if you ever use a stock block that isn't a rectangle.

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