CNCzone.com-The Largest Machinist Community on the net!



Home Page Mark Forums Read Today's Posts My Replies Classifieds Reviews Photo Gallery Web Links Share Files Advertise With Us Ad List
Go Back   CNCzone.com-The Largest Machinist Community on the net! > MetalWorking Machines > Haas Mills


Haas Mills Discuss Haas machinery here!


This forum is sponsored by:

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Ban this user!
Old 08-12-2008, 05:26 PM
 
Join Date: Jun 2006
Location: usa
Posts: 236
kendo is on a distinguished road
my 1st macro, ya think it'll work?

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
Reply With Quote

  #2   Ban this user!
Old 08-12-2008, 09:56 PM
 
Join Date: Jun 2006
Location: usa
Posts: 236
kendo is on a distinguished road

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)?
Reply With Quote

  #3   Ban this user!
Old 08-13-2008, 06:56 AM
 
Join Date: May 2007
Location: US
Posts: 779
Andre' B is on a distinguished road

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
Reply With Quote

  #4   Ban this user!
Old 08-13-2008, 09:24 AM
 
Join Date: Jun 2006
Location: usa
Posts: 236
kendo is on a distinguished road

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
%
I made a couple of the changes I thought it needed
Reply With Quote

  #5   Ban this user!
Old 08-13-2008, 11:12 AM
 
Join Date: May 2007
Location: US
Posts: 779
Andre' B is on a distinguished road

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.
Attached Thumbnails
Click image for larger version

Name:	Face Mill.jpg‎
Views:	97
Size:	45.1 KB
ID:	64812  
Reply With Quote

Sponsored Links
  #6   Ban this user!
Old 08-13-2008, 04:08 PM
 
Join Date: Jun 2006
Location: usa
Posts: 236
kendo is on a distinguished road

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
Reply With Quote

  #7   Ban this user!
Old 08-13-2008, 04:38 PM
 
Join Date: May 2007
Location: US
Posts: 779
Andre' B is on a distinguished road

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
%
Attached Thumbnails
Click image for larger version

Name:	Face Mill 2.jpg‎
Views:	82
Size:	59.1 KB
ID:	64825  
Reply With Quote

  #8   Ban this user!
Old 08-13-2008, 09:02 PM
 
Join Date: Jun 2006
Location: usa
Posts: 236
kendo is on a distinguished road

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 %
Thanks to you, I've got a good macro ready to go whenever my machine is ready.
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
Reply With Quote

  #9   Ban this user!
Old 08-13-2008, 10:59 PM
 
Join Date: Jul 2005
Location: Canada
Posts: 11,565
Geof will become famous soon enough

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.
Reply With Quote

  #10   Ban this user!
Old 08-14-2008, 01:08 PM
 
Join Date: Jun 2006
Location: usa
Posts: 236
kendo is on a distinguished road

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"
Reply With Quote

Sponsored Links
  #11   Ban this user!
Old 08-14-2008, 02:21 PM
 
Join Date: Apr 2006
Location: usa
Posts: 128
JWK42 is on a distinguished road
Unknown code

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
Reply With Quote

  #12   Ban this user!
Old 08-14-2008, 06:04 PM
 
Join Date: Jul 2005
Location: Canada
Posts: 11,565
Geof will become famous soon enough

Originally Posted by kendo View Post
Geof,

thanks,
I did what you said and now I can load and edit my macro...

....it stops and says "unknown code"
Just because I know how to activate macros doesn't mean I know how to write one.

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.
Reply With Quote

Reply




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


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




All times are GMT -5. The time now is 02:39 PM.





Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Content Relevant URLs by vBSEO
Template-Modifications by TMS

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