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:

Peter - Avivi CNC Solutions

Verified Members
  • Posts

    292
  • Joined

  • Last visited

Everything posted by Peter - Avivi CNC Solutions

  1. Your post has some error string in this area, you can add another. Luckily we have "sOpSeqNo" variable also + toolname.... So you can bulit your own error message: # -------------------------------------------------------------------------- # Error Checks # -------------------------------------------------------------------------- sOpSeqNo : "" #Operation manager displayed operation number stoollengthoffserror = "Look for CUT# " + sOpSeqNo + ": " + "(" + s20001 + ") WRONG TOOL LENGTH OFFSET#" sg53xyz = "Look for CUT# " + sOpSeqNo + ": " + "(" + s20001 + ") UNUSUAL G0 G53 XYZ VALUE IN HERE" stoollengthoffszeroerror = "Look for CUT# " + sOpSeqNo + ": " + "(" + s20001 + ") WRONG TOOL LENGTH OFFSET" stooldiameteroffserror = "Look for CUT# " + sOpSeqNo + ": " + "(" + s20001 + ") WRONG CUTTER COMP" stooldiameteroffszeroerror = "Look for CUT# " + sOpSeqNo + ": " + "(" + s20001 + ") WRONG CUTTER COMP#" scoolantisoffserror = "Look for CUT# " + sOpSeqNo + ": " + "(" + s20001 + ") NO COOLANT" sdrl_sel_tos$ = "Look for CUT# " + sOpSeqNo + ": " + "(" + s20001 + ") WRONG TOP OF STOCK" serrordetect = "Click OK to Q.C source program, click CANCEL to ignore" sMyFancyDepthError = "Look for CUT# " + sOpSeqNo + ": " + "(" + s20001 + ") WRONG TOP OF STOCK" And change these lines to: (add sMyFancyDepthError variable) if OpTopOfStock < operation_depth, [if mprint(sMyFancyDepthError, 2) = 2, exitpost$] Should work...
  2. PcMannnn, Do this for (2D) mill stuff: Remember? Now define another variable: OpTopOfStock : 0 # Operation Top of Stock Add another parameter read at pparameter$ postblock: if prmcode$ = 10027, OpTopOfStock = rpar(sparameter$, 1) # Operation Top of Stock In your post should be some similar I assume... (3 times) Change them, add an error handling line: # "( DOC =", *operation_depth, ")", e$ if OpTopOfStock < operation_depth, [if mprint("Something is verrryyyy-verrryyyy wrooonnngggg", 2) = 2, exitpost$] last_op_id = op_id$ #
  3. Lexuil, do some test, I'll really interested how it works and how exact? I'll wait some feedback, THX!
  4. I'm just do my hobby! But Köszönöm Szépen! http://translate.google.hu/#hu/en/K%C3%B6sz%C3%B6n%C3%B6m%20Sz%C3%A9pen
  5. Lemme' share my workaround. I stolen from .set and merged with a 3ax Mill post 'bout 3 years ago. I made some test than, and we used at many machine. As I remember all of them worked well. Including canned drill cycles...witttt dwell too... Not really easy, but works pretty well... Here ya go a HAAS sample: Variables: # --- Ciklus idő változói --- # *IMPORTANT* - # Note that the Program TOTAL TIME includes the Toolchange time(s), # so it will be longer than the Total RAPID time + Total FEED time! # Set the time it takes for machine to do a toolchange tlchgtime : 0.066 #Tool Change Time (* in Minutes *) I'ts 4 sec now ttltime : 0 #Total operation time tltime : 0 #Feed time trtime : 0 #Rapid time total : 0 #Total machine time tot_ltime : 0 #Total FEED time tot_rtime : 0 #Total RAPID time len : 0 #Length for calculation dx : 0 #Delta x dy : 0 #Delta y dz : 0 #Delta z drill_length_r : 0 # Drill length - RAPID drill_length_f : 0 # Drill length - FEED actual_drl_depth: 0 # Actual drill depth variable peck_safe_dist : 0.3 # Peck/Chip break safe distance for retratct into hole use_TC_pos : yes$ # Calculate with Home positions @ TC? 0=No, 1=Yes sav_X_Pos : 0 # Saved X position, use X_home/Y_home/Z_home in rapids at TC sav_Y_Pos : 0 # Saved Y position, use X_home/Y_home/Z_home in rapids at TC sav_Z_Pos : 0 # Saved Z position, use X_home/Y_home/Z_home in rapids at TC time_format : 2 # Time format of output times in NC code: # 1 = 2h 14:25 # 2 = 2hrs, 14mins, 25.08sec fs2 8 0^2 0^2n #Decimal, 2 place, omit decimal if whole number, non-modal fmt 2 llen #Feed cut length fmt 2 rlen #Rapid traverse cut length fmt 2 llen_total #Feed cut length (program total) fmt 2 rlen_total #Rapid traverse cut length (program total) fmt 2 total #Total part time fmt 2 ttltime #Total operation time fmt 4 thrs #Time in hours fmt 4 tmin #Time in minutes fmt 8 tsec #Time in seconds # --------------------------- Postblocks for time: # --- Cycle Time Postblocks --- psetup #Output of toolchange information !gcode$ llen = zero #Reset counter for next tool rlen = zero #Reset counter for next tool tltime = zero #Reset counter for next tool trtime = zero #Reset counter for next tool ttltime = zero #Reset counter for next tool if use_TC_pos, [ sav_X_Pos = x$, sav_Y_Pos = y$, sav_Z_Pos = z$ x$ = xh$, y$ = yh$, z$ = zh$ ptime_calc x$ = sav_X_Pos, y$ = sav_Y_Pos, z$ = sav_Z_Pos, ] ptooldata #Total ending data for tool (Path Length and Times) llen_total = llen_total + llen #Keep running total for Program rlen_total = rlen_total + rlen #Keep running total for Program tot_ltime = tot_ltime + tltime #Total FEED time tot_rtime = tot_rtime + trtime #Total RAPID time ttltime = tltime + trtime #Calc. current Tool Time total = ttltime + total + tlchgtime #Calc. total Program Time pthrminsec #Convert minutes to hr/min/sec format thrs = int(ttltime / 60) tmin = int(ttltime - thrs * 60) tsec = (ttltime - thrs * 60 - tmin) * 60 ptimeout #Output "times" pthrminsec #Convert minutes to hr/min/sec format if time_format = one, [ #Output 'HOURS' if thrs = one, *thrs, "hr, " if thrs > one, *thrs, "hrs, " #Output 'MINUTES' if tmin = one, *tmin, "min, " if tmin > one, *tmin, "min, " #Output 'SECONDS' if tsec > zero, *tsec, "sec" ] else, [ result = newfs(five, tsec) #Output 'HOURS' if thrs > zero, *thrs, "h " #Output 'MINUTES' and 'SECONDS' *tmin, ":", *tsec ] ptimer #Rapid time and length calc rlen = rlen + len #Running total RAPID length trtime = rlen / pst_rpd_fr$ #Running total RAPID time ptimel #Feed time and length calc llen = llen + len tltime = tltime + len / fr_pos$ ptime_calc #Distance calculations # Delta Distances dx = x$ - prv_x$ dy = y$ - prv_y$ dz = z$ - prv_z$ # Distance at linear movement if gcode$ = zero | gcode$ = one, len = sqrt(dx^2 + dy^2 + dz^2) # Distance at circular movement if gcode$ = two | gcode$ = three, len = (abs(sweep$)/360) * 2 * arcrad$ * pi$ # Distance at drilling if gcode$ = 81 | gcode$ = 100, [ if gcode$ = 100, ptime_drill_XY if drillcyc$ = 0, ptime_drill_0 # Simple Drill if drillcyc$ = 1, ptime_drill_1 # Peck Drill if drillcyc$ = 2, ptime_drill_2 # Chip Break Drill if drillcyc$ = 3, ptime_drill_3 # Tapping if drillcyc$ = 4, ptime_drill_4 # Bore, feed out, Reaming if drillcyc$ = 5, ptime_drill_0 # Bore, stop, rapid out, SAME movements as "Simple Drill" if drillcyc$ = 6, ptime_drill_0 # Bore, fine, SAME movements as "Simple Drill" if drillcyc$ = 7, ptime_drill_0 # Bore, standard, SAME movements as "Simple Drill" ] # Time calculations by feed type if gcode$ = zero, ptimer #RAPID time and length calc if gcode$ = one | gcode$ = two | gcode$ = three, ptimel #FEED time and length calc !x$, !y$, !z$, !fr_pos$ #Update previous [prv_?] variables ptime_drill_0 # Simple Drill lengths # Move length with FEED, straight down to hole depth len = abs(refht$ - depth$) ptimel # Move length with RAPID, IN & OUT of hole if initht$ <> refht$, [ # Rapid between Initial & Retract, Move TO hole len = abs(initht$ - refht$) # Rapid between Initial & Depth, Move OUT of hole len = len + abs(initht$ - depth$) ptimer ] else, [ # Rapid between Retract & Depth, ONLY Move OUT of hole len = abs(refht$ - depth$) ptimer ] # Convert and add dwell$ seconds to total minutes if dwell$ <> zero, total = total + (dwell$ / 60) ptime_drill_1 # Peck Drill # Move length with FEED, hole depth drill_length_f = abs(refht$ - depth$) actual_drl_depth = peck1$ while actual_drl_depth < drill_length_f, [ # FEED moves in hole len = peck1$ + peck_safe_dist ptimel # RAPID moves in hole len = (actual_drl_depth * 2) - peck_safe_dist ptimer actual_drl_depth = actual_drl_depth + peck1$ ] # Last cut, it's equal or less than peck1$ len = (drill_length_f - actual_drl_depth) + peck_safe_dist + peck1$ ptimel # Move length with RAPID, IN & OUT of hole if initht$ <> refht$, [ # Rapid between Initial & Retract, Move TO hole len = abs(initht$ - refht$) # Rapid between Initial & Depth, Move OUT of hole len = len + abs(initht$ - depth$) ptimer ] else, [ # Rapid between Retract & Depth, ONLY Move OUT of hole len = abs(refht$ - depth$) ptimer ] # Convert and add dwell$ seconds to total minutes if dwell$ <> zero, total = total + (dwell$ / 60) ptime_drill_2 # Chip Break Drill # Move length with FEED, hole depth drill_length_f = abs(refht$ - depth$) actual_drl_depth = peck1$ while actual_drl_depth < drill_length_f, [ # FEED moves in hole len = peck1$ + peck_safe_dist ptimel # RAPID moves in hole, only chip break moves - BACKWARD len = peck_safe_dist ptimer actual_drl_depth = actual_drl_depth + peck1$ ] # Last cut, it's equal or less than peck1$ len = (drill_length_f - actual_drl_depth) + peck_safe_dist + peck1$ ptimel # Move length with RAPID, IN & OUT of hole if initht$ <> refht$, [ # Rapid between Initial & Retract, Move TO hole len = abs(initht$ - refht$) # Rapid between Initial & Depth, Move OUT of hole len = len + abs(initht$ - depth$) ptimer ] else, [ # Rapid between Retract & Depth, ONLY Move OUT of hole len = abs(refht$ - depth$) ptimer ] # Convert and add dwell$ seconds to total minutes if dwell$ <> zero, total = total + (dwell$ / 60) ptime_drill_3 # Tapping # Moving length added directly to "feed length" drill_length_f = (abs(refht$ - depth$)) * 2 llen = llen + drill_length_f # Moving time added directly to "Total FEED time", minutes tot_ltime = tot_ltime + ((drill_length_f / (feed / speed)) / speed) # Move length with RAPID, IN & OUT of hole if initht$ <> refht$, [ # Rapid between Initial & Retract, Move TO hole & OFF from hole len = (abs(initht$ - refht$)) * 2 ptimer ] # Convert and add dwell$ seconds to total minutes if dwell$ <> zero, total = total + (dwell$ / 60) ptime_drill_4 # Bore, feed out, Reaming # Move length with FEED, hole depth len = (abs(refht$ - depth$)) * 2 ptimel # Move length with RAPID, IN & OUT of hole if initht$ <> refht$, [ # Rapid between Initial & Retract, Move TO hole & OFF from hole len = (abs(initht$ - refht$)) * 2 ptimer ] # Convert and add dwell$ seconds to total minutes if dwell$ <> zero, total = total + (dwell$ / 60) ptime_drill_XY # Moves between additional points sav_gcode = gcode$ gcode$ = zero ptime_calc gcode$ = sav_gcode # ----------------------------- Okay, now you have to change some basic postblock: See inserted "psetup" call and AUX file stuff psof$ #Start of file for non-zero tool number pcuttype toolchng = one # # "()", e$ # psetup # # Open temp AUX file & set output to 2 snameaux$ = snamenc$ + "_TEMP" newaux$ subout$ = 2 # OK, now we have to insert into some other basic postblocks: See "ptooldata" and "psetup" ptlchg$ #Tool change pcuttype toolchng = one # ptooldata #Total ending data for tool (Path Length and Times) # psetup # if mi1$ = one, #Work coordinate system OK, now we use "ptime_calc" postblock: In 3D moves: pncoutput #Movement output pcom_moveb comment$ pcan ptime_calc if cuttype = zero, ppos_cax_lin #Toolplane rotary positioning if gcode$ = zero, prapidout if gcode$ = one, plinout if gcode$ > one & gcode$ < four, pcirout if mr_rt_actv, #Restore absolute/incremental for G51/G68 [ absinc$ = sav_absinc mr_rt_actv = zero ] pcom_movea And in drilling too: pdrlcommonb #Canned Drill Cycle common call, before if sav_dgcode = 81, [ result = newfs (two, zinc) if drillcyc$ = three, drlgsel = fsg1(-ss$) + drillcyc$ * two else, drlgsel = fsg2(dwell$) + drillcyc$ * two if initht$ <> refht$, drillref = zero else, drillref = one prv_refht_a = c9k prv_refht_i = c9k prv_dwell$ = zero ] if cuttype = three, sav_dgcode = gcode$ else, z$ = depth$ if cuttype = one, prv_zia = initht$ + (rotdia$/two) else, prv_zia = initht$ pcom_moveb feed = fr_pos$ comment$ pcan #5 axis must map the true Z, correct Z calculation here if cuttype = three, [ prv_zia = zabs + (-depth$) + initht$ zia = fmtrnd(zabs) zinc = zia - prv_zia ] ptime_calc pcanceldc$ #Cancel canned drill cycle ptime_calc result = newfs (three, zinc) z$ = initht$ if cuttype = one, prv_zia = initht$ + (rotdia$/two) else, prv_zia = initht$ pxyzcout !zabs, !zinc prv_gcode$ = zero pcan pcan1, pbld, n$, "G80", strcantext, e$ pcan2 Annnnd at the end we do a tricky stuffy in peof: @ end we merge our time calc into our NC file and also merge the posted sub back as NC code. See commented and old "mergesub" and "mergeaux" stuff, use mine at very EndOfFile: peof$ #End of file for non-zero tool pretract comment$ #Remove pound character to output first tool with staged tools #if stagetool = one, 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 # "( *** Path Length/Time *** )", e$ "( Rapid Path Lengh = ", *rlen_total, "mm )", e$ "( Feed Path Length = ", *llen_total, "mm )", e$ ttltime = total #Transfer TOTAL program time "( Full Cycle Time = ", ptimeout, " )", e$ #Program Total time output ttltime = tot_rtime "( Full Rapid Time : ", ptimeout, " )", e$ ttltime = tot_ltime "( Full Feed Time : ", ptimeout, " )", e$ "()", e$ "()", e$ # spaces$ = sav_spc # mergeaux$ clearaux$ Sorry for the long post... Edit: ptimeout had a bug: else, [ result = newfs(five, tsec) #Output 'HOURS' if thrs > zero, *thrs, "h " # <<<---- WAS: thrs > one #Output 'MINUTES' and 'SECONDS' *tmin, ":", *tsec ]
  6. Ahh..... Well, MPMASTER use last_op_id variabe too.... Grrr Then change all "last_op_id" variable in MY samples only to "last_op_id_2"! So?
  7. Here it is: Define 2 variables: operation_depth : 0 # Operation full depth last_op_id : 0 # OP tracking ID Format output of DOC: fmt "Z" 2 operation_depth # Operation full depth At psof$ postblock put these 2 lines somewhere near to comment (comment$) ptoolcomment comment$ # "( DOC =", *operation_depth, ")", e$ last_op_id = op_id$ # pcan pbld, n$, *t$, sm06, e$ At ptlchg0$ postblock put these logic somewhere near to comment (comment$) Also "!op_id$" have to be there! c_mmlt$ #Multiple tool subprogram call comment$ # if op_id$ <> last_op_id, [ "( DOC =", *operation_depth, ")", e$ last_op_id = op_id$ ] # !op_id$ pcan pbld, n$, sgplane, e$ pspindchng Do the same at ptlchg$ postblock: c_mmlt$ #Multiple tool subprogram call ptoolcomment comment$ # "( DOC =", *operation_depth, ")", e$ last_op_id = op_id$ # !op_id$ pcan pbld, n$, *t$, sm06, e$ Add this parameter read at pparameter$ postblock: if prmcode$ = 10029, operation_depth = rpar(sparameter$, 1) #Capture the full depth of OP Well?
  8. No problem! I just saw in another topic and I found that some variables missing. Just like in my saved sample on my PC,so every time, when I want to use it, I have to find it out. But now I saved and reworked my sample pst file too... Glad to help!
  9. To All who use this sample abowe! PLS be sure that the following variables are defined too: fszamlalo : 0 # Counter sspace : " " sdelimiter : "|" #String for delimiter
  10. Djstedman, I just revised my sample and I think some variables not defined. (because they was defined probably in basic post) I'm sure that "fszamlalo" is missing. fszamlalo : 0 # Counter And may be a string definition is missing "sspace". It's in a lot of posts, but not all sspace : " " Also check this string: sdelimiter : "|" #String for delimiter Finally be aware that the linked sample use 5 buffer from 1 to 5, be sure that your post not uses these buffer for other stuff. You can shout too! Peter
  11. I can hear yaaaa!!! Bill, my sample now gives you like this: (**********************************) () ( T2 : D10. CENTER DRILL | H2 H22 ) ( T6 : D10. FLAT ENDMILL | H6 | D6=R D66=R0 ) ( T7 : D10. SPOT DRILL | H7 ) ( T12: D20. BULL ENDMILL 3. RAD | H12 | D12=R ) ( T20: D1. DRILL | H20 ) ( T32: D1. BULL ENDMILL 0.2 RAD | H32 | D32=R ) ( T54: D18. BALL ENDMILL | H54 ) () (**********************************) What infos you need in tool list? I can configure, just shout again! Now mine tracks if a tool use more length offset or diaoffset (marks control or wear too with R or R0)
  12. Moldplus can be handy: http://moldplus.com/videos/Radius_Analysis_x6/radius%20analysis.html
  13. Short answer: Yes Bill In the linked topic, I made that with more option in tool list. If you still need the ordering part, just shout!
  14. Hi Pat! I really liked your solution, you made a great job! I'm plannig some similar to do. But I have some questions here. Do you use a temporary file to store those values or those are written into directly into the MCX file? Or in the descrtiptor...? What methods you used in your C-Hook or NET-Hook? I planning to use an independent entity on a given level (C-Hook) and put some datas into. Just a plan yet. THX! Peter
  15. Thank you too Roger, so there is not much difference then. For me of course...
  16. Allright!!! Anyway, you guys made my day busy, because I just started to dig in C#...
  17. Well, I just tried the functions on my own way (thta's should be the probelmo) Import operation worked well and smooth. After that I made 4 lines and tried to "chain it" and pass into OP. OK Guys! I'm not a "time-mllionaire"!!! I've learned VB, then C++, now I plan go back to VB. So why C#? Basically I'm ready to learn it, but suddenly I don't know what's the difference. But you guys, now you can give me some reasons and tell me about benefits? Thanxx in advance!!!
  18. Roger, is it means that in the future better to use VB? I would not rewrite my old C-Hooks of course, but then I'll start programming in VB again. After 6 years, again... :S Gonna be hard Well, I just played with NetHook 3.0 API. My bottom line is always import an OP and then attach a GEO. Windows says: "Object reference not set to an instance of an object" Grrrr... My sample: Dim Vonal_1 As Geometry = New LineGeometry(New Point3D(-100.0, 100.0, 0.0), New Point3D(100.0, 100.0, 0.0)) Dim Vonal_2 As Geometry = New LineGeometry(New Point3D(100.0, 100.0, 0.0), New Point3D(100.0, -100.0, 0.0)) Dim Vonal_3 As Geometry = New LineGeometry(New Point3D(100.0, -100.0, 0.0), New Point3D(-100.0, -100.0, 0.0)) Dim Vonal_4 As Geometry = New LineGeometry(New Point3D(-100.0, -100.0, 0.0), New Point3D(-100.0, 100.0, 0.0)) Vonal_1.Commit() Vonal_2.Commit() Vonal_3.Commit() Vonal_4.Commit() Dim MyOp As Mastercam.Database.Operation MyOp = OperationsManager.ImportOperation("d:\MouldSolution X7\--- Files ---\Operations\NECKRING OPS FOR BILLET.MCX-7", "Bal Kilincs Lecsapas Fent") Dim Lanc(12) As Geometry Lanc(1) = Vonal_1 Lanc(2) = Vonal_2 Lanc(3) = Vonal_3 Lanc(4) = Vonal_4 Dim MyChain(10) As Chain MyChain = ChainManager.ChainGeometry(Lanc) ChainManager.ManageChains(MyOp, MyChain, Mastercam.Database.Types.ChainManagerMode.AddChains, ChainTypes.CurveChains) MyOp.Commit()
  19. 4th Axis brake is off? (M11/M12 I guess...)

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