586,077 active members*
3,734 visitors online*
Register for free
Login
Results 1 to 9 of 9
  1. #1
    Join Date
    Jun 2006
    Posts
    247

    probing macros

    Im having a problem with variables that end up with a value like .50003
    when I expect it to have just .5

    Im probing a part
    telling it to travel .5" until skip signal
    but if the surface is too far away, The program needs to know this
    the best way I've come up with so far is: take the difference between the start point and the end point, if the difference is exactly .5", then the probe didnt touch anything
    but when this value ends up .50003, it ruins my process

    so when I command:
    G31 X-.5 F4.
    and the probe touches nothing, comes to a stop, and computes the difference
    why would it be anything but exactly .5" ??????

    do I need to round all my start end end points to 4 decimal places before the computation?
    If this is happening for some random reason, then whats to keep it from rounding up when it should round down one of these days?

  2. #2
    Join Date
    Jun 2006
    Posts
    247
    OK, the Macros chapter of the HAAS manual has this to say:



    Doesn't help me much, Im not too keen on exactly why storing from decimal to binary and back to decimal causes this to happen

    The example uses no decimal point
    But I use the decimal point when declaring all my variables
    It doesn't say wether using or not using the point has any affect though
    so I guess this means if you assign
    #100 = 7.123456

    it could later be read as
    7.123457

    right?

  3. #3
    Join Date
    Jun 2006
    Posts
    247
    not many of you messing with this kind of stuff I guess
    that or my rantings are just too elementary for you guys to bother

    heres another one:
    Is there some variable inside the control that reflects the status of the probe?when the probe comes to a stop, has the stylus made contact or not?
    Id think there would be a variable that switched from 0 to 1 just like the little light on the probe that goes from green to red when contact is made

    so far, like I said, the only way for me to know this is to compare the distance traveled to the distance commanded by the G31 line. This takes me 5lines of code to accomplish at my current level of expertise

    it looks like this:

    #113= #5041 (SAVE START POSITION)
    G31 X - #6 F#106 (ATTEMPT PROBE TOUCH)
    #114= ABS[ #113 - #5061 ] (FIND THE DIFFERENCE BETWEEN START AND END POINTS)
    #115= #114 - #6 (SUBTRACT COMPUTED DIFFERENCE FROM COMMANDED TRAVEL DISTANCE)
    IF [ ABS[ #115 ] GT 0.001 ] GOTO7 (ALARM IF VARIANCE BETWEEN COMMANDED DISTANCE AND ACTUAL DISTANCE IS GREATER THAN .001")
    #3000= 22 (START POINT NOT WITHIN PROBE REACH)
    N7

  4. #4
    Join Date
    Jan 2007
    Posts
    1389
    Keep it coming, I am reading just have no answers cause this macro probing stuff is pretty cool.

    I been doing cncs from the mid 80s and just now starting on macros, Once my haas gets here next week I will be playing alot because I have an extra spindle to do it on.

    I am sure once it shows up with the probe and I start using it I am going to have a million questions.

  5. #5
    Join Date
    Apr 2005
    Posts
    713
    Kendo, can you use the skip signal function? I have no info or knowledge about it, only that I know it exists. Maybe searching on that will get you further.

  6. #6
    Join Date
    Mar 2008
    Posts
    638
    Kendo, like Delw, I'm just reading and trying to learn.

    I don't use all the macro programming the probe and machine can use. I just use the already written macros to probe my part. Like the one below that probes the center of an rectangle with cut outs along the centerlines (so I have to move off center to probe).

    N25 (PROBE)
    T25 M06
    G00 G90 G59 X-1.44 Y0 M05
    G43 H25 Z3. T23

    G65 P9832 (TURN PROBE ON)
    G65 P9810 Z.25 F50. (PROTECTED MOVE)
    G65 P9023 A4. Y3.45 S59. Z-.5 (PROBE Y WEB)

    G65 P9832
    G65 P9810 X0 Y-1.425 F50.
    G65 P9023 A4. X3.5 S59. Z-.5 (PROBE X WEB)

    G65 P9832
    G65 P9810 X0 Y0 F50.
    G65 P9023 A9. S59. (PROBE Z LEVEL)

    G00 Z3.
    G53 Y0 Z0
    M01


    Not to your level but maybe someone else can build on it.
    You're going much deeper than that.
    But keep it coming. Just reading and learning.

  7. #7
    Join Date
    Jun 2006
    Posts
    247
    Matt, Im using the skip signal, just not as effectively as I'd like

    G31 X-.5 F#107
    will push .5" in negative X until the probe touches

    M78 G31 X-.5 F#107
    will do the same thing, but will throw up an alarm if the probe does touch
    its used for when you don't expect to touch anything unless somethings gone wrong

    M79 G31 X-.5 F#107
    will throw up an alarm if the probe doesn't touch, to let you know somethings wrong if it didn't

    the problem is, I need this check to occur without any alarms
    I just need the program to make a decision based on wether it touched or not
    Im getting this accomplished just fine with my 5 lines of code, it just seems too sloppy

    if you look at pit202's macro in the "reproducing an irregular shape" thread
    he's using variable #1029 which is a discrete input that his homemade probe puts out telling wether the stylus is deflected or not

    that would be very useful to me if the Hass/Renishaw combo had something like that but I dont think it does. At least I can't find anything like it when scanning through the renishaw macros that came with the probe. Everywhere theres a G31 line in those macros, theres a bunch of math going on before and after the move a lot like my code above, which compares the commanded distance to the actual distance traveled in order to find out if the probe touched or not.

  8. #8
    Join Date
    Jun 2006
    Posts
    247
    extanker,

    heres my center probing macro
    instead of starting at the center and then returning to the center after each touch, mine goes around the part from one side to the next and saves time.

    It will always probe the front of the part first, then right, back, and left
    It requires G154 P98 and P99 to be empty for use in the calculations, but that could be changed
    If you dont want to probe the part at the actual center, you can offset where it touches at by as much as 1" in either direction in the Y or X
    X offset is I-word
    Y offset is J-word
    you can increase the offset, but theres an alarm in my macro keeping me from doing it accidentally, just change the value the alarm checks for
    the only offsets you can update with this are G54 through G59

    you may wish to add some more protected moves in there,
    like for the rapid moves between sides,
    and the Z moves in the G43 lines
    at least untill you get confident with it, give yourself a big retract amount
    and make sure the probe is at a clearance height before calling the macro

    hope this helps you guys learn some more
    ask me anything, I like to help if I can

    Code:
    %
    O09009 (NEW CENTER PROBE) 
    (PROBES THE CENTER AND UPDATES SPECIFIED OFFSET) 
    (SAVES X AND Y MEASUREMENTS TO #600 AND #601) 
    
    (**MACRO CALL**)
    (G65 P9009 A2. X15.38 Y33.43 J-1. Z-0.15 S56 R4.)
    (A = 1 FOR BLOCK, 2 FOR POCKET)
    (X = OVERALL X WIDTH)
    (Y = OVERALL Y WIDTH)
    (I = DISTANCE TO OFFSET FROM CENTER IN X)
    (J = DISTANCE TO OFFSET FROM CENTER IN Y)
    (Z = PROBE DEPTH)
    (S = OFFSET TO BE UPDATED)
    (R = RETRACT DISTANCE)
    
    
    (INITIALISE VARIABLES)
    #19= ROUND[ #19 ] 
    #24= ABS[ #24 / 2 ] 
    #25= ABS[ #25 / 2 ] 
    IF [ #18 EQ #0 ] THEN #18= #5003 
    IF [ #19 EQ #0 ] THEN #19= 54 
    #18= ABS[ #18 ] 
    IF [ #4 EQ #0 ] THEN #4= 0 
    IF [ #5 EQ #0 ] THEN #5= 0 
    
    (ALARM CONDITIONS)
    IF [ [ ABS[ #4 ] LE 1 ] OR [ ABS[ #5 ] LE 1 ] ] GOTO5 
    #3000= 1 (I OR J MUST BE BETWEEN -1 AND 1) 
    N5 
    IF [ #18 GE 0.25 ] GOTO10 
    #3000= 2 (RETRACT MUST BE GREATER THAN .25) 
    N10 
    IF [ #25 NE #0 ] GOTO20 
    #3000= 3 (NO Y VALUE) 
    N20 
    IF [ #24 NE #0 ] GOTO30 
    #3000= 4 (NO X VALUE) 
    N30 
    IF [ #26 NE #0 ] GOTO40 
    #3000= 5 (NO PROBE DEPTH) 
    N40 
    IF [ [ #1 EQ 1 ] OR [ #1 EQ 2 ] ] GOTO50 
    #3000= 6 (INPUT "A1" FOR BLOCK "A2" FOR POCKET) 
    N50 
    IF [ #26 GT - 0.5 ] GOTO60 
    #3000= 7 (PROBE DEPTH SHALL NOT EXCEED Z-.5) 
    N60 
    
    (IDENTIFY AND ASSIGN WORK OFFSET BETWEEN G54 AND G59)
    IF [ #19 NE 54 ] GOTO100 
    #101= 5221 
    #102= 5222 
    #103= 5223 
    GOTO700 
    N100 
    IF [ #19 NE 55 ] GOTO200 
    #101= 5241 
    #102= 5242 
    #103= 5243 
    GOTO700 
    N200 
    IF [ #19 NE 56 ] GOTO300 
    #101= 5261 
    #102= 5262 
    #103= 5263 
    GOTO700 
    N300 
    IF [ #19 NE 57 ] GOTO400 
    #101= 5281 
    #102= 5282 
    #103= 5283 
    GOTO700 
    N400 
    IF [ #17 NE 58 ] GOTO500 
    #101= 5301 
    #102= 5302 
    #103= 5303 
    GOTO700 
    N500 
    IF [ #17 NE 59 ] GOTO600 
    #101= 5321 
    #102= 5322 
    #103= 5323 
    GOTO700 
    N600 
    #3000= 6 (USE OFFSETS G54 THROUGH G59) 
    N700 
    
    (CHECK BLOCK OR POCKET)
    IF [ #1 NE 1 ] GOTO710 
    #110= -0.5 
    #111= 0.5 
    GOTO810 
    N710 
    #110= 0.5 
    #111= -0.5 
    N810 
    
    (APPROACH GAP)
    #105= #24 + #4 
    #106= #25 - #5 
    #107= #24 - #4 
    #108= #25 + #5 
    
    (P99) 
    #15961= #[ #101 ] - #24 
    #15962= #[ #102 ] - #25 
    #15963= #[ #103 ] 
    
    (P98) 
    #15941= #[ #101 ] + #24 
    #15942= #[ #102 ] + #25 
    #15943= #[ #103 ] 
    
    (MAIN CODE)
    G00 G90 G154 P99 X#105 Y#110 
    G43 H18 Z [ #26 + 0.5 ] 
    M78 G31 Z#26 F60. 
    G65 P9811 Y0 S154.99 
    G00 Z#18 
    
    G90 G154 P98 X#111 Y - #106 
    G43 H18 Z [ #26 + 0.5 ] 
    M78 G31 Z#26 F60. 
    G65 P9811 X0 S154.98 
    G00 Z#18 
    
    G90 G154 P98 X - #107 Y#111 
    G43 H18 Z [ #26 + 0.5 ] 
    M78 G31 Z#26 F60. 
    G65 P9811 Y0 S154.98 
    G00 Z#18 
    
    G90 G154 P99 X#110 Y#108 
    G43 H18 Z [ #26 + 0.5 ] 
    M78 G31 Z#26 F60. 
    G65 P9811 X0 S154.99 
    G00 Z#18 
    
    (RESET CENTER FOR SPECIFIED WORK OFFSET)
    #[ #101 ]= [ [ #15961 - #15941 ] / 2 ] + #15941 
    #[ #102 ]= [ [ #15962 - #15942 ] / 2 ] + #15942 
    
    (SAVE X Y DIMENSIONS)
    #600= ABS[ #15961 - #15941 ] (X MEASUREMENT) 
    #601= ABS[ #15962 - #15942 ] (Y MEASUREMENT) 
    M99 
    %

  9. #9
    Join Date
    Mar 2008
    Posts
    638
    Very cool.
    I'll try it soon.
    Thanks

Similar Threads

  1. macros
    By georgebarr in forum Mach Mill
    Replies: 1
    Last Post: 06-03-2009, 02:11 PM
  2. X3 CNC macros
    By trainfred in forum Syil Products
    Replies: 6
    Last Post: 05-21-2008, 01:42 AM
  3. help with macros
    By gj83 in forum CNC (Mill / Lathe) Control Software (NC)
    Replies: 2
    Last Post: 04-12-2008, 02:42 AM
  4. macros
    By bob@apc in forum Mazak, Mitsubishi, Mazatrol
    Replies: 2
    Last Post: 02-04-2008, 06:42 PM
  5. Macros
    By cncfreak in forum Uncategorised CAM Discussion
    Replies: 24
    Last Post: 05-06-2005, 11:04 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •