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:

Custom Macro B Programming


Recommended Posts

 

I am attempting to program something similar to this. This is simply a sinewave I mapped to a sphere but what I would really like to try is to map two sinusoidal patterns around a sphere. This would result in something shaped essentially like a golf ball. I have taught myself some Trig and have been able to get this far but have hit a wall on the math required for the two overlapping patterns.The sinewave doesn't need to twist like the photo this was simply the only example I had handy. I am sorry for not providing a better explanation. The sinewave obviously cannot extend from pole to pole due to fixturing and tool clearance issues. I will provide more detail shortly on what variables might be required (angular window of the pattern, etc) but I wanted to at least clarify my request somewhat. I understand this is a MasterCAM forum but you guys seemed very knowledgeable about parametric programming and Macro B so figured I would pass this your way and see what you could come up with, if interested.

Link to comment
Share on other sites

Hi Guys

 

FANUC 18I-MB5 CONTROL

 

Not sure if I'm on the right thread here. I need some advice on origin shift after I probed my part with a Renishaw probe.

I'll try to explain what I would like to do. I have a flat composite part with stiffeners glued onto it. The stiffeners are T-shaped with the T-leg basically standing upright. Holes need to be drilled through the stiffeners from the top in the Z- direction. Before I can do that, I need to determine the correct position of each stiffener. The only way for me to do that is by using a Renishaw probe. If you look in the program below, I basically probed certain positions in the X- direction. That actual value gets saved on the control from variable #111 onwards. That is after the calculation was made with the stylus size etc.

All of that is working very well. Each position that I probe gets saved in the next variable number. i.e. #112, #113, #114, etc. (See blocks N28; N40; N52)

Here's an extract from my program to show how the probing works. I only copied the first 3 probing positions as an example:

 

N1 G92.1 X0 Y0 Z0 B0 C0

N2 G5P0

N3 G52 X0 Y0 Z0

N4 (*****************)

N5 G55

N6 ( 6 MM PROBE)

N7 G53 G90 G00 G49 Z0 H0

N8 T15 M6

N9 G55

N10 G0 B0. C0.

N11 H15

N12 G359

N13 M5

N14 G91 G43 H15 Z0

N16 G90

N16 G0 X-91.52 Y110.282 B0. C0.

N17 Z62.

N18 ( TP015 - PROBE STIFFENERS)

N19 ( PROBE CYCLE)

N20 M46

N21 G4 X2.

N22 G0 X-91.52 Y110.282 Z62. B0. C0. M81

N23 G31 G1 Z27. F300.

N24 G31 X-111.52

N25 G4 X0.5

N26 G91 X10.

N27 G90 G31 X-111.52 F60

N28 #111=#5061

N29 G0 X-91.52

N30 Z62.

N31 #100=#4111

N32 #101=#[#100+13000]+#[#100+12000] (PROBE RADIUS)

N33 #111=#111-#101-[-101.52]

N34 G0 Y254.4

N35 G31 G1 Z27. F300.

N36 G31 X-111.52

N37 G4 X0.5

N38 G91 X10.

N39 G90 G31 X-111.52 F60

N40 #112=#5061

N41 G0 X-91.52

N42 Z62.

N43 #100=#4111

N44 #101=#[#100+13000]+#[#100+12000] (PROBE RADIUS)

N45 #112=#112-#101-[-101.52]

N46 G0 Y553.4

N47 G31 G1 Z27. F300.

N48 G31 X-111.52

N49 G4 X0.5

N50 G91 X10.

N51 G90 G31 X-111.52 F60

N52 #113=#5061

N53 G0 X-91.52

N54 Z62.

N55 #100=#4111

N56 #101=#[#100+13000]+#[#100+12000] (PROBE RADIUS)

N57 #113=#113-#101-[-101.52]

 

The problem comes in where I would like to shift the drill positions now. (See extract below of where I want to call an offset variable each time)

I have an exact point where I would like to drill the first hole according to the part model. Because the stiffeners can be glued out of position slightly, I have to probe their actual position. Now I would like to shift that drill point with the deviation I determined with the probe. Hope this all makes sense. How do I do that? For instance, if the hole that I would like to drill first is closest to variable #111, I would like to offset my X- value with the value that was written in #111 and so forths. When ever I call a variable at a hole, that X- value for that specific hole must be shifted with the value in the variable. By the way, in my CAM software I can tell the probe whether I want to probe in the X- or Y- direction. In this case all the probe points were done in the X- direction.

If you look at the next program extract:

 

N167 ( 2.7 DIA TWIST DRILL)

N168 G49

N169 G53 G90 G00 G49 Z0 H0

N170 T14 M6

N171 G55

N172 G0 B0. C0.

N173 H14

N174 G359

N175 S8230 M3

N176 G05P10000R10

N177 G43.4 H14

N178 G0 X113.4 Y1439.808 B0. C0.

N179 Z62.

N180 G49

N181 G5P0

N182 G52 X[#117] Y0

N183 G43.4 H14

N184 ( TP001 - DRILL 2.7 PILOT HOLES)

N185 ( DRILL CYCLE)

N186 X113.4 Y1439.808 Z80.22

N187 X113.4

N188 M80

N189 ( DEEPHOLE DRILL)

N190 X113.4

N191 Z12.22

N192 G1 Z8.22 F494.

N193 G0 Z12.22

N194 Z9.72

N195 G1 Z4.22

N196 G0 Z12.22

N197 Z5.72

N198 G1 Z0.22

N199 G0 Z12.22

N200 Z1.72

N201 G1 Z-2.253

N202 G0 Z51.968

N203 ( DEEPHOLE DRILL)

N204 X92.6

N205 Z12.22

N206 G1 Z8.22

N207 G0 Z12.22

N208 Z9.72

N209 G1 Z4.22

N210 G0 Z12.22

N211 Z5.72

N212 G1 Z0.22

N213 G0 Z12.22

N214 Z1.72

N215 G1 Z-2.253

N216 G0 Z80.22

N217 G49

N218 G5P0

N219 G52 X[#116] Y0

N220 G43.4 H14

N221 ( TP001 - DRILL 2.7 PILOT HOLES STIFFENERS)

N222 ( DRILL CYCLE)

N223 X-92.6 Y1439.808 Z80.22

N224 X-92.6

N225 ( DEEPHOLE DRILL)

N226 X-92.6

N227 Z12.22

N228 G1 Z8.22

N229 G0 Z12.22

N230 Z9.72

N231 G1 Z4.22

N232 G0 Z12.22

N233 Z5.72

N234 G1 Z0.22

N235 G0 Z12.22

N236 Z1.72

N237 G1 Z-2.253

N238 G0 Z51.968

N239 ( DEEPHOLE DRILL)

N240 X-113.4

N241 Z12.22

N242 G1 Z8.22

N243 G0 Z12.22

N244 Z9.72

N245 G1 Z4.22

N246 G0 Z12.22

N247 Z5.72

N248 G1 Z0.22

N249 G0 Z12.22

N250 Z1.72

N251 G1 Z-2.253

N252 G0 Z80.22

N253 G49

N254 G5P0

 

Block N178 is where the first hole position is.

Block N182 calls for the X- offset. (Using the variable saved in #117)

The shift does actually happen there. The machine physically moves with the amount that was saved in #117. It ads the difference to X113.4 value that is at block N178.

The problem comes in where the machine hits the next X- value and the next and the next. I would like to drill a set of holes around variable #117 for instance. I want it to keep that offset for each X- value until I call a different variable. When it gets another X- value like block N186, it moves to that exact value. Completely ignoring the offset that it just used.

My whole explanation is about this. I want the control to use that #111 or #112 or #113, etc. for each X- value until I change the variable number or when it reaches a tool change which will clear all offsets.

Is there a way that one can program it in such a way?

I was thinking at one point to add the variable to each and every X- value myself, in order for the shift to take place. The control does not accept my format. I keep on getting an alarm that says "No value after address".

Here is what I was thinking of doing.

At each X- value, just add #111 or #112 to that value. Can it be done and how?

Can I not change block N186 like this?

 

X113.4+[#117] Y1439.808 Z80.22

or

[X113.4+#117] Y1439.808 Z80.22

or

X113.4+#[#117] Y1439.808 Z80.22

 

I don't have any clues left. This would have make logic sense to me. Just add the little bit of offset to your X- or Y- value and then drill the hole.

Hope someone can shed some light on this.

 

Thanks

Link to comment
Share on other sites

Mhoppe that is an interesting shape you are trying to cut there. I assume you are using some of the sine curve math? Been over 20 years since I had to figure out sine curves, but looks like fun. You have a issue here as you need to define the start intersection of the sphere relative to an Axis to then have it wrap around that sphere in a cordial process that then come to the end positions that is different than the start. Your math for the machine needs to be fixed to get the output you need, but you kind of need some defined parameters to start with. What is the diameter of the Sphere? What are the number of teeth or cuts you are looking to achieve? What is the start and end angle? How much sweep does it have cover? If I had a model I could throw a toolpath on it very quick, but you want to old school it like we did 20 years ago. Any reason why it cannot be modeled and a toolpath thrown on it?

Link to comment
Share on other sites

Cropsprayer you have easy problem to fix. You have what is called incremental stack going on. When you apply the shift you want that shift to come from a base position in this case your G55. You went in a probed all the features and came up with a shift for each one based off of where they should be in relation to G55. You stored all the values for each shift correctly and setup all fo your macro information correctly. BTW excellent job getting to this point. Thing if you need to go back to basis and I can imagine at this point your head is spinning. With each G52 call you are taking the adjusting the original G55 position. The machine when G55 is called will go back and apply that originally fixture offset since G52 is model and not permanent, but you are not doing that at this point. You keep adding to the original place and get creep or stack error to your position. Every time you move to your next vane right before the variable call in this case #116 you just need to call G55 and when you move to the correct G55 position for that vane you will then apply the correct shift only to that vane and so forth and so forth. Easy mistake to make since you are trying to accomplish so much. Just need to break it back down to basics here and remember not to keep applying it on top of the last one and going back to the base fixture offset every time. Once you do I think you will see all your problems are solved. I am not sure sure if you are doing a Zero dump at the end of your program or not, but if you have made this almost like a production program where you load the part, then probe and drill then remember to zero out all the variables you are updating every time. Not doing so can create all kind of havoc if someone hits restart in the middle of the program then decision has to be made. Do you have a way to restart the program without probing which would keep the stored values or would you just re probe it and rerun back to where you are. Should be okay doing it where you are assigning the variable to the position, but never hurts to have safe guards and contention plans in places for the what ifs.

 

HTH(Hope that Helps)

Link to comment
Share on other sites

Morning Crazy. That sphere is about 2mm in diameter. Most of the parts we make are fairly small. I notice you live up in Murrieta. I used to live off of Murrieta Hot Springs. Right now I am living down in Escondido. I work in a small shop (but part of a much larger organization) doing mostly R&D work. Most of our lathes are hand programmed. We have some mills and the guys there are using MasterCAM and Cimatron. They rib me all the time about my archaic ways. The machines I work with are primarily single-point diamond turning machines from Moore Nanotech and Precitech. Most are the 2/3 axis variety(X,Z some with C) with one being 5-axis (X, Y, Z, B, C). The reason for the hand coding is primarily due to how my group was formed back in the 90’s. When I hired on back in ’03 at the age of 23, I was the baby of the bunch. Nearly all of my colleagues were between the ages of 50-70. Most of them were Engineers, Physicists and Material Science majors, not machinists. Being the logical sort, programming by hand was just how they rolled. They just kind of rubbed off on me. They have all since retired and we are going through some changes, implementing CAM software being one of them. I am excited to add another tool to the bag so to speak, but I will still pursue the hand-coding because certain mathematical geometries are difficult for me to model.

That and it is simply plain old fun.

Attached is a program similar to the one I used to machine the twisting sinewave but written for a 2d profile rather than requiring the c-axis.


<code removed>

Also, I suppose I should mention that I am machining all of these on a lathe opposed to milling with a ball endmill.

Edited by Guest
Link to comment
Share on other sites

Hi Guys

 

FANUC 18I-MB5 CONTROL

 

Not sure if I'm on the right thread here. I need some advice on origin shift after I probed my part with a Renishaw probe.

I'll try to explain what I would like to do. I have a flat composite part with stiffeners glued onto it. The stiffeners are T-shaped with the T-leg basically standing upright. Holes need to be drilled through the stiffeners from the top in the Z- direction. Before I can do that, I need to determine the correct position of each stiffener. The only way for me to do that is by using a Renishaw probe. If you look in the program below, I basically probed certain positions in the X- direction. That actual value gets saved on the control from variable #111 onwards. That is after the calculation was made with the stylus size etc.

All of that is working very well. Each position that I probe gets saved in the next variable number. i.e. #112, #113, #114, etc. (See blocks N28; N40; N52)

Here's an extract from my program to show how the probing works. I only copied the first 3 probing positions as an example:

 

N1 G92.1 X0 Y0 Z0 B0 C0

N2 G5P0

N3 G52 X0 Y0 Z0

N4 (*****************)

N5 G55

N6 ( 6 MM PROBE)

N7 G53 G90 G00 G49 Z0 H0

N8 T15 M6

N9 G55

N10 G0 B0. C0.

N11 H15

N12 G359

N13 M5

N14 G91 G43 H15 Z0

N16 G90

N16 G0 X-91.52 Y110.282 B0. C0.

N17 Z62.

N18 ( TP015 - PROBE STIFFENERS)

N19 ( PROBE CYCLE)

N20 M46

N21 G4 X2.

N22 G0 X-91.52 Y110.282 Z62. B0. C0. M81

N23 G31 G1 Z27. F300.

N24 G31 X-111.52

N25 G4 X0.5

N26 G91 X10.

N27 G90 G31 X-111.52 F60

N28 #111=#5061

N29 G0 X-91.52

N30 Z62.

N31 #100=#4111

N32 #101=#[#100+13000]+#[#100+12000] (PROBE RADIUS)

N33 #111=#111-#101-[-101.52]

N34 G0 Y254.4

N35 G31 G1 Z27. F300.

N36 G31 X-111.52

N37 G4 X0.5

N38 G91 X10.

N39 G90 G31 X-111.52 F60

N40 #112=#5061

N41 G0 X-91.52

N42 Z62.

N43 #100=#4111

N44 #101=#[#100+13000]+#[#100+12000] (PROBE RADIUS)

N45 #112=#112-#101-[-101.52]

N46 G0 Y553.4

N47 G31 G1 Z27. F300.

N48 G31 X-111.52

N49 G4 X0.5

N50 G91 X10.

N51 G90 G31 X-111.52 F60

N52 #113=#5061

N53 G0 X-91.52

N54 Z62.

N55 #100=#4111

N56 #101=#[#100+13000]+#[#100+12000] (PROBE RADIUS)

N57 #113=#113-#101-[-101.52]

 

The problem comes in where I would like to shift the drill positions now. (See extract below of where I want to call an offset variable each time)

I have an exact point where I would like to drill the first hole according to the part model. Because the stiffeners can be glued out of position slightly, I have to probe their actual position. Now I would like to shift that drill point with the deviation I determined with the probe. Hope this all makes sense. How do I do that? For instance, if the hole that I would like to drill first is closest to variable #111, I would like to offset my X- value with the value that was written in #111 and so forths. When ever I call a variable at a hole, that X- value for that specific hole must be shifted with the value in the variable. By the way, in my CAM software I can tell the probe whether I want to probe in the X- or Y- direction. In this case all the probe points were done in the X- direction.

If you look at the next program extract:

 

N167 ( 2.7 DIA TWIST DRILL)

N168 G49

N169 G53 G90 G00 G49 Z0 H0

N170 T14 M6

N171 G55

N172 G0 B0. C0.

N173 H14

N174 G359

N175 S8230 M3

N176 G05P10000R10

N177 G43.4 H14

N178 G0 X113.4 Y1439.808 B0. C0.

N179 Z62.

N180 G49

N181 G5P0

N182 G52 X[#117] Y0

N183 G43.4 H14

N184 ( TP001 - DRILL 2.7 PILOT HOLES)

N185 ( DRILL CYCLE)

N186 X113.4 Y1439.808 Z80.22

N187 X113.4

N188 M80

N189 ( DEEPHOLE DRILL)

N190 X113.4

N191 Z12.22

N192 G1 Z8.22 F494.

N193 G0 Z12.22

N194 Z9.72

N195 G1 Z4.22

N196 G0 Z12.22

N197 Z5.72

N198 G1 Z0.22

N199 G0 Z12.22

N200 Z1.72

N201 G1 Z-2.253

N202 G0 Z51.968

N203 ( DEEPHOLE DRILL)

N204 X92.6

N205 Z12.22

N206 G1 Z8.22

N207 G0 Z12.22

N208 Z9.72

N209 G1 Z4.22

N210 G0 Z12.22

N211 Z5.72

N212 G1 Z0.22

N213 G0 Z12.22

N214 Z1.72

N215 G1 Z-2.253

N216 G0 Z80.22

N217 G49

N218 G5P0

N219 G52 X[#116] Y0

N220 G43.4 H14

N221 ( TP001 - DRILL 2.7 PILOT HOLES STIFFENERS)

N222 ( DRILL CYCLE)

N223 X-92.6 Y1439.808 Z80.22

N224 X-92.6

N225 ( DEEPHOLE DRILL)

N226 X-92.6

N227 Z12.22

N228 G1 Z8.22

N229 G0 Z12.22

N230 Z9.72

N231 G1 Z4.22

N232 G0 Z12.22

N233 Z5.72

N234 G1 Z0.22

N235 G0 Z12.22

N236 Z1.72

N237 G1 Z-2.253

N238 G0 Z51.968

N239 ( DEEPHOLE DRILL)

N240 X-113.4

N241 Z12.22

N242 G1 Z8.22

N243 G0 Z12.22

N244 Z9.72

N245 G1 Z4.22

N246 G0 Z12.22

N247 Z5.72

N248 G1 Z0.22

N249 G0 Z12.22

N250 Z1.72

N251 G1 Z-2.253

N252 G0 Z80.22

N253 G49

N254 G5P0

 

Block N178 is where the first hole position is.

Block N182 calls for the X- offset. (Using the variable saved in #117)

The shift does actually happen there. The machine physically moves with the amount that was saved in #117. It ads the difference to X113.4 value that is at block N178.

The problem comes in where the machine hits the next X- value and the next and the next. I would like to drill a set of holes around variable #117 for instance. I want it to keep that offset for each X- value until I call a different variable. When it gets another X- value like block N186, it moves to that exact value. Completely ignoring the offset that it just used.

My whole explanation is about this. I want the control to use that #111 or #112 or #113, etc. for each X- value until I change the variable number or when it reaches a tool change which will clear all offsets.

Is there a way that one can program it in such a way?

I was thinking at one point to add the variable to each and every X- value myself, in order for the shift to take place. The control does not accept my format. I keep on getting an alarm that says "No value after address".

Here is what I was thinking of doing.

At each X- value, just add #111 or #112 to that value. Can it be done and how?

Can I not change block N186 like this?

 

X113.4+[#117] Y1439.808 Z80.22

or

[X113.4+#117] Y1439.808 Z80.22

or

X113.4+#[#117] Y1439.808 Z80.22

 

I don't have any clues left. This would have make logic sense to me. Just add the little bit of offset to your X- or Y- value and then drill the hole.

Hope someone can shed some light on this.

 

Thanks

 

I believe your syntax is a little off and that is why you are getting the alarms. Please try it this way.

X[113.4+#117].

Link to comment
Share on other sites

Crazy, Mhoppe said somewhere in his post he wasn't doing it because he had to .. but just cause he wanted to figure out how to ..

 

I kind of dig the spirit.. I used to make all kinds of things with macros for just that reason.. I am pretty sure I learned more trig and complex math making macros than I did through all of the math classes in school..

 

I mean since its mapped to a sphere it seems like the sine radius has to be smaller at the 'poles' than at the equator so probably a function of spheres diameter, then I guess that same logic would have to be applied to the sine wave in the other direction. I would think the length of the waveform would need to be a function of the like circumference / num waveforms

 

Anyhow.. without going to crazy it would seem like it should be possible to make a macro that did the math with a limited number of inputs.. like diameter, number of teeth and amplitude at equator

 

Then I would guess the next issue would be determining whether or not the tool could actually reach those points.. or where to limit the toolpath too ... so perhaps another input for percentage of the diameter to cut from c/l so 50 percent could cut 25 percent to either side of centerline..

 

Either way.. maybe I am visualizing it wrong or something.... or perhaps just simplifying it more than you want too.. but couldn't you just cut one pattern, then swap directions and do the other pattern? Sure doing them both at once might be more interesting to watch but it would surely be easier to just cut one pattern and then the other..

 

 

(and hell .. now I realize what happens when you walk away for 2 hours from the time you start a post until you hit post.. lol)

Link to comment
Share on other sites

I have coded some crazy stuff long hand before, but that is some nice work. :unworthy: Yes amazing how much we can adopt to the environment around us to help us get the work done. I understand you are a formula guy and yes CAM can see a huge lead, but once you get how it will help you visualize the parts you are making then the benefit will show itself. I think the only different in your macro will be instead of the calculations updating Z for the transition you will be updating the C axis. Trick is the math will have to adjust the process differently. Remember in C axis rotations everything is broken down to degrees of travel where as the math you were doing was broken down in to liner calculations. Years ago I use to make roll dies all by hand without CAM and the biggest thing was mapping the travel of the C axis to the math the travel of my X axis. The center line of the C axis was along the X axis of travel. I had to think about the distance my A axis or in your case the C axis had to travel to match the X axis. In your formulas everything will need to go back to a process that takes degrees of rotation into account while also accounting for the travel of the axis. I think once you work out that difference the light will go off and you will get it solved.

 

Here is a break down of the formula that might help you get it working like you need for Macro B programming.

http://www.regentsprep.org/Regents/math/algtrig/ATT7/sinusoidal.htm

 

Very interesting math problem be neat to see how you get it worked out.

 

I am off of Date and head down south from time to time.

Link to comment
Share on other sites

Cropsprayer you have easy problem to fix. You have what is called incremental stack going on. When you apply the shift you want that shift to come from a base position in this case your G55. You went in a probed all the features and came up with a shift for each one based off of where they should be in relation to G55. You stored all the values for each shift correctly and setup all fo your macro information correctly. BTW excellent job getting to this point. Thing if you need to go back to basis and I can imagine at this point your head is spinning. With each G52 call you are taking the adjusting the original G55 position. The machine when G55 is called will go back and apply that originally fixture offset since G52 is model and not permanent, but you are not doing that at this point. You keep adding to the original place and get creep or stack error to your position. Every time you move to your next vane right before the variable call in this case #116 you just need to call G55 and when you move to the correct G55 position for that vane you will then apply the correct shift only to that vane and so forth and so forth. Easy mistake to make since you are trying to accomplish so much. Just need to break it back down to basics here and remember not to keep applying it on top of the last one and going back to the base fixture offset every time. Once you do I think you will see all your problems are solved. I am not sure sure if you are doing a Zero dump at the end of your program or not, but if you have made this almost like a production program where you load the part, then probe and drill then remember to zero out all the variables you are updating every time. Not doing so can create all kind of havoc if someone hits restart in the middle of the program then decision has to be made. Do you have a way to restart the program without probing which would keep the stored values or would you just re probe it and rerun back to where you are. Should be okay doing it where you are assigning the variable to the position, but never hurts to have safe guards and contention plans in places for the what ifs.

 

HTH(Hope that Helps)

Thanks Millman

I will try this out. Makes logic sense to me now. You're right, I do get the staggering of values. I basically keeps on offsetting each time.

 

Thanks again

Link to comment
Share on other sites
  • 4 months later...

I'm new to  parametric programming and want to learn more. I have 2 nh8000 mori's. that i'm setting up tombstones systems for to do small part large quantity work. I made I parametric program template already that allows the operator to run any part on any side with any number of part from 1 to 8 running to per side up to 4 part # at once. I'm getting ready to set up that same system but with manifold and need a good way to rotate the offset. running 4 parts per side 16 total. this way I can probe all parts 1 time and set all 3 open side for machine. anything helps thanks

Link to comment
Share on other sites
  • 4 weeks later...
  • 3 weeks later...
Somebody can help - create a calculation step to Z -circle mil
 
%
O8888(CIRCLE MILL)
#1=15 (# TOOL)
#2=1500 (S TOOL)
#3=500. (F FEED)
#4=20. (DIA. HOLE)
#5=0. (X)
#6=0. (Y)
#7=2. (RETRACT)
#8=0. (Z START)
#9=-10. (Z END)
#29=#8+#7
#30=[#4/2]*[-1] (-R HOLE)
#31=#4/2 (+R HOLE)
#32=#3/2 (PLUGE FEED)
G21
G0 G17 G40 G49 G80 G90
T#1 M6
G0 G90 G54 X#5 Y#6 S#2 M3
G43 H#1 Z#29
G1 Z#8 F#32
G41 D#1 Y#31 F#3
G3 Y#30 Z-.5 I0. J#30
Y#31 Z-1. I0. J#31
Y#30 Z-1.5 I0. J#30
Y#31 Z-2. I0. J#31
Y#30 Z-2.5 I0. J#30
Y#31 Z-3. I0. J#31
Y#30 Z-3.5 I0. J#30
Y#31 Z-4. I0. J#31
Y#30 Z-4.5 I0. J#30
Y#31 Z-5. I0. J#31
Y#30 Z-5.5 I0. J#30
Y#31 Z-6. I0. J#31
Y#30 Z-6.5 I0. J#30
Y#31 Z-7. I0. J#31
Y#30 Z-7.5 I0. J#30
Y#31 Z-8. I0. J#31
Y#30 Z-8.5 I0. J#30
Y#31 Z-9. I0. J#31
Y#30 Z-9.5 I0. J#30
Y#31 Z-10. I0. J#31
Y#30 I0. J#30
Y#31 I0. J#31
G1 G40 Y#6
G0 Z#29
M5
G91 G28 Z0.
G28 Y0.
M30
%

 

Link to comment
Share on other sites


O8888 (CIRCLE MILL

#1=15 (# TOOL)

#2=1500 (S TOOL)

#3=500. (F FEED)

#4=20. (DIA. HOLE)

#5=0. (X)

#6=25. (Y)

#7=2. (RETRACT)

#8=0. (Z START)

#9=-10. (Z END)

#11=0.5 (MAX Z INCREMENT)

 

#29=#8+#7

#30=[#4/2]*[-1] (-R HOLE)

#31=#4/2 (+R HOLE)

#32=#3/2 (PLUNGE FEED)

 

IF [#1EQ#0] THEN #3000=1 (NO TOOL SPECIFIED)

IF [#2EQ#0] THEN #3000=2 (NO RPM SET IN #2)

IF [#2GT2500] THEN #3000=3 (RPM TOO HIGH) (<----- THIS CAN BE ALTERED TO WHATEVER MAX RPM

IF [#3EQ#0] THEN #3000=4 (FEEDRATE MISSING)

IF [#4EQ#0] THEN #3000=5 (HOLE DIAMETER MISSING )

IF [#5EQ#0] THEN #3000=6 (X POSITION MISSING)

IF [#6EQ#0] THEN #3000=7 (Y POSITION MISSING)

IF [#7EQ#0] THEN #3000=8 (RETRACT POSITION MISSING)

IF [#8EQ#0] THEN #3000=9 (Z START MISSING)

IF [#9EQ#0] THEN #3000=10 (Z END MISSING)

IF [#11EQ#0] THEN #3000=11 (MAX Z DEPTH OF CUT MISSING

 

G21

G0 G17 G40 G49 G80 G90

T#1 M6

G0 G90 G54 X#5 Y#6 S#2 M3

G43 H#1 Z#29

G1 Z#8 F#32

G41 D#1 Y[#6+#31] F#3

(LOOP TO CALCULATE THE Z DEPTH PER PASS

#20=ABS[#9-#8]

#21=#20

#22=0

WHILE [#21GT#11] DO 1

#22=#22+2 (# OF DEPTH INCREMENTS

#21=#20/#22 (CALCULATED INCREMENT , Z DEPTH / # OF INCREMENTS

END 1

#23=0 (COUNTER

(MILLING LOOP

IF [#9GT0] THEN #21=#21*[-1] (IF THE Z END IS GREATER THAN THE Z START , MOVE IN THE POSITIVE DIRECTION

WHILE [#23LT#22] DO 1

#23=#23+1

G3 Y[#6+#30] Z[-#21*#23] I0. J#30

#23=#23+1

Y[#6+#31] Z[-#21*#23] I0. J#31

END 1

N10

Y[#6+#30] I0. J#30

Y[#6+#31] I0. J#31

G1 G40 Y#6

G0 Z#29

M5

G91 G28 Z0.

G28 Y0.

M30

%

 

 

I assume you are using this as a parametric program. A little more logic will be required to convert this into a macro. Also, I edited the Y-axis code slightly. It didn't appear to update the same as the X. If it was working as intended then ignore my edit.

Edited by Guest
Link to comment
Share on other sites
  • 3 months later...

can you help me with a macro to set a range for tool length so a shorter or longer tool canot be used

What control? What model?

 

Where/When do you want this check to happen? How do you want to do the check? Logic in your part program or G/M-Code with some variables?

Link to comment
Share on other sites

I run something like that  on my machines, but you have to have a assembly drawing establish the sets length that you are trying to maintain and the tolerance.  I hope this  helps. 

 

Example: Tool Length offset is 6.563 wear offset is -.025 The Set/Gage Length is 6.5

O1234

N13T9013(101235-.500 ENDMILL)
M6 
G543H6.5(CHECK GL)
M11
G0G90G56B225.M8
M10
G0G90G56X-.186Y2.782S1374M3T9060
G43H99Z2.
;
Part Program;
;
M5 
G0G91G30Z0.M9
G0G91G30X0.Y0. 
M30

 

 

%
O9010(FANUC GAGE LENTH MACRO)
(PROG. G543 H = TOOL GAGE LENGTH)
(SET PARAMITERS) 
(PAR 6050 TO 543)
IF[#11EQ0.]GOTO5000(NO H VALUE SET)
IF[#4006EQ21]GOTO21(INCH OR METRIC)
 
N20(INCH CHECK)
#100=.19685(TOL)
#101=[#11+#100]
#102=#[2200+#4120]+#[2000+#4120] 
 
IF[#[2200+#4120]+#[2000+#4120]GT[#11+#100]]GOTO5001
IF[#[2200+#4120]+#[2000+#4120]LT[#11-#100]]GOTO5001
GOTO22 
 
N21(METRIC CHECK)
#100=5.0(TOL) 
#101=[#11+#100]
#102=#[2200+#4120]+#[2000+#4120] 
 
IF[#[2200+#4120]+#[2000+#4120]GT[#11+#100]]GOTO5001
IF[#[2200+#4120]+#[2000+#4120]LT[#11-#100]]GOTO5001
 
N22(END CHECK) 
M99
 
N5000(ALARM) 
G0G91G28Z0.
#598=#598+1. 
#3000=10(NO H VALUE SET G543)
 
N5001(ALARM) 
G0G91G28Z0.
#599=#599+1. 
#3000=15(GAGE LENTH OUT OF SPEC.)
%
Link to comment
Share on other sites

can you help me with a macro to set a range for tool length so a shorter or longer tool canot be used

Yes this is what we use here at work: Where #2001 equals tool offset 1 and #2002 equals tools offset 2 and so forth using fanuc controls.

 

T01M06

IF[#2001LT1.]GOTO100

IF[#2001GT2.]GOTO200

Run Program

M30

N100

M00(TOOL TOO SHORT)

N200

M00(TOOL TOO LONG)

 

So if your tool is shorter than 1. inch it will give the message tool too short and if your tool is greater than 2 inches. it will give the message tool too long. It's a pretty simple way of letting the operator know there is something wrong. You can also use custom alarms depending on your control, but this is the bare minimum.

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