-
Posts
292 -
Joined
-
Last visited
Content Type
Profiles
Forums
Downloads
Store
eMastercam Wiki
Blogs
Gallery
Events
Posts posted by Peter - Avivi CNC Solutions
-
-
Hi Peter, so where should I put this in the post file?
These 2 lines already in the postblock, the first 2 lines. Need to change also.
-
In your post buffer 8 is already defined.
So in my example change the buffer definition to "9"
This line:
fbuf 9 1 255 1 1
Then change every "8" realted variables to 9. Like rc8 to rc9, size8 to size9. Everything.
Changes in filestuff:
sbufname9$ = smcpath$ + smcname$ + sRevExtension if fexist(sbufname9$), # Check if .data file exist
And need to change read write routines to "9" also:
size9 = rbuf(9, 0) rc9 = 1 # Read first line from buffer, revision number s_b9_strings = rbuf(9, rc9) # Read first line from data file
And:
s_b9_strings = wbuf(9, wc9) # Write back the first line to data buffer file # Read additional lines if already exist in .data file, Customer, Programmer, Drawing No, etc... while rc9 <= size9, [ s_b9_strings = rbuf(9, rc9) s_b9_strings, e$ ]
Everything have to be 9.
-
I still guessing here, but may be you mistyped a parameter number or a number has changed in X7
-
I should capture these in pparameter$ postblock:
if prmcode$ = 19970, sGroupName = sparameter$ if prmcode$ = 19248, sMachineName= sparameter$
After this, you can output these strings everywhere you want. I assume in pheader$ postblock.
-
-
-
Cheers, Peter! Very nicely done, this method of external file manipulation can be adapted for many different scenarios. Maybe like automated sequential serialization engraving.... Or maybe heat lot numbers...
THX Ex-W!
...or during posting you can ask a string what you modified at actual revision and collect them into this file, even with timestamp and name!
...or...
-
THX guys!
Let me mention here Roger Martin and this forum here, they put me on the right (and loooong) way to develope them and many more...
-
MasterCam is breaking the circle into quadrants, not the best way to make a circular pocket.
What is the difference between quadrants and full circle?
I'm just curious and would like to hear another explanation.
-
I did update my options and this only worked once.
Change the Control DEF from Settings menu (file on drive, not in MCX) not form Machine Group.
And then reload into MCX
-
Well, If you don't mind that you have an additional but very small text file in the same directory, then here is my
solution what I put together in the afternoon. Just for fun and training.
This simple postblock read this tiny file, which holds rev number in the very first line.
If this file not exist (at first post run) it creates one with the same name of MCX but with different extension (.data in my sample)
Extension is doesn't really matter, it only needs to be a plain ASCII text file.
Now as I said, it's based on MCX name and same folder. Easy to change to NC name (or path too)
Additionally this postblock try read more line from this small line if there is.
What is it mean? It's mean that you can use this file as a job definition if you like. So if you write more line after
the first line (that's only rev number) like Programmer, Drawing number, Fixture, Comment, etc, this postblok
will output also. So you can hold the job details in this file, and then output into the header of NC code.
Sounds good?
This postblock also can override the revision number. You can switch on a question during posting, so you
have an option if you don't want to increase the revision number, then you can input yours and the post will
use that from that moment. Otherwise just hit ESC or ENTER to 0 and post will go ahead the actual REV number.
I built in this, because many times people just post a part of OPs or just wanna look something.
With the tools of MP language, many-many thing is possible, just need to imagine-define-think.
So I hope someday, someone will found this useful:
Variables, buffer-8
# -------------------------------------------------------------------------- # Revision number and header Buffer - 8 rc8 : 1 wc8 : 1 size8 : 0 fbuf 8 1 255 1 1 s_b8_strings : "" # String definiton for Buffer - 8 b8_RevNumber : 0 # Revision number RevNoReset : 0 # RevNo reset number after question CheckRevNum : yes$ # Ask RevNumber to change during posting? sRevExtension : ".data" # File extension of revision/header file fmt 4 b8_RevNumber # Format RevNumber fq 20 RevNoReset "Revision number will be //b8_RevNumber// is it OK?" # Question to ensure of RevNumber # --------------------------------------------------------------------------
Postblock:
# Following postblock based on a ".data" ASCII text file, in the same name and directory of MCX file # Data file read into Buffer - 8 pReadRevNumber # Read and set revision number of NC code sbufname8$ = smcpath$ + smcname$ + sRevExtension if fexist(sbufname8$), # Check if .data file exist [ size8 = rbuf(8, 0) rc8 = 1 # Read first line from buffer, revision number s_b8_strings = rbuf(8, rc8) # Read first line from data file b8_RevNumber = plcval(s_b8_strings, 3) * 100 # 1st digit in string b8_RevNumber = b8_RevNumber + (plcval(s_b8_strings, 2) * 10) # 2nd digit in string b8_RevNumber = b8_RevNumber + plcval(s_b8_strings, 1) # 3rd digit in string if CheckRevNum, q20 # Ask question of revise RevNumber if RevNoReset, b8_RevNumber = RevNoReset # Set RevNumber by question if not zero answer s_b8_strings = no2str(b8_RevNumber + 1) # Increment RevNumber if b8_RevNumber + 1 < 10, s_b8_strings = "0" + s_b8_strings # Set trailing zero of string based on RevNumber length if b8_RevNumber + 1 < 100, s_b8_strings = "0" + s_b8_strings # Set trailing zero of string based on RevNumber length s_b8_strings = wbuf(8, wc8) # Write back the first line to data buffer file # Read additional lines if already exist in .data file, Customer, Programmer, Drawing No, etc... while rc8 <= size8, [ s_b8_strings = rbuf(8, rc8) s_b8_strings, e$ ] ] else, # Create a simple .data file if not exist and set RevNumber value [ spathext$ = smcpath$ # Set path based on MCX path snameext$ = smcname$ # Set filename based on MCX name sextext$ = sRevExtension # Set .data extension subout$ = 3 # Create & output into external .data file extprg$ = 1 # Open our data file to write "002", e$ # Write RevNumber for next run in new data file subout$ = 0 # Set output back to main NC file b8_RevNumber = 1 # Set actual RevNumber @ fist run ]
Drop this into pheader$ or psof$
pReadRevNumber "( Revision Number: ", *b8_RevNumber, ")", e$
hundredbucksplease
How about my english? Get better?
- 1
-
Just guessin' here, but try this before your line:
z$ = z$ - mr9$ pbld, pn, *scclgcode, pfxout, pfzout, *stepcc, *grvspcc, *clearcc, *mr4$, feed, *mr5$, pe
Take care, it will affect every similar line like this. Will change every Z value until mr9$ becomes 0
-
Lemme share what a C-Hook can do. I made some, before few years ago:
Here is an example for turning C-Hook:
For milling C-Hook:
- 1
-
How do I disallow the "DRILLING" toolpath not to check the RETRACT plane because it does not have a RETRACT feature.
You can check the type of operation, in your ptlchg_errorpop postblock change the last line to this:
if not(OpRtrPlane_ON) & opcode$ <> 3, [if mprint(sOpRtrPlane_ON, 2) = 2, exitpost$]
-
Wow, Peter you really make my eyes bursting tears. You are so nice spend time for me.... Thank you...
No problem, glad to help! It's my hobby (and work will be) I have time in these days and I also learning with it.
But I just start to thinkin' to add a Donate button with PayPal in my signature....
Is there away I can identify the Cut# for the toolpath like previous I did like
Sure...
I'm sorry for being abused, I figured it out already. I will post the codes after I'm done. Thanks a million, Peter.
Yepp, so easy now!
-
OK, here is my idea to catch few things in OPs:
We need some variables:
OpClrPlane : 0 # Operation Clearance plane OpRtrPlane : 0 # Operation Retract plane OpFeedPlane : 0 # Operation Feed plane OpClrPlane_ON : no$ # Operation Clearance plane set or not OpRtrPlane_ON : no$ # Operation Retract plane set or not OpClrPlane_min : 10 # Operation Minimum Clearance value - SET MINIMUM HERE OpRtrPlane_min : 5 # Operation Minimum Retract value - SET MINIMUM HERE OpFeedPlane_min : 2 # Operation Minimum Feed value - SET MINIMUM HERE
Need to catch some values from OP parameters @ pparameter$ postblock:
if prmcode$ = 10020, OpClrPlane = rpar(sparameter$, 1) # Operation Clearance plane if prmcode$ = 15374, OpRtrPlane = rpar(sparameter$, 1) # Operation Retract plane if prmcode$ = 10024, OpFeedPlane = rpar(sparameter$, 1) # Operation Clearance plane if prmcode$ = 15100, OpClrPlane_ON = rpar(sparameter$, 1) # Operation Clearance plane set or not if prmcode$ = 15101, OpRtrPlane_ON = rpar(sparameter$, 1) # Operation Retract plane set or not
Create a individual postblock:
pCheckOpValues # Clearance plane if not(OpClrPlane_ON), if mprint("Clearance plane not set!!!", 2) = 2, exitpost$ else, if OpClrPlane < OpClrPlane_min, if mprint("Clearance plane LOW!!!", 2) = 2, exitpost$ # Retract plane if not(OpRtrPlane_ON), if mprint("Retract plane not set!!!", 2) = 2, exitpost$ else, if OpRtrPlane < OpRtrPlane_min, if mprint("Retract plane LOW!!!", 2) = 2, exitpost$ # Feed plane if OpFeedPlane < OpFeedPlane_min, if mprint("Feed plane LOW!!!", 2) = 2, exitpost$
Somewhere here insert the call of our pCheckOpValues postblock (3 times in your post I guess)
(the places where you check the OP depth)
# "( DOC =", *operation_depth, ")", e$ if OpTopOfStock < operation_depth, [if mprint("Something is verrryyyy-verrryyyy wrooonnngggg", 2) = 2, exitpost$] last_op_id = op_id$ pCheckOpValues #
-
I could not write this in the post, there was an error. Err
I bet you use mpmaster...
-
I changed like the way you suggested and here is what my outcome
Is it what we want?
-
I know there is a way to do it. Peter, would you please assist me where do I put "stoolplcomm " in the post so it can output multiple XZY? At the beginning of "psof$"???
Always there is a way...
In this section of your post:
preloadwcs #Output G10 preloads from Buffer2 #This postblock is called from the PSOF postblock and is designed to output the WCS #preloads to the beggining of the NC output file and only if the use_g10wcs flag is active. pg10sort #Sort preload buffer in accesnding order before output #read preload buffer and output preloads rc2 = 1 size2 = rbuf (two, 0) while rc2 <= size2, [ workofs2 = rbuf (two, rc2) pwcs2 = workofs2 + 54 if workofs2 > 53, pbld, n$, sgabsinc, "G10", "L2", *pofs2, [if swcsplcomm, *swcsplcomm, else, "X0", "Y0", "Z0", "B0"], [spaces$ = 0, "(",pwcs2,"", "", *cout2,")", spaces$ = sav_spc], e$ #Offsets G54 - G59 else, pbld, n$, sgabsinc, "G10", "L2", *pofs2, [if swcsplcomm, *swcsplcomm, else, "X0", "Y0", "Z0", "B0"], [spaces$ = 0, "(",pwcs2,"", "", *cout2,")", spaces$ = sav_spc], e$ #Extended offsets g54.1 P1 - P48 #if workofs2 > 53, pbld, n$, sgabsinc, "G10", "L2", *pofs2, *tox2, *toy2, *toz3, cout2, "(", *cout2,")", e$ #Offsets G54 - G59 ] # [ # workofs2 = rbuf (two, rc2) # if workofs2 > 53, pbld, n, sgabsinc, "G10", "L2", *pofs2, *tox2, *toy2, *toz3, *cout2, e #Offsets G54 - G59 # else, pbld, n, sgabsinc, "G10", "L20", *pofs2, *tox2, *toy2, *toz3, *cout2, e #Extended offsets g54.1 P1 - P48 # ]
Change swcsplcomm to stoolplcomm.
Do you really want to output some values from WCS comment? Just askin'
-
what do you mean Peter? How do I get the right parameter for the right function? Where you got that parameter number from, Peter?
How about parameter No.: 20013?
It's from post user manual U can ask your reseller about it.
This parameter holds the string of view comment.
At pre-read of NCI file, you can collect them into a buffer, and at processing of NCI code, you can
output to the beginnig of NC code. Kinda' long story short
Edit:
It's already captured in your post:
if prmcode$ = 20013, stoolplcomm = ucase(sparameter$)
And I guess it should appear at every Operation if ToolPlane rotate. Right?
-
I don't think there is a way to read the comments from the view manager.
How about parameter No.: 20013?
-
3hrs good for this part, including everything.
Just a note about ops, I sugget to use some of circmill op instead of Contour Ramp in OP#23.
Simple countour retracts with rapid feed at bore wall. Circmill or Helix bore won't...
Excellent job BTW!
-
Cycle Time list by OP or Tool
Some additional variable:
# --- Operation/Tool Time variables --- OpTime_F : 0 # Operation Feed Time OpTime_R : 0 # Operation Rapid Time OpLength_F : 0 # Operation Feed Length OpLength_R : 0 # Operation Rapid Length ToolTime_F : 0 # Tool Feed Time ToolTime_R : 0 # Tool Rapid Time ToolLength_F : 0 # Tool Feed Length ToolLength_R : 0 # Tool Rapid Length OpLastOp_id : 0 # OP tracking ID b10_MaxTool : 0 # Buffer 10 - Biggest tool no in B10 szerszam_out : 0 # Tool flag temp_counter : 0 # Counter sav_ToolName : "" # Save Tool name @ Buffer read fmt 2 ToolLength_F "mm" # Tool Feed Length fmt 2 ToolLength_R "mm" # Tool Rapid Length # String bufferek változói s_OpComment : "" # Operáció comment buffer stringje s_ToolName : "" # Szerszám név buffer stringje
Buffers to hold ToolName, OpName Toolpath time/length
# -------------------------------------------------------------------------- # OP Comment Buffer - 2 rc2 : 1 wc2 : 1 size2 : 0 fbuf 2 0 255 0 1 # -------------------------------------------------------------------------- # ToolName Buffer - 3 rc3 : 1 wc3 : 1 size3 : 0 fbuf 3 0 255 0 1 # -------------------------------------------------------------------------- # Operation Time Buffer - 10 b10_index : 1 # Buffer 10 - Index b10_ToolNo : 0 # Buffer 10 TlNo b10_ToolTime_F : 0 # Buffer 10 - Tool Time - FEED b10_ToolTime_R : 0 # Buffer 10 - Tool Time - RAPID b10_Length_F : 0 # Buffer 10 - Tool Path - FEED b10_Length_R : 0 # Buffer 10 - Tool Path - RAPID rc10 : 1 wc10 : 1 size10 : 0 fbuf 10 0 6 0 0 fmt "T" 4 b10_ToolNo # Buffer 10 # --------------------------------------------------------------------------
Need some changes in basic time postblocks:
ptimer #Rapid time and length calc rlen = rlen + len #Running total RAPID length trtime = rlen / pst_rpd_fr$ #Running total RAPID time OpTime_R = rlen / pst_rpd_fr$ # Added for Operation Time Counter OpLength_R = OpLength_R + len # Added for Operation Length Counter ptimel #Feed time and length calc llen = llen + len tltime = tltime + len / fr_pos$ OpTime_F = OpTime_F + len / fr_pos$ # Added for Operation Time Counter OpLength_F = OpLength_F + len # Added for Operation Length Counter
Postblock to write buffers:
pWriteBuffer_2 s_OpComment = wbuf(2, wc2) pWriteBuffer_3 s_ToolName = wbuf(3, wc3) pWriteBuffer_10 # Time Buffer b10_ToolNo = abs(prv_t$) b10_ToolTime_F = OpTime_F b10_ToolTime_R = OpTime_R b10_Length_F = OpLength_F b10_Length_R = OpLength_R b10_index = wbuf(10, wc10) b10_index = b10_index + 1 OpTime_F = 0 # Reset FEED Time counter @ Op end OpTime_R = 0 # Reset RAPID Time counter @ Op end OpLength_F = 0 # Reset FEED Length counter @ Op end OpLength_R = 0 # Reset RAPID Length counter @ Op end
Changes to call buffer write postblocks:
pheader$ #Call before start of file uj fejlec hozzaadva #q1, rd_tlpathgrp$ "%", e$ *progno$, sopen_prn, *sprogname$, *sextnc$, sclose_prn, e$ "()", e$ #comment$ "()", e$ sopen_prn, "Tool List:" , sclose_prn, e$ ... ... ... # MoP OpLastOp_id = op_id$ # ptlchg1002$ #Call at actual toolchange, end last path here ... ... ... !op_id$ # if op_id$ <> OpLastOp_id, [ pWriteBuffer_10 OpLastOp_id = op_id$ ] # peof$ #End of file for non-zero tool pretract pWriteBuffer_10 comment$ if stagetool = 1 & stagetltype = 2, pbld, n$, *first_tool$, e$ n$, "M30", e$ #mergesub$ #clearsub$ ... ... ... pwrtt$ #Pre-read NCI file if op_id$ <> prv_op_id$, [ pWriteBuffer_2 pWriteBuffer_3 ] !op_id$ pwrttparam$ #Pre-read parameter data #"pwrttparam", ~prmcode$, ~sparameter$, e$ if prmcode$ = 15239, s_OpComment = sparameter$ # Operáció comment if prmcode$ = 20001, s_ToolName = sparameter$ # Aktuláis szerszám neve
Postblocks to read buffers and create lists:
pReadBuffer_10_2 "( ************** Operation Time/Path *************** )", e$ size10 = rbuf(10, 0) rc2 = 1 rc10 = 1 while rc10 <= size10, [ s_OpComment = rbuf(2, rc2) b10_index = rbuf(10, rc10) ttltime = b10_ToolTime_R, "( ", *s_OpComment, " >>> Rapid: ", ptimeout ttltime = b10_ToolTime_F, " --- Feed: ", ptimeout, " )", e$ ToolLength_F = b10_Length_F ToolLength_R = b10_Length_R "( Rapid path: ", *ToolLength_R, " --- Feed path: ", *ToolLength_F, " )", e$ if (rc10 - 1) <> size10, "( -------------------- )", e$ ] "( ************************************************** )", e$ pReadBuffer_10_3 "( ************** Tool Time/Path *************** )", e$ size10 = rbuf(10, 0) rc3 = 1 rc10 = 1 b10_MaxTool = -1 szerszam_out = 0 temp_counter = 0 while rc10 <= size10, [ b10_index = rbuf(10, rc10) if b10_ToolNo > b10_MaxTool, b10_MaxTool = b10_ToolNo ] rc10 = 1 while temp_counter <= b10_MaxTool, [ while rc10 <= size10, [ b10_index = rbuf(10, rc10) s_ToolName = rbuf(3, rc3) if temp_counter = b10_ToolNo, [ ToolTime_F = ToolTime_F + b10_ToolTime_F ToolTime_R = ToolTime_R + b10_ToolTime_R ToolLength_F = ToolLength_F + b10_Length_F ToolLength_R = ToolLength_R + b10_Length_R szerszam_out = 1 sav_ToolName = s_ToolName ] ] if szerszam_out = 1, [ b10_ToolNo = temp_counter ttltime = ToolTime_R, "( ", *b10_ToolNo, " - ", *sav_ToolName, " >>> Rapid: ", ptimeout ttltime = ToolTime_F, " - Feed: ", ptimeout, " )", e$ "( Rapid path: ", *ToolLength_R, " --- Feed path: ", *ToolLength_F, " )", e$ if b10_ToolNo <> b10_MaxTool, "( -------------------- )", e$ ] temp_counter = temp_counter + 1 rc10 = 1 rc3 = 1 szerszam_out = 0 ToolTime_F = 0 ToolTime_R = 0 ToolLength_F = 0 ToolLength_R = 0 ] "( ********************************************* )", e$
Output list @ peof:
peof$ #End of file for non-zero tool pretract pWriteBuffer_10 comment$ if stagetool = 1 & stagetltype = 2, pbld, n$, *first_tool$, e$ n$, "M30", e$ #mergesub$ #clearsub$ #mergeaux$ #clearaux$ "%", e$ # subout$ = 0 ptooldata #Total ending data for tool (Path Length and Times) sav_spc = spaces$ spaces$ = 0 # pReadBuffer_10_2 pReadBuffer_10_3 "()", e$ # "( *** Megtett Ut/Ido adatok *** )", e$ "( Megtett Ut Gyorsjarattal = ", *rlen_total, "mm )", e$ "( Megtett Ut Elotolassal = ", *llen_total, "mm )", e$ ttltime = total #Transfer TOTAL program time "( Teljes Ciklusido = ", ptimeout, " )", e$ #Program Total time output ttltime = tot_rtime "( Teljes Ido Gyorsjaratban : ", ptimeout, " )", e$ ttltime = tot_ltime "( Teljes Ido Elotolasban : ", ptimeout, " )", e$ "()", e$ "()", e$ # spaces$ = sav_spc # mergeaux$ clearaux$
So? I hope I'm not miss anything...
- 1
- 1
-
program was 59 minutes
postprocessor showed 54 minutes
The differences are probably due to Acceleration and Deceleration of the machine...
And keep in mind this switch too:
use_TC_pos : yes$ # Calculate with Home positions @ TC? 0=No, 1=Yes
Home pos can be meters sometimes...
How do I add revision number?
in Post Processor Development Forum
Posted
Everything OK but this is duplicated, only 1 line needed