Macro Programming Fundamentals - Page 37
Close
Login to Your Account
Page 37 of 38 FirstFirst ... 2735363738 LastLast
Results 721 to 740 of 748
  1. #721
    Join Date
    Sep 2010
    Location
    india
    Posts
    1,250
    Post Thanks / Like
    Likes (Given)
    72
    Likes (Received)
    225

    Default

    Quote Originally Posted by MazatrolMatrix View Post
    It's ASIN I'm talking about. I ran into a situation where I wanted to find an unknown angle and would have liked to use ASIN to do so.
    I do not know about your control, but on Fanuc, it is better to use ATAN for finding angles.
    ASIN does not give answer in second or third quadrant, and ACOS not in third or fourth quadrant, irrespective of parameter setting.
    Of course, if the expected answer is in the first quadrant only, anything can be used.

  2. #722
    Join Date
    Sep 2015
    Country
    SWEDEN
    Posts
    35
    Post Thanks / Like
    Likes (Given)
    15
    Likes (Received)
    7

    Default

    IF [#1EQ#2] #3=#10

    ALARM 854: ILLEGAL MACRO PROGRAMMING

    IF[#1 < #3] #5=#10

    ALARM 859: ODD NUMBER OF PARANTHESES/BRACKETS

    so then I tried

    IF[[#1 < #3] #5=#10]

    Still got alarm 859.

  3. #723
    Join Date
    Sep 2010
    Location
    india
    Posts
    1,250
    Post Thanks / Like
    Likes (Given)
    72
    Likes (Received)
    225

    Default

    I just glanced through the Mazatrol manual.
    Though I may have missed something, it seems that only GOTO is available with IF.
    And ASIN is not available.
    LT must be used in place of <

  4. #724
    Join Date
    Sep 2010
    Location
    Victoria Australia
    Posts
    3,685
    Post Thanks / Like
    Likes (Given)
    0
    Likes (Received)
    1449

    Default

    If ASIN really has to be used, the Mazatrol Matrix User Macro has the ATAN math operator. Accordingly, the following should work as an Inverse SIN Function:

    #i=ATAN[Number / SQRT[-Number * Number + 1]]

    Where:
    #1 = the ASIN result
    Number = the SIN value


    If you want to create an Inverse COS Function, the following should also work.

    #1 = ATAN[-Number / SQRT[-Number * Number + 1]] + #2 / 2

    #1 = the ACOS result
    #2 = Pi
    Number = the COS value

    Regards,

    Bill
    Last edited by angelw; 10-02-2019 at 10:19 AM.

  5. #725
    Join Date
    Sep 2015
    Country
    SWEDEN
    Posts
    35
    Post Thanks / Like
    Likes (Given)
    15
    Likes (Received)
    7

    Default

    That's what I was looking for, thank you very much.

  6. #726
    Join Date
    Sep 2010
    Location
    Victoria Australia
    Posts
    3,685
    Post Thanks / Like
    Likes (Given)
    0
    Likes (Received)
    1449

    Default

    Quote Originally Posted by MazatrolMatrix View Post
    That's what I was looking for, thank you very much.
    Hello MazatrolMatrix,
    To be entirely correct, 1 and -1 being passed as an argument have to be dealt with as shown in the Code Examples below.

    Rather than having to trot this code out every time you needed it and include it in your program, I would create a Function by registering the code under a unique program number for Inverse SIN and COS as follows. When you have to use either of these functions in your program, simply execute the Macro Call Block for the appropriate function. In each of the following Inverse SIN and COS Function, Common Variable #100 is used to return the result to your program.

    Both are Bare Bones examples with no Error Trapping.

    Regards,

    Bill

    Inverse SIN Function Example
    G65 P8000 A0.5 (CALL BLOCK PASSING THE SIN OF 30DEG IN THIS EXAMPLE)

    O8000
    (ASIN FUNCTION)
    (THE SIN OF THE ANGLE IS PASSED AS ARGUMENT A)
    #2 = 3.1415926535897932 (Pi)

    IF [#1 NE 1] GOTO10
    #100 = #2 / 2 (Pi/2)
    GOTO30

    N10 IF[#1 NE -1] GOTO20
    #100 = -#2 / 2 (-Pi/2)
    GOTO30

    N20 #100 = ATAN[#1 / SQRT[-#1 * #1 + 1]]

    N30 M99
    %

    Inverse COS Function Example
    G65 P8001 A0.86603 (CALL BLOCK PASSING THE COS OF 30DEG IN THIS EXAMPLE)

    O8001
    (ACOS FUNCTION)
    (THE COS OF THE ANGLE IS PASSED AS ARGUMENT A)

    #2 = 3.1415926535897932 (Pi)

    IF [#1 NE 1] GOTO10
    #100 = 0
    GOTO30

    N10 IF[#1 NE -1] GOTO20
    #100 = #2
    GOTO30

    N20 #100 = ATAN[-#1 / SQRT[-#1 * #1 + 1]] + #2 / 2

    N30 M99
    %

  7. Likes mbraddock liked this post
  8. #727
    Join Date
    Apr 2010
    Country
    UNITED STATES
    State/Province
    Wisconsin
    Posts
    6,056
    Post Thanks / Like
    Likes (Given)
    4178
    Likes (Received)
    3712

    Default

    I'm not sure if this is a Haas issue specifically, or a macro issue...

    Is it possible to use a variable's value for the text to be engraved while using Haas's G47 macro function**?

    In other words, when using the P0 (value), or even the P1 (value), can one reference a variable?
    In essence - P0(#505)

    All manner of mayhem broke loose when I tried so I'm sure that I'm doing something wrong, but want to make sure that it is even possible.

    Thank you.

    ** - G47 Text Engraving (Group 00)

    * E - Plunge feed rate (units/min)
    F - Engraving feedrate (units/min)
    * I - Angle of rotation (-360. to +360.); default is 0
    * J - Height of text in in/mm (minimum = 0.001 inch);
    default is 1.0 inch
    P - 0 for literal text engraving
    - 1 for sequential serial number engraving
    - 32-126 for ASCII characters
    * R - Return plane
    * X - X start of engraving
    * Y - Y start of engraving
    * Z - Depth of cut

    *indicates optional

  9. #728
    Join Date
    Sep 2012
    Location
    New Zealand
    Posts
    60
    Post Thanks / Like
    Likes (Given)
    1
    Likes (Received)
    12

    Default

    Quote Originally Posted by Zahnrad Kopf View Post
    I'm not sure if this is a Haas issue specifically, or a macro issue...

    Is it possible to use a variable's value for the text to be engraved while using Haas's G47 macro function**?

    In other words, when using the P0 (value), or even the P1 (value), can one reference a variable?
    In essence - P0(#505)

    All manner of mayhem broke loose when I tried so I'm sure that I'm doing something wrong, but want to make sure that it is even possible.

    Thank you.

    ** - G47 Text Engraving (Group 00)

    * E - Plunge feed rate (units/min)
    F - Engraving feedrate (units/min)
    * I - Angle of rotation (-360. to +360.); default is 0
    * J - Height of text in in/mm (minimum = 0.001 inch);
    default is 1.0 inch
    P - 0 for literal text engraving
    - 1 for sequential serial number engraving
    - 32-126 for ASCII characters
    * R - Return plane
    * X - X start of engraving
    * Y - Y start of engraving
    * Z - Depth of cut

    *indicates optional
    Would the format not be P#505 with no (comment)?

    Seems like you would only be able to do a single character per cycle.

    DP

  10. #729
    Join Date
    Oct 2019
    Country
    TURKEY
    Posts
    1
    Post Thanks / Like
    Likes (Given)
    0
    Likes (Received)
    0

  11. #730
    Join Date
    Oct 2007
    Country
    SPAIN
    Posts
    3,409
    Post Thanks / Like
    Likes (Given)
    1903
    Likes (Received)
    1242

    Default

    Quote Originally Posted by hamitunlu View Post
    Hey - nice bit of spam Monkey Boy!
    Or are you the one walking tall?
    Attached Thumbnails Attached Thumbnails capture.jpg  

  12. #731
    Join Date
    Oct 2019
    Country
    UNITED ARAB EMIRATES
    Posts
    1
    Post Thanks / Like
    Likes (Given)
    0
    Likes (Received)
    0

    Default

    Our working comprehensive goal is to provide benefits to our client’s business through developing. And growing the standard of their loyalty. Thus, to achieve a high level of loyalty, we do study work along with research on user personas that can reduce the risks of connection with a misunderstanding of their needs.Digitalopment

  13. #732
    Join Date
    Sep 2010
    Location
    Victoria Australia
    Posts
    3,685
    Post Thanks / Like
    Likes (Given)
    0
    Likes (Received)
    1449

    Default

    Quote Originally Posted by syedhuzaifa View Post
    Our working comprehensive goal is to provide benefits to our client’s business through developing. And growing the standard of their loyalty. Thus, to achieve a high level of loyalty, we do study work along with research on user personas that can reduce the risks of connection with a misunderstanding of their needs.Digitalopment
    I have a fascination in how the rearrangement of letters in a word, or phrase results in a word of different tense, or meaning. For example Eat and Ate, Eat being the present simple and Ate the past simple.

    With regards to the paragraph in the previous Post, by rearranging and deleting some letters, the resulting word is Spam. Amazing don't you think?

  14. #733
    Join Date
    Jan 2019
    Country
    SWEDEN
    Posts
    190
    Post Thanks / Like
    Likes (Given)
    56
    Likes (Received)
    22

    Default

    Quote Originally Posted by angelw View Post
    I have a fascination in how the rearrangement of letters in a word, or phrase results in a word of different tense, or meaning. For example Eat and Ate, Eat being the present simple and Ate the past simple.

    With regards to the paragraph in the previous Post, by rearranging and deleting some letters, the resulting word is Spam. Amazing don't you think?
    I have to admit I can see absolutely no point to this spam message?

  15. #734
    Join Date
    Jan 2019
    Country
    SWEDEN
    Posts
    190
    Post Thanks / Like
    Likes (Given)
    56
    Likes (Received)
    22

    Default

    I'm gifting this to the community. Maybe you can improve on it and we can get a discussion going. It's not original or very complex but it's good and working. Error handling isn't really tested. I made this today as a rewrite of an existing working one. Taking it into production tomorrow.

    This macro spirals a mill to widen a pre-drilled hole. It also compensates feed by radius. (Feed given is interpreted as peripheral feed.) Plus I added an option for high feed mills (easy one.)

    It's a fun one but maybe you'll ruin your machine with it who knows.

    C: Predrilled hole diameter
    D: Cutter diameter
    E: Target diameter
    Q: Ae or Ap
    V: Variant (0: Ae 1:Ap)

    Code:
    :5000
    (TEMPO 1 MATERIAL 2172 250X125X25)
    (ISCAR GROUP P1 KENNAMETAL GROUP P3)
    (ORIGO UPPER CENTER)
    ( T13=KENNAMETAL B051A13500CPG 13.5MM )
    ( T12=ISCAR EC-E5L 12-30C12CF83 12MM  )
    
    (KENNAMETAL 13.5MM VC80 F.3)
    G90G0G54G43X-105.Y-30.Z50.M7S1886H13T12
    G4X10
    M3
    G81G99R3.Z-30.F565
    X-42.5Y-20.
    Y-105.
    X42.
    Y-20.
    G98X105.Y-30.
    G55
    G99X-105.Y-30.
    X-42.5Y-20.
    Y-105.
    X42.
    Y-20.
    G98X105.Y-30.
    G0M9
    G91G28Z0M6
    M1
    
    (ISCAR EC-E5L 12MM)
    (RECOMMENDED VC360 F.096)
    (MACHINE LIMIT VC188.4)
    G90G0G54G43X-105.Y-30.Z50.S5000H12M3T9
    Z5.M14F2000
    G66P12C13.5D12.E27.5Q1.R0.Z-30.V1.F2000.
    X-105.Y-30.
    X105.Y-30.
    G67
    G66P12C13.5D12.E40.Q1.Z-13.R0.V0.F2000.
    X-42.5Y-20.
    Y-105.
    X42.
    Y-20.
    G67
    M15
    G91G28Z0M6
    M30
    
    :0012(FIL=P-SPIRALOUT)
    (FUNCTION 0 SPIRALS FROM R=(C-D/2) TO R=(E-D/2) Q MM PER ROTATION)
    (FUNCTION 1 SPIRALS FROM Z=R TO Z=Z Q MM PER ROTATION)
    (ARGUMENTS:)
    (C: PREDRILLED HOLE DIAMETER)
    (D: TOOL DIAMETER)
    (E: TARGET DIAMETER)
    (Q: WIDTH OR DEPTH OF CUT)
    (V: VARIANT. 0 IS SLICING AND 1 IS HIGH FEED LOW AP.)
    (SAVE CURRENT XYZ)
    G9
    #111=#5001
    #112=#5002
    #113=#5003
    (SAVE MODAL INFO)
    #119=#4109
    (ERROR HANDLING)
    IF[#07EQ#0]THEN#3000=1(MISSING [D] DIAMETER)
    IF[#08EQ#0]THEN#3000=2(MISSING [E] DIAMETER)
    IF[[#17EQ#0]AND[#22NE1]]THEN#3000=3(MISSING [Q] AE)
    IF[[#17EQ#0]AND[#22EQ1]]THEN#3000=4(MISSING [Q] AP)
    IF[[#26EQ#0]AND[#22EQ1]]THEN#3000=5(MISSING [Z])
    (DEFAULTS)
    IF[#09EQ#0]THEN#09=#4109(USE SYSTEM FEED IF NO FEED VARIABLE)
    IF[#03EQ#0]THEN#03=#07(MACRO DEFAULTS TO PREDRILLED HOLE OF CUTTER DIAMETER)
    IF[#26EQ#0]THEN#26=#113(IF NO TARGET DEPTH IS GIVEN MACRO DEFAULTS TO CURRENT Z TARGET)
    ()
    #101=[[#3-#7]/2] (START  RADIUS)
    #102=[[#8-#7]/2] (FINISH RADIUS)
    #103=10 (MACRO RESOLUTION)
    IF[#22EQ1]GOTO1
    (MODE 0: AREA SLICING. Q IS AE.)
    #105=0 (ANGLE COUNTER)
    #106=#101 (RADIUS COUNTER)
    #104=[#17/360*#103] (RADIUS INCREASE PER STEP)
    F#09(FEED COUNTER)
    G90G0Z#18
    G90G1Z#26(ENTER CUT)
    G3X[#111+#101]Z#26R[#101/2]
    WHILE[#106LT#102]DO1
    #105=0(ANGLE COUNTER)
    WHILE[#105LT360]DO2
    #106=#106+#104
    IF[#106GT#102]THEN#106=#102
    #109=#09*[#106/[#106+[#07/2]]]
    G3X[#111+[COS[#105]*#106]]Y[#112+[SIN[#105]*#106]]R#106F#109
    #105=#105+#103
    END2
    END1
    (FINISHING CUT)
    G3X[#111+#102]Y#112R#102
    G3I-#102
    G3X#111Y#112R[#102/2]F#09
    G0Z#113
    F#119
    M99
    N1 (MODE 1: DEPTH SLICING. Q IS AP.)
    #106=#18 (Z COUNTER)
    G90G0Z#18
    G3X[#111+#102]Y#112R[#102/2] (ENTER CUT)
    WHILE[#106GT#26]DO1
    #106=#106-#17
    IF[#106LT#26]THEN#106=#26
    G3I-#102Z#106
    END1
    (FINISHING CUT)
    G3I-#102Z#26
    G3X#111Y#112R[#102/2]
    G0Z#113
    M99
    so2.jpg

    so1.jpg

    so4.jpg

  16. #735
    Join Date
    Jul 2013
    Location
    Indiana
    Posts
    3,211
    Post Thanks / Like
    Likes (Given)
    4704
    Likes (Received)
    1622

    Default

    I've been drilling with this little drill program for a pretty long time and unless I'm starting to wig out I don't remember ever running into this till now. So the 27/64 drill did as expected, it kept counting till it reached the Z depth of 1.6 then came out of the hole went home then completely skipped the next drill, read the M30 and set there done.

    The fix was to in the 11/32 drill change to GOTO300 & N300 then it run as it was supposed to. I don't understand why this happened though. Isn't the control as its counting reading up looking for N200? I don't know how it got lost when it should be reading backwards at the GOTO looking for N's.

    It kinda reminds me of issues I've had with duplicate Q and P numbers in the same program when using canned cycles. Sometimes the control would get lost and be somewhere it's not supposed to be when searching for Q and P numbers if there were duplicates. In my mind if this problem was going to occur it seems it'd be on the second drill instead of first one? I know I've stacked these cycles on top of one another before and I don't ever remember running into this problem. Am I wigging out?

    Below is copy and paste of the entire program as it was originally.

    Brent

    %
    O5216(20-401 5215 2ND OP)
    (20-401 5215 REV 3 5/25/2018)
    (CORE PIN)
    (VISCOUNT V-44)
    (PART IN .920 DIA COLLET)
    (COLLET IS MARKED .8895)

    (G54 SET Z 5.015)

    N10(MSG, 27/64" .4219 DRILL)
    (COLBALT DRILL 89-403-A430)
    (DRILL TURNED DOWN TO .375)
    G0G99G40G54X14.Z10.T0
    T0404

    #1=.025(FEED SHORT OF)
    #2=.070(PECK EVERY)
    #3=.0(START DRILLING)
    #4=1.6(STOP DRILLING)
    #5=.2(RAPID BACK SHORT OF)
    #6=.005(FEED RATE)

    M41
    G97S175M3
    G0Z.3
    G0X0M8
    G0Z-[#3]
    #3=[#3+#2]
    N200
    G1Z-[#3]F[#6]
    G0Z.5
    G0Z-[#3-#5]
    G1Z-[#3-#1]F.2
    #3=[#3+#2]
    IF[#3LT#4]GOTO200
    G1Z-[#4]F[#6]
    G0Z.3
    M9
    G0X4.
    G0G99G40G54X14.Z10.T0
    M0

    N20(MSG, 11/32" .3438 DRILL)
    (MY HOMEMADE LONG DRILL)
    G0G99G40G54X14.Z10.T0
    T0606

    #1=.025(FEED SHORT OF)
    #2=.070(PECK EVERY)
    #3=1.3(START DRILLING)
    #4=4.64(STOP DRILLING)
    #5=.2(RAPID BACK SHORT OF)
    #6=.0040(FEED RATE)

    M41
    G97S195M3
    G0Z.3
    G0X0M8
    G0Z-[#3]
    #3=[#3+#2]
    N200
    G1Z-[#3]F[#6]
    G0Z.5
    G0Z-[#3-#5]
    G1Z-[#3-#1]F.2
    #3=[#3+#2]
    IF[#3LT#4]GOTO200
    G1Z-[#4]F[#6]
    G0Z.3
    M9
    G0X4.
    G0G99G40G54X14.Z10.T0
    M30
    %

  17. #736
    Join Date
    Jan 2019
    Country
    SWEDEN
    Posts
    190
    Post Thanks / Like
    Likes (Given)
    56
    Likes (Received)
    22

    Default

    Just at a glance you have two N200? Go-to searches forward. On my phone.

  18. Likes yardbird liked this post
  19. #737
    Join Date
    Sep 2010
    Location
    Victoria Australia
    Posts
    3,685
    Post Thanks / Like
    Likes (Given)
    0
    Likes (Received)
    1449

    Default

    Quote Originally Posted by yardbird View Post
    The fix was to in the 11/32 drill change to GOTO300 & N300 then it run as it was supposed to. I don't understand why this happened though. Isn't the control as its counting reading up looking for N200? I don't know how it got lost when it should be reading backwards at the GOTO looking for N's.
    Hello Brent,
    The control doesn't search backwards, only forwards. If the sequence number being searched for isn't encountered before the end of the program, the search will start again at the head of the program. Accordingly, if the sequence number is unique in the program and appear before the GOTO command, it seems as though the program has searched backwards, but it has not. In your example program, where there are two N200 sequence numbers, the search initiated by GOTO200 will find the N200 Block that is downstream of the GOTO200 Block first.

    Regards,

    Bill

  20. #738
    Join Date
    Jul 2013
    Location
    Indiana
    Posts
    3,211
    Post Thanks / Like
    Likes (Given)
    4704
    Likes (Received)
    1622

    Default

    Quote Originally Posted by angelw View Post
    Hello Brent,
    The control doesn't search backwards, only forwards. If the sequence number being searched for isn't encountered before the end of the program, the search will start again at the head of the program. Accordingly, if the sequence number is unique in the program and appear before the GOTO command, it seems as though the program has searched backwards, but it has not. In your example program, where there are two N200 sequence numbers, the search initiated by GOTO200 will find the N200 Block that is downstream of the GOTO200 Block first.

    Regards,

    Bill
    Hello Bill,

    Well there you go. Maybe I knew this at one time, seems odd to be looking forward when the information such as the P and Q is backwards as is the case with G70 finishing G71 G72 G73 canned cycles. Apparently I'm wigging out. Thank you

    Brent
    Last edited by yardbird; 11-12-2019 at 12:37 AM. Reason: Changed stuff

  21. #739
    Join Date
    Nov 2019
    Country
    TURKEY
    Posts
    5
    Post Thanks / Like
    Likes (Given)
    0
    Likes (Received)
    0

    Default

    cnc nasıl programdır ;
    Youtube üzerinde kurulumundan itibaren videoları
    YouTube

    Kurulum : YouTube
    Ve eğitim videoları : YouTube

  22. #740
    Join Date
    Sep 2010
    Location
    Victoria Australia
    Posts
    3,685
    Post Thanks / Like
    Likes (Given)
    0
    Likes (Received)
    1449

    Default

    Quote Originally Posted by expectium View Post
    cnc nasıl programdır ;
    Youtube üzerinde kurulumundan itibaren videoları
    YouTube

    Kurulum : YouTube
    Ve eğitim videoları : YouTube
    Herhangi bir dilde ve diğer tüm gönderilerinizde spam, hala spam - f off

    (Spam in any language and in all your other Posts, is still spam - f off)

  23. Likes Vancbiker, twr liked this post

Tags for this Thread

Bookmarks

Posting Permissions

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