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:

Thread diameter value into a comment in the outputted nc code


geirsj
 Share

Recommended Posts

Hi!

I have a question if it is possible to capture the major thread diameter value into a comment from the post processor.

or if it is available as a value in a tag for setup sheets?

see attached image

Now i just put the value in the comment field, but sometimes that is also used for other comments so it gets a little crowded.

I do thread milling on daily basis and have an access database of my default values and compare that to the program output and if it

is and old value i changed it to the new in the access database.

 

It would be nice to have the post to output the value for me in a separate comment when a thread mill operation is operational.

 

I will need some help on this, and do not want to be breaking any forum rules of asking if that's not appropriate, then i ask for

forgiveness in advance.

This would help me a lot in my daily programming, as i make cavities for valve cartridges most of the time and need to change old program to run them again

with new values on the thread mill diameter.

my program is in metric, but i guess that is not a problem for this task.

I make a lot of imperial threaded dimensions, but have all measures in mm for metric, to keep the post and programming tidy.

I have also looked if i could use the machine to control the diameter, but as i change and setup tools slightly different sometimes

its better for now to have them controlled by the computer.

 

I also take the last R value and add by 2 + the diameter of tool to get the total value if i have forgot to put the comment

of the value inside the comment section for the operation, would be great to just look at the comment outputted of the value

right away and save some time...


Maybe this is a reseller thing but at least by asking here if someone will help saves me some months time i feel.

I have learned some good tips in the forum here, to tweak my post myself, still this is one of the things i need some extras help with.

I use an IHS MASTER GENERIC MILL G-CODE POST with 4 axis output on a vertical mill.

 

program would be something like this:

N101 G91 G28 Z0.
(MTSR 0021 H21 12UN  -|T28 -|H28 -|D21.)
N102 
N103
N104 (THREAD DIA: 33.66)

N105

N106

N107

Major thread diameter.nc

Major thread diameter.png

Link to comment
Share on other sites

Hi, i have that documentation, have read in it alot and have still need for help. I may have the right parameter but not for know the knowledge to implement it in the post and output.

Also have  i not found a tag for it in active reports as i asked if anyone knew if it is available.

This is not for just asking others of doing it, it is how to do it.

I ask the reseller, maybe quicker after all, This is not a issue of not wantimg to do it myself or not have the funding, it would just be nice to see if the forum helps out. I maybe get flamed for that comment, but is it not that what in the end its about, i have tried and failed in this, therefore asking kindly for help.

Link to comment
Share on other sites

There are several posts which deal with this sort of thing try a search and you will learn a lot, you should find several "worked examples". To extract the parameter use something like this:

In the

pparameter$

postblock

 

if prmcode$ = 10027, sefendz = rpar(sparameter$, 1)   #Capture top of stock for deep hole drill

This is one I did to "highjacked" the Top of Stock parameter value for a custom drill cycle. You will also need to format it depending on how you use it:

fmt "Z" 2 sefendz       #Slow Entry Feed End Z

In this case I am using it as a Z value to define a particular position within the drill cycle

You are now ready to use the variable in post statements, for example:

pbld, n$, *sg01, *sefendz, *feed, e$ #slow feed and speed entry into pilot hole

Dive in and do some searches. I am always amazed with what I come across and end up making copies of many other things for future reference.

P.S. I have relatives by marriage in Chritiansand, where are you?

Link to comment
Share on other sites
7 hours ago, nickbe10 said:

Dive in and do some searches. I am always amazed with what I come across and end up making copies of many other things for future reference.

P.S. I have relatives by marriage in Chritiansand, where are you?

Hi!

Thanks, i dig in more from your input, and I also found this thread 

 

that gives me what i looked for as a start to explore and see if i can get a deeper understanding.

Before mastercam i programmed manually okuma, siemens, heidenhain and fanuc and used macro and variables, this is a new learning curve trying to understand the mp language.

This example got the value from thread diameter calculated from the radius of I, times 2+ the diameter of tool, as i did manually, and the example gives me the comment for the tool twice when more tools than threadmill is selected. if only threadmill is selected it post just one tool comment line. anyway, just playing with a copy of the post in X9 for now, to see how different things changes the output.

 

I am located around 90 Kilometers south of Oslo, our capitol.

I know Kristiansand, it's around 240km more south of me, 3 hours drive from me, 4 hours from Oslo.

Kristiansand is a nice town, founded of King Christian https://en.wikipedia.org/wiki/Christian_IV_of_Denmark

which the town got the name from, nowadays its modern name is changed to Kristiansand.

we go there and visit the Zoo there sometimes and see the animals from different places of the world, mostly in summer, winter here is not always pleasant!

 

Link to comment
Share on other sites

Excellent....looks like you have all the components you need. Also search for "tool comments" and "operation comments" and you should be golden.

I find the MP language docs quite arcane, even as an English first language person. I can't imagine what it would like for me if it were written in Norwegian.....!!

Good luck!

Link to comment
Share on other sites

N882 M01
(MTSR 0021 H21 12UN  -|T28 -|H28 -|D21.)
N883 ( COMPENSATION TYPE -  COMPUTER )
N884 T28
N885 M06
N886 ( MAX -  Z15. )
N887 ( MIN -  Z-21. )
N888 ( THREAD DIAMETER =33.66 )
N889(Z STOCK TO LEAVE  = 0.)
N890(XY STOCK TO LEAVE = 0.)
N891 G00 G17 G90 G54 X-140. Y-65. S4000 M03
N892 G43 H28 Z15. M07 T18
N893 Z5.
N894 G94 G01 Z-17.5 F1200.
N895 Y-66.13 F400.
N896 G03 X-137.039 Y-68.169 Z-17.27 R3.169
N897 X-133.87 Y-65. Z-16.971 R3.169
N898 X-140. Y-58.87 Z-16.442 R6.13
N899 X-146.13 Y-65. Z-15.912 R6.13
N900 X-140. Y-71.13 Z-15.383 R6.13
N901 X-133.87 Y-65. Z-14.854 R6.13

Metric values

Block N888 gives me what i was after, thanks for helping me out!

I put the value inside a comment line and made a query of the operation for threadmilling , parameter was 12203 for Thread Diameter, 12194 is Thread pitch and i think i implement that also.

  • Like 1
Link to comment
Share on other sites
23 hours ago, Tim Johnson said:

My reseller gave me a post ref guide from V9 through X7 during the X7 rollout. I don't know if there is anything later. I haven't tried it yet but Code Expert may give you some help.

yes, i got this also from my reseller, he learned me to edit the post, and urged to ALWAYS take a backup before editing, and make a comment of the added data and name in the post so you can track the changes.

I mainly use Cimco Edit 8 for programs, but see that Code Expert has some of the info built in, so i maybe switch for that when editing the post.

Update:

In the download section at Mastercam for registered users  you can download the Mastercam X5 NCI Parameter Reference.pdf and in that file it list the tool ops. I can not find any later edition than X5 of it. It maybe has migrated into other sections in the documentation or it's just the latest edition.

If I then look in the NCI file in debugger for Definition 1016 and nr 3 output, it tells me the number of the operation which is the Internal toolpath opcode tol_op$ .

Then i know where to look next time, If the Active Reports Setup sheets could use those parameter info as tags in the setup sheets either directly or as a tag you self define or name it would really open up the workflow, have asked at Mastercam forum to see if they have an example or if it's even is possible to do it. I feel its more complicated editing post than an active report. the post is the heart, setup sheets just for info, rule nr 1 have to be not messing with the heart but use it wise for outputting good NC code and setup sheets for good info...

anyway, ALWAYS take backup! rule nr ZERO !...

G

Edited by geirsj
Info updated
Link to comment
Share on other sites

My solution to this was as follows:

 

 

in this section i added this:

# --------------------------------------------------------------------------
# Toolchange / NC output Variable Formats
# --------------------------------------------------------------------------

fmt    2 Threaddiameter    #Threadmill diameter value
fmt    2 Threadpitch           #Threadpitch value
fmt    4 Threaddirection    #Thread direction - bottom = 0 or top =1
fmt    4 Threadteeth          #Thread active theet

-----------------------------------------------------------------------------

in this section i added this:

pparameter$ # Run parameter table


           if prmcode$ = 12188, Threadteeth = rpar(sparameter$, 1)    # Capture THREAD ACTIVE THEET VALUE FOR THREADMILL OPERATION
           if prmcode$ = 12194, Threadpitch = rpar(sparameter$, 1)    # Capture THREAD PITCH VALUE FOR THREADMILL OPERATION
           if prmcode$ = 12203, Threaddiameter = rpar(sparameter$, 1) # Capture THREAD DIAMETER VALUE FOR THREADMILL OPERATION
           if prmcode$ = 12205, Threaddirection = rpar(sparameter$, 1)# Capture THREAD DIRECTION FOR THREADMILL OPERATION

---------------------------------------------------------------------------

in the section i added this:

-------------------------------

ptlchg_com      #Tool change common blocks  

  
 if tool_op$ = 100,
               [
                n$, pspc, scomm_str, "THREAD DIAMETER = ", *ThreadDiameter, scomm_end, e$     #Thread Diameter Value
                n$, pspc, scomm_str, "THREAD PITCH    = ", *Threadpitch, scomm_end, e$                 #Thread Pitch Value
                n$, pspc, scomm_str, "DIRECTION       = ", *Threaddirection, scomm_end, e$              #Thread Direction
                n$, pspc, scomm_str, "NUMBER THEET    = ", *Threadteeth, scomm_end, e$               #Thread Direction  
                               ]
             else,

---------------------------------------------------

 

this got me this nc code output for my program:

(MTSR 13 16UN  -|T15 -|H15 -|D13.2)
N102 ( COMPENSATION TYPE -  COMPUTER )
N103 T15
N104 M06
N105 ( MAX -  Z50. )
N106 ( MIN -  Z-14. )
N107 ( THREAD DIAMETER = 19.05 )
N108 ( THREAD PITCH    = 1.588 )
N109 ( DIRECTION       = 1 )
N110 ( NUMBER THEET    = 4 )
N111(Z STOCK TO LEAVE  = 0.)
N112(XY STOCK TO LEAVE = 0.)
N113 G00 G17 G90 G54 X-30. Y-18. S6000 M03
N114 G43 H15 Z50. M07
N115 Z5.
N116 G94 G01 Z-14. F1500.

------------------------

metric values!

------------------------

quite happy!

Thanks to nickbe10 for pointing me in the right direction and Tim Johnson for answering!

this opens up some other things i like to explore if its possible, I feel you can not get to much info or comments in your final nc code.

have a nice weekend!

  • Like 1
Link to comment
Share on other sites
20 hours ago, nickbe10 said:

Excellent....looks like you have all the components you need. Also search for "tool comments" and "operation comments" and you should be golden.

I find the MP language docs quite arcane, even as an English first language person. I can't imagine what it would like for me if it were written in Norwegian.....!!

Good luck!

I started out reading the siemens books in German, moved onto the "Jinglish" of Fanuc and on to Okuma, this MP is understandable, LOL

Joke aside, hope my english is understandable enough to get the right meaning for my issues anyway, however I can teach you this if you ever do scrabble:

Dog is BIKKJE in Norwegian, and not as far as i know in no other language, so if you could use that word you be safe!

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