|
| |||||||
| Home | Recent Posts | HELP-FORUMS (ask/answer) | Classifieds-free | File Sharing / Documents | Photo Galleries | Polls | Newsletter | Machinetoolhelp.com. |
| Programming / Applications All CNC programming, CNC applications, milling, turning, tooling, macro programming, and other CNC machine tool related questions. |
![]() |
| | Bookmark or Share | Thread Tools | Search this Thread | Display Modes |
| |||
|
Hi, I made my first custom macro, but when I run it I get an error 004, I have quadro-checked all but I was not able to find any mistake on my part. Since its my first time, Maybe im doing something wrong? Error 004 - ADDRESS NOT FOUND A numeral or the sign “ – ” was input without an address at the beginning of a block. Modify the program . I call the macro with the following line: Code: N1 G65 P9011 A29.5 B-30 C12.5 D100 E0.11 F-1
Error is being shown when I get to this line:
G96 S#7 # Set Constant Surface speed
# Parametres
# ====================================================================
# Param.A(#1) Shows outer diameter of the final detail X29.5
# Param.B(#2) Lenght of the detail (How far to move the tool) Z-30
# Param.C(#3) Inner hole Outer diameter (cut until reach the hole) X12.5
# Param.D(#7) constant surface Speed m/mm S100
# Param.E(#8) Cutting speed F0.11
# Param.F(#9) After cutting it off cut X.millimeters deeper X..-1
# Explanation
# ====================================================================
# Macro is ment to cut off a detail with an inner hole
# It will also Remove sharp edge from the right side
# Uses Catcher, Constant surface speed limit is set to S1000
CSS limit can be altered in a subprogram 9011
# Program 9011
# ====================================================================
%
:9011
N1 G50 S1000 M3 # Set Spindle speed limit to 1000 rpm
T0101 # Swap tool
G97 # Cancel Constant Surface speed
G96 S#7 # Set Constant Surface speed
G0 X#1+1 Z#2-3 # Move fast, G0, to the detail cutting off position X(Detail Diam. + 1mm) Z(-Detail lenght)
G1 X#1 F0.3 M8 # Move slowly, G1, to the detail cutting off position X(Detail Diam.)
X#1-1.2 F#8 # Make a small cut X(Detail Diam.) -1.2 mm
X#1+0.2 F3 # Move back top, X(Detail Diam.) +0.2 mm
X#1 Z#2+0.6 F0.3 # move right Z(-Detail lenght) + 0.6
G3 X#1-1.2 Z#2 R0.6 F0.1# Radius 0.6 (Removing sharp edge hire)
#20=#3-0.2 # Make new var (store inner hole outer diam) -0.2mm value hire
X#20 F#8 # Cut until (inner hole outer diam) -0.2mm
M70 # open catcher
G97 S900 # Cancel Constant Surface speed & set spindle speed to 900 rpm
#21=#20-1 # make new var
X#21 F0.04 # cut off the detail
M74 # close the catcher
X#21-#9 F#8 # Cut a bit more down (clean up leftover rubbish just in case)
G0 Z#2+0.2 # this & next 3 lines move the tool away
G0 X150 M9
G0 Z150
M99
% |
| |||
|
I get an "ARC ERROR" on the "X#20 F#8" line ... modal G3 interpreted without I,J,K or R Actually, I get an error on the other two X commands after your G3 too ...still working on your G96 Last edited by MMMMM; 01-11-12 at 07:42 AM. |
| |||
|
ok ... I'm also getting a goofy arc move after you re-assign the #20 variable within the macro. I believe this nests it to a new level and doesn't calculate it properly. Try using an unused variable instead of recalculating the existing one (#20) as the value changes from 12.3 to -.2 within the sub (macro) .. #21 is recalculated too; from 11.3 to -1.2 |
| |||
| The image you posted is so small that I can not see anything on this image. Can you please repost it with readable size. ? also what software did you use to plot it? |
| |||
| This is interesting, looks like my account was deleted for some reason so I didnt receive your pm. I registered new acc with same name & hire i am now. In any case I solved the problem: X#2+1 Thats right, this was the cause of all problems. Turns out you can ether write it like this: X[#2+1] or #20=#2+1 X#20 After I rewrote the code using expression all worked fine. I also checkked the manual again & indeed, it does not say that you can not write code like I tried above. So yes this is something to keep in mind when writing a macro. |
| The Following User Says Thank You to Guren For This Useful Post: | ||
MMMMM (01-13-12) | ||
| |||
| Quote:
G0X#2+.1----incorrect G0X[#2+.1]----correct #20=#2+1----correct #20=[#2+1]----also correct Stevo (The opinions in this post are my own and not those of machinetoolhelp.com and its management) Last edited by Stevo; 01-13-12 at 01:27 PM. Reason: sntax error |
| |||
|
Do not hesitate in making fair use of brackets. Unnecessary brackets do not hurt. However, nesting of brackets is permitted up to a maximum of five levels, i.e., five left and five right nested brackets can be used. There is, however, no limitation on the total number of brackets in an expression; you can have nesting at several places in the same expression.
|
| |||
|
I wanted to post the full code earlier, but I found some issues with the description, so I made some modifications. I also made myself a printabe doc file, so if anyone wants it, then its attached. Its office 97 doc file. Also the table has 2 columns so u can just copy paste the code NB! This macro was written & tested under FANUC Series oi-TB. So use this code at your own responsibility, meaning you check it first, then run it as the graph in your machine, then set the zero point of the detail very far away from the potentional crashing area. Run the Program 1 step at the time without fluid. Always be ready to hit the BIG RED BUTTON! ![]() Last edited by Guren; 01-16-12 at 04:00 AM. |
| The Following User Says Thank You to Guren For This Useful Post: | ||
MMMMM (01-16-12) | ||
| |||
|
I can not find the edit button so im posting new reply. I was going through the documentation today & noticed an important screw-up. When I ran this macro in the machine, I saw this & fixed it, but lather I thought I also fixed it in the documentation. It appears not to be the case. If you run this in the graph mode you will see weird behavior, but I will point this out, just in case anyway. So if detail length is 10 millimeters & insert width is 3 mm, then we want to move our tool at the G0 speed, to the z-13. position & then start cutting it off. So we set parameter B to B-13 But the code will move the tool to B-16 instead, and if your Z-13 position is very close the the chunks it might crash into the chunks. This #2=#2-3 (line) should be removed from the macro. Its a part from the old macro. see the image. |
| |||
| Sorry for not answering this earlier, my machine broke & I was really busy repairing it. Rest assured, it was not because i was screwing around with those macros ^ ^! Some bolts inside of the spindle broke & inflicted load damage, I had to make a new tube & after I assembled all, it turned out the tube didnt fit into the machine, because the thread was too big, so the thread had to be modified, (Yes we have a pro who was able to pull this off, it was real magic he performed, since the tube was more like 0 shaped & not round) in the end the thread was remade 3 times before it fit in... & 1. spare part didnt fit ether, so it had to be modified also. A lot pain in the neck. ![]() Finished repairs today, all seems to be working To your questions: 1) The last 1 millimeter is being cut with extremely low feedrate F0.04, there is a good reason for it. Im using neutral inserts for cutting off: As result, burrs are formed (see the image below), removing those burrs are easy as long as the insert is not worn off. But, with the time, the insert will start wearing off, and the more it wears off the more difficult it is to remove those burrs. I had cases where I was doing 800 details per day & removing those burrs was real work out. I had to input 70% of all my strength to remove burrs on 1 single detail. Now multiply this by 800 times. I tested several feeds, F0.05 - F0.12, but with F0.04, those burrs were the easiest to remove. From my experience, I would say, it will fall off around (#3 -0.2 -0.7) So if the hole diameter is 20 mm, it will fall off in around 19.1 mm, but it may not, so just to be safe we cut until (20 -1.2 = 18.8) You can of course cut until (#21 =#3) & then with low feedrate until (#21 = #21 -1.2), but then you will be cutting additional 0.2mm with extreme low feedrate. Basically i wanted to minimize the distance being cut with the low feedrate to a minimum, yet keep it universal, so I can use it with any type of work/material/hole. 2) G0 Z[#2+0.2] I used to move the tool away like this; Cut it off then G0 X150 Z150 But then I had a case where the detail was not cut off. And the tool moved away & ripped the detail away from the material. It also damaged my tool once. Then I tried to move the tool away like this, straight top then right: G0 X150 Z150 But this was causing the tool to rub, so I figured Ill do it like this to avoid crashing & insert rubbing: G0 Z[#2+0.2] X150 Z150 So if the detail was not cut off, bad things, wont happen & it will simply rub the right side of the tool while moving away. Of course we need to consider a possibility where we are cutting off several details from 1 long workpiece, by moving the detail Zero point to the left (G55 G56 G57 etc...), if the detail isnt cut off hire, it will crash real bad. But for this case we have the Parameter H. Another reason for the parameter H, is that, I also Drill the holes & then cut off the details. I use different Drills (Drills with inserts & normal drills.) So, sometimes I need to cut deeper & H comes really handy in those cases. But then again you are right, this is why we have parameter H, guess ill just need to ensure that H is set deep enough. As a side note. I found a way to make details faster by just putting tool change on the same line as changing the spindle speed, but if used with CSS, tool movements, get dangerous & unpredictable, but those issues can be bypassed, so I will be re writting the beginning of the macro. And the last part you recommended also. But first I have a question. Before I move the tool to the cut off position I set the spindle speed to the speed it will have when I turn on the CSS. Im wondering if there is any point adding this spindle speed as a separate parameter or should i just set one never changing speed? I will make 2 samples: Sample 1 (mat diameter in this sample is 50, so we move tool to X52) Hire we turn on the CSS, after we have moved to pos X52, the spindle speed will be 612rpm (But I already pre calculated this so spindle speed is set to 612 before I start moving the tool) N1 G97 T0101 S612 M3 G50 S1200 G0 X52 Z-15 G96 S100 Sample 2 (but we want an universal macro, hire the detail diameter is 23) So we move the tool to X25. At point X25, the Spindle speed will not be 900, but should I care? what if I set spindle speed to S900 & will never change it.(so I wont have to add a new parameter & calc this speed every time) So at this point the spindle will increase speed to 1273, how much time do I loose like this? N1 G97 T0101 S900 M3 G50 S1200 G0 X32 Z-15 G96 S100 If this confuses you see the thumbnail of the new sample macro. I havent had time to test it in real time tho. Last edited by Guren; 02-06-12 at 08:42 AM. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | |
| |