Manila Wolf Posted January 17, 2020 Author Posted January 17, 2020 Bigal, This is excellent. Right now I don't have time to study and understand all the lines of code. (End of the working day here). I will indeed find time to understand it. I did look at your "Multi button radios.lsp" I believe that if I want thickness "3" to be the default value I change the following: - (if (not but)(setq but 1)) Change to (if (not but)(setq but 5)) It looks like the code will remember the last selected thickness until you either select another thickness or exit the code. If it does this is indeed the desired action. Many thanks Bigal. Your help is greatly appreciated. Quote
BIGAL Posted January 17, 2020 Posted January 17, 2020 Your correct just hard code a start button, same with the I or M it has to be set to 1 as the get dcl has been used already. Same with Multi getvals you can declare variable default values and save for next run. Quote
Manila Wolf Posted January 20, 2020 Author Posted January 20, 2020 Hi Bigal, I made sure I understood your code and all is clear to me. I am very grateful indeed for your help and guidance. I have learned a great deal. Thank you very much. Even with my limited knowledge I was able to make very minor amendments to your code to satisfy my own personal preferences. Thanks again. Beers are on me if you ever visit Manila. Cheers. My finished code: - ;AMC-Fillets[AMCF].lsp ;By Alan H Jan 2020 info@alanh.com.au ;an AutoLISP routine that changes the fillet radius to accomodate the inside and outside radii of formed sheet metal pieces. ;https://www.cadtutor.net/forum/topic/69607-command-line-prompt-not-showing/?do=findComment&comment=560561 ;Multi radio buttons.lsp (Also by Alan H) needs to be in an AutoCAD support path or loaded in advance. ;Minor amendments by Mark D (defun C:AMCF ( / BUT DIST1 DIST2 DISTX IRD IRO ITEM ITEM2 LST OBJ PT1 PT2 PT3 PT4 PT5 PT6 SS SS2 TEMP) (if (not AH:Butts)(load "Multi Radio buttons.lsp")) (if (not but)(setq but 5)) (setq item (atof (ah:butts but "V" '("AMC Fillets: Choose sheet thickness " " 1" " 1.5" " 2" " 2.5" " 3" " 4" " 5" " 6" )))) (if (not item2) (setq item2 (ah:butts 1 "V" '("Choose Units: - Millimetres or Inches " "Millimetres" "Inches" ))) ) (cond ((and (= 1 ITEM)(= item2 "Inches"))(setq IRD 0.019685039370079 IRO 0.059055118110236));15 decimal places ((and (= 1.5 ITEM)(= item2 "Inches"))(setq IRD 0.047244094488189 IRO 0.106299212598425));15 decimal places ((and (= 2 ITEM)(= item2 "Inches"))(setq IRD 0.078740157480315 IRO 0.157480314960630));15 decimal places ((and (= 2.5 ITEM)(= item2 "Inches"))(setq IRD 0.078740157480315 IRO 0.177165354330709));15 decimal places ((and (= 3 ITEM)(= item2 "Inches"))(setq IRD 0.078740157480315 IRO 0.196850393700787));15 decimal places ((and (= 4 ITEM)(= item2 "Inches"))(setq IRD 0.098425196850393 IRO 0.255905511811023));15 decimal places ((and (= 5 ITEM)(= item2 "Inches"))(setq IRD 0.157480314960630 IRO 0.354330708661417));15 decimal places ((and (= 6 ITEM)(= item2 "Inches"))(setq IRD 0.236220472440945 IRO 0.472440944881890));15 decimal places ((and (= 1 ITEM)(= item2 "Millimetres"))(setq IRD 0.5 IRO 1.5)) ((and (= 1.5 ITEM)(= item2 "Millimetres"))(setq IRD 1.2 IRO 2.7)) ((and (= 2 ITEM)(= item2 "Millimetres"))(setq IRD 2.0 IRO 4.0)) ((and (= 2.5 ITEM)(= item2 "Millimetres"))(setq IRD 2.0 IRO 4.5)) ((and (= 3 ITEM)(= item2 "Millimetres"))(setq IRD 2.0 IRO 5.0)) ((and (= 4 ITEM)(= item2 "Millimetres"))(setq IRD 2.5 IRO 6.5)) ((and (= 5 ITEM)(= item2 "Millimetres"))(setq IRD 4.0 IRO 9.0)) ((and (= 6 ITEM)(= item2 "Millimetres"))(setq IRD 6.0 IRO 12.0)) ) ;_ end of cond (while (setq pt1 (getpoint " Using a 3 Point FENCE selection - Pick outside, ")) (setq pt2 (getpoint pt1 " Pick inside, ")) (setq pt3 (getpoint pt2 " Pick outside, ")) (setq lst (list pt1 pt2)) (setq ss (ssget "F" lst (list (cons 0 "*line")))) (setq lst (list pt2 pt3)) (setq ss2 (ssget "F" lst (list (cons 0 "*line")))) (setq obj (vlax-ename->vla-object (ssname ss 0))) (setq pt3 (vlax-curve-getclosestpointto obj pt2)) (setq dist1 (distance pt2 pt3)) (setq obj (vlax-ename->vla-object (ssname ss 1))) (setq pt4 (vlax-curve-getclosestpointto obj pt2)) (setq dist2 (distance pt2 pt4)) (setq distx (abs (- dist1 dist2))) (if (> dist1 dist2) (progn (setq temp pt3) (setq pt3 pt4) (setq pt4 temp) ) ) (setq obj (vlax-ename->vla-object (ssname ss2 0))) (setq pt5 (vlax-curve-getclosestpointto obj pt2)) (setq dist1 (distance pt2 pt5)) (setq obj (vlax-ename->vla-object (ssname ss2 1))) (setq pt6 (vlax-curve-getclosestpointto obj pt2)) (setq dist2 (distance pt2 pt6)) (if (> dist1 dist2) (progn (setq temp pt5) (setq pt5 pt6) (setq pt6 temp) ) ) (setvar 'filletrad IRD) (command "fillet" pt3 pt5) (setvar 'filletrad IRO) (command "fillet" pt4 pt6) ) ; while (princ) ) ;_ end of defun Quote
Manila Wolf Posted January 20, 2020 Author Posted January 20, 2020 Just playing around a little more. It looks as if I can convert metric to imperial within the code by doing this: - Replace the following (cond ((and (= 1 ITEM)(= item2 "Inches"))(setq IRD 0.019685039370079 IRO 0.059055118110236));15 decimal places ((and (= 1.5 ITEM)(= item2 "Inches"))(setq IRD 0.047244094488189 IRO 0.106299212598425));15 decimal places ((and (= 2 ITEM)(= item2 "Inches"))(setq IRD 0.078740157480315 IRO 0.157480314960630));15 decimal places ((and (= 2.5 ITEM)(= item2 "Inches"))(setq IRD 0.078740157480315 IRO 0.177165354330709));15 decimal places ((and (= 3 ITEM)(= item2 "Inches"))(setq IRD 0.078740157480315 IRO 0.196850393700787));15 decimal places ((and (= 4 ITEM)(= item2 "Inches"))(setq IRD 0.098425196850393 IRO 0.255905511811023));15 decimal places ((and (= 5 ITEM)(= item2 "Inches"))(setq IRD 0.157480314960630 IRO 0.354330708661417));15 decimal places ((and (= 6 ITEM)(= item2 "Inches"))(setq IRD 0.236220472440945 IRO 0.472440944881890));15 decimal places With this: - (cond ((and (= 1 ITEM)(= item2 "Inches"))(setq IRD (/ 0.5 25.4) IRO (/ 1.5 25.4))) ((and (= 1.5 ITEM)(= item2 "Inches"))(setq IRD (/ 1.2 25.4) IRO (/ 2.7 25.4))) ((and (= 2 ITEM)(= item2 "Inches"))(setq IRD (/ 2 25.4) IRO (/ 4 25.4))) ((and (= 2.5 ITEM)(= item2 "Inches"))(setq IRD (/ 2 25.4) IRO (/ 4.5 25.4))) ((and (= 3 ITEM)(= item2 "Inches"))(setq IRD (/ 2 25.4) IRO (/ 5 25.4))) ((and (= 4 ITEM)(= item2 "Inches"))(setq IRD (/ 2.5 25.4) IRO (/ 6.5 25.4))) ((and (= 5 ITEM)(= item2 "Inches"))(setq IRD (/ 4 25.4) IRO (/ 9 25.4))) ((and (= 6 ITEM)(= item2 "Inches"))(setq IRD (/ 6 25.4) IRO (/ 12 25.4))) Not sure if there is any advantage other than less digits in the code. Maybe the second way gives a more accurate result? Quote
BIGAL Posted January 21, 2020 Posted January 21, 2020 Autocad works with less precision so entering more precision will not help, also after about 5 its really not going to make much difference to the radius. 0.019685039370079 0.0196850394 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.