![]() | |
| Home Page | Mark Forums Read | Today's Posts | My Replies | Classifieds | Reviews | Photo Gallery | Web Links | Share Files | Advertise With Us | Ad List |
| |||||||
| Haas Mills Discuss Haas machinery here! |
| This forum is sponsored by: |
![]() |
| | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
| |||
| |||
I read thru the chapter on macros this weekend and tried to write one to do a simple facing operation Then I find out this morning that macros is locked out on the machine! So, while I'm waiting on the upgrade, I don't know if my code is good or not Any macro guys wanna take a look? ![]() The next thing I want to do is add a z depth increment and loop til complete, z retract at the end, and a finish pass |
|
#2
| |||
| |||
| I think I need to change the "LT" to a "EQ" in the second IF line to get my 10% adjustment right. I think it'll make it distinguish between whole and fractional numbers Also, I used a buncha parenthesis when writing it to keep my order of operations straight, but then realized they had to go. so, [#24/#7*#23] was: [#24/(#7*#23)] as it is now, I don't think it'll work should I define another variable to represent (#7*#23)? |
|
#3
| |||
| |||
| I have not read thru your code but I will tell you this. If instead of putting up a JPG image of your code you put the programs text in your message then people could cut and paste it into their simulator software and give you back a screen shot of how it runs. ![]() When editing your message just push the button and paste your code between the two code tags. In the real message the () will be [].(CODE) Program text (/CODE) The real one will look to the reader like this. Code: Program text |
|
#4
| |||
| |||
| here ya go, thanks I just wanted people to see my notes to the side on the line they correspond to Code: % O9010 (FACING MACRO) #101=#25+#7+.5 #102=#24/2-#7*1-#23 #103=#104 #104=ROUND[#24/#105] #105=#7*#23 IF#104 LT #24/#105 THEN #103=#103+1 IF#104 EQ #24/#105 THEN #23=#23*.9 G0 G91 X-#101/2 Y#102 G0 G90 Z#26 WHILE[#103 GT 0] DO1 G1 G91 X#101 F#9 G0 Y-#105 #101=-#101 #103=#103-1 END1 M99 % |
|
#5
| |||
| |||
| Had to swap the #104= and #105= lines or you get a divide by zero on the sim, on a real machine you would get whatever happened to be in #105 at the time. The first few lines are just to fake the sub call, it could have been a G65 line also. Looks like it will work. The rapids between feed passes will of coarse be a problem if the stock is a bit wider then expected. I sometimes like to put G2/3 loops between feed passes on a face mill for a smoother transition. But that is a habit from using a machine that had a weak design in the main frame and it could get to bouncing which was visible in the milled surface for the first few inches. I also try to avoid setting a value to global variables #1xx and #5xx from within a sub program unless it is to make the value available for use outside the sub, in the main program or a different sub. Sometimes you cannot avoid it but remember you on most controls you have local variables #1 thru #33 some of which contain values being passed into the sub but the rest can be used in your calculations. A back plotter program like NCPlot makes debugging programs like this a lot easier then doing it all on the machine. You will not get everything right because the back plotter will inevitably do some things differently then the machine but such is life. |
| Sponsored Links |
|
#6
| |||
| |||
| thanks Andre! awful nice of you to sim that for me, I'm kinda surpirsed my 1st macro wasn't a dud I can look at my code now and see why you had to switch those lines btw, if you get the time and the notion, change the Y value to 9.0 to see if my 10% adjustment will kick in. Thanks again, Kenny |
|
#7
| |||
| |||
| This should give you an idea of how it it running. The first bit in blue just draws the circles so you can see the sizes. The green is the first call to the sub and the brown the second call. Code: T1 G90 G0X0Y0 #33=10 WHILE[#33GE1.0]DO1 G0X#33 G3I-#33 #33=#33-1.0 END1 G0X0Y0 T2 G65P9010X10.000Y10.000Z-0.500D2.0W0.750F20.0 G90 G0X0Y0 T3 G65P9010X10.000Y9.000Z-0.500D2.0W0.750F20.0 M30 % O9010 (FACING MACRO) #101=#25+#7+.5 #102=#24/2-#7*1-#23 #103=#104 #105=#7*#23 #104=ROUND[#24/#105] IF#104 LT #24/#105 THEN #103=#103+1 IF#104 EQ #24/#105 THEN #23=#23*.9 G0 G91 X-#101/2 Y#102 G0 G90 Z#26 WHILE[#103 GT 0] DO1 G1 G91 X#101 F#9 G0 Y-#105 #101=-#101 #103=#103-1 END1 M99 % |
|
#8
| |||
| |||
| alright, I'm pretty sure I got it right now I had to switch some variables and add the brackets to the third line to get the order of operations right Code: % O9010 (FACING MACRO) #101=#24+#7+.5 #102=#25/2-[#7*[1-#23]] #103=#104 #105=#7*#23 #104=ROUND[#24/#105] IF#104 LT #24/#105 THEN #103=#103+1 IF#104 EQ #24/#105 THEN #23=#23*.9 G0 G91 X-#101/2 Y#102 G0 G90 Z#26 WHILE[#103 GT 0] DO1 G1 G91 X#101 F#9 G0 Y-#105 #101=-#101 #103=#103-1 END1 M99 % By then I'll probably have a few more too. Especially since you helped me get a basic understanding I couldn't get from just reading the book |
|
#9
| |||
| |||
| Go to your Parameter screen, type 57 and push down arrow; this will take you to Parameter 57 COMMON SWITCH. ENABLE MACRO should have 0T beside it; the T means you have a 200 hour trial period. If you do have the T you can turn on the Macro function. Go to SETTING 7 and turn it OFF. Push E-stop. Go back toe Parameter 57, put the cursor on ENABLE MACRO, type 1 and press WRITE. Now it should be turned on.
__________________ An open mind is a virtue...so long as all the common sense has not leaked out. |
|
#10
| |||
| |||
| Geof, thanks, I did what you said and now I can load and edit my macro, I had to change setting #23 in order to get started now the problem is, when the machine gets to this line: #104=ROUND[#24/#105] it stops and says "unknown code" |
| Sponsored Links |
|
#11
| |||
| |||
I think your unknow code is in the next lines down. I have not tested but I think this is right. "IF#104 LT #24/#105 THEN #103=#103+1 " change to IF[#104 LT [#24/#105]] #103 = #103+1 "IF#104 EQ #24/#105 THEN #23=#23*.9" change to IF[#104 EQ [#24/#105]] #23=#23*.9 Haas needs the comparison in Brackets and the "THEN" is assumed |
|
#12
| |||
| |||
![]() I suppose I could fumble through, but isn't that what employees are for?
__________________ An open mind is a virtue...so long as all the common sense has not leaked out. |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Need Help!- toolchanger macro doesn't work! | shaftalignment | Mach Wizards, Macros, & Addons | 3 | 01-04-2009 09:49 AM |
| Need Help!- toolchanger macro doesn't work! | shaftalignment | Mach Software (ArtSoft software) | 0 | 07-08-2008 12:43 AM |
| macro program for work offset | cncwhiz | Fanuc | 4 | 12-14-2007 06:28 AM |
| Convert Fanuc Macro to Fadal Macro | bfoster59 | Fadal | 1 | 11-08-2007 11:41 PM |
| Macro Work Coordinate | firedog | G-Code Programing | 7 | 06-17-2005 12:03 PM |