View Single Post
  #1   Ban this user!
Old 03-28-2005, 03:54 AM
screensnot screensnot is offline
 
Join Date: Mar 2005
Location: USA
Posts: 32
screensnot is on a distinguished road
Macro/Parametric Programming

Hi all. I've been a Fadal user for quite a while. Over the years I have taught myself a few tricks using Fadal's Macro Language. Here is one example that I'd like to share. Anybody else have any unique macro examples?

---

I have a plate that is 2.5x2.5" and 1.00" thick. I need to cut a .75" radius on the front edge.



One option is to use a radius cutter.

Another, would be to repeat a subroutine that has a G19 G2/G3 move (arc on YZ) and a small stepover in X. This is actually my preferred method when I am looking for the best finish. On the downside, it is slow.

The method I am going to describe here is a pretty quick way to get the job done. The program creates a Z-level toolpath (tool moves down in Z, then cuts the part shape at that level, moves down again in Z, and repeats until the shape is cut). You can cut any radius, with virtually any size tool, and any tool corner radius.

I use macro programming to create a loop. Within that loop, the program calculates a toolpath for the first Z-level. The toolpath always returns the tool to it's initial position in X,Y. A new toolpath is calculated for the next Z-level, and the loop repeats until the radius is cut. This pic shows the first and last toolpath that gets created.



The first move of the toolpath is a G1 move to the Z level. Move 2 takes the tool into the part until the tool corner radius is tangent (touching) the part radius. Move 3 is the cut along the part edge. Move 4 is a short retract to get the tool off the stock. And Move 5 is a rapid move to the initial position in X,Y.

I sometimes will step the Z down in equal steps. Though I usually only do this for roughing, as it leaves heavy steps near the top of your radius (relative to the bottom anyway).

The way I'll do it here leaves a much more consistent finish on the radius. I select an angle to step around the arc, and use the sine function to calculate the step in Z. What I get are very small steps in Z at the top of the radius, and large steps at the bottom.



I have selected a favorite tool that I have a my disposal. It's 1.00" dia, with a .060 corner radius. Virtually any size tool will work within reason. If the radius is not roughed out at all yet, my tool is about minimum diameter to work well, IMO. The larger the corner radius, the better the finish. A tool with 0 corner radius can be used (i.e., square end mill), but with make for a rough finish.

This program requires that the diameter of the tool to be in the CDC table. It does not use G41/G42, but it does look into the table so that it can calculate the correct toolpath. You could use a value of 0 in the CDC, if you adjust one of the variables by the value of the tool's radius (more on this later).

Anyway, on to the program:

<I retyped this so be sure to prove it out first - I can't be held responsible for crashes>

%
N1 O8001(.75 RADIUS ON FRONT EDGE
N2 M6 T1 (1.00 INGERSOLL W/ .06R
N3 G70 G90 G0 S2500 M3 F60.
N4 G43 H1 Z3. X1.3 Y-1.85 (initial position for X,Y)
N5 Z.1 (.1 above the part)
N6 #V1=.75 'the radius to be cut on the part
N7 #V2=.06 'the corner radius on the tool
N8 #V3=0 'the start angle
N9 #V4=90 'the finish angle
N10 #V5=15 'the step angle
N11 #V7=-.5 'the distance from Y0 to the center of the radius
N12 #V8=-.75 ' the distance from Z0 to the center of the radius
N13 #V10=TN 'sets V10 to the current tool number
N14 #V11=D(V10)/2 'sets V11 to the radius of the current tool
N15 #V12=V1+V2 'the actual arc thats calculated
N16 #:LOOP
N17 #R1=V7-V11+V2-(SIN(V3)*V12) 'calculates the Y position
N18 #R3=V8-V2+(COS(V3)*V12) 'calculates the Z position
N19 G1 Z+R3 (moves to Z-level
N20 Y+R1 (feed in to radius
N21 X-1.3 (cut along edge
N22 G91 G0 Z.05 G90 (short retract [YES, G91/G90 can be on the same line]
N23 X1.3 Y-1.85 (return to initial position
N24 #IFV3GEV4THENGOTO:END 'if at the finish angle goto end
N25 #V3=V3+V5 'increase the step counter
N26 #IFV3GEV4THENV3=V4 'step counter should not be more than finish angle
N27 #GOTO:LOOP
N28 #:END
N29 G0 Z.1 M5 M9
N30 G49 Z0
N31 M2
%

Notice that my start angle was 0°, finish angle was 90°, and step was 15°. I picked these numbers for demonstration only. They match my pictures. And I think it made it easier to explain.

Really the cuts at 0 and 90° are wasted cuts. They wouldn't be removing any stock, just dusting the existing surfaces.

And the 15° step is huge. It would leave a very rough surface.

To actually machine this part with this tool, I'd try 3° start angle, 87° finish, and a 3° step angle.

Hope you find this approach as useful as I have. If you have any comments, shoot me a line at beckerdan69(at)hotmail(dot)com

Cheers,
Dan

Last edited by screensnot; 03-28-2005 at 03:58 PM.
Reply With Quote

 

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361