wk9128 Posted March 30, 2023 Posted March 30, 2023 Please help me design a parameterized AUTOLISP DCL Oblong hole, vertical direction, horizontal direction, circle diameter, how long Can someone please help me ? It would be much appreciated. Thanks in advance Quote
BIGAL Posted March 31, 2023 Posted March 31, 2023 Did you google "SLOT Autocad lisp" lots out there. 1 Quote
BIGAL Posted April 1, 2023 Posted April 1, 2023 Which one did you pick ? Helps others and completes the post. Quote
wk9128 Posted April 1, 2023 Author Posted April 1, 2023 This function is the most attractive to me, thank you for guiding a clear path (defun c:slot (/ s an a1 a2 cc c1 c2 d1 d2 r1 r2) (and (while (or (prompt "\nSelect ONLY 2 circles, <ENTER> to accept.. ") (not s) (> (sslength s) 2)) (setq s (ssget "_:E:L+." '((0 . "CIRCLE")))) ) (mapcar ''((a b) (mapcar 'set a (mapcar ''((i) (cdr (assoc i (entget b)))) '(10 40)))) '((c1 r1) (c2 r2)) (setq cc (vl-remove-if 'listp (mapcar 'cadr (ssnamex s)))) ) (setq d1 (distance c1 c2) a1 (angle c1 c2) d2 (- r1 r2) ) (< (abs d2) d1) ; bug fixed LM:2CircleTangents ;;; a2 (+ (* pi 0.5) (asin (/ r2 (* 2. d1)))) ; bug? (setq a2 (atan (sqrt (- (* d1 d1) (* d2 d2))) d2) an (list (+ a1 a2) (- a1 a2)) ep (mapcar ''((x) (setq x (eval (cons 'vl-list* x))) (entmakex (cons '(0 . "ARC") (mapcar 'cons '(10 40 50 51) x))) (mapcar ''((i) (polar (car x) (nth i x) (cadr x))) '(2 3)) ) '((c1 r1 an) (c2 r2 (reverse an))) ) ) (foreach x (apply 'mapcar (cons 'list (list (car ep) (reverse (cadr ep))))) (entmakex (cons '(0 . "LINE") (mapcar ''((a b) (cons a b)) '(10 11) x))) ) (mapcar 'entdel cc) ) (princ) ) Quote
BIGAL Posted April 2, 2023 Posted April 2, 2023 Maybe use this as a "Learn Lisp" task. I would look at enter c-c length, dia, then pick 1st point, draw 2 arcs, draw 2 lines, pedit so join all arcs and lines, then ask for rotation. Quote
wk9128 Posted April 5, 2023 Author Posted April 5, 2023 Hi BIGAL , The advantage of this LISP is to set the distance between two circles. When you want to make a SLOT, you can click on the two circles to achieve a SLOT figure at any angle. It is super convenient. Quote
BIGAL Posted April 6, 2023 Posted April 6, 2023 I thought I posted this already. (if (not AH:getvalsm)(load "Multi Getvals.lsp")) (setq ans (AH:getvalsm (list "Enter values " "Length " 5 4 "500" "Dia " 5 4 "50" "Angle " 5 4 "0"))) (setq len (atof (nth 0 ans)) wid (atof (nth 1 ans) ang (dtr (atof (nth 2 ans)))) Multi GETVALS.lsp Quote
wk9128 Posted April 6, 2023 Author Posted April 6, 2023 hi BIGAL You provide LISP, what command should COMMAND need to execute after loading? I really don’t understand ? Quote
BIGAL Posted April 7, 2023 Posted April 7, 2023 (edited) I will have to look into a pline creation line arc line arc. That is the simplest way to do it . I have some pline arc examples have to go back and look how they work. The Getvals is just a front end for input. Edited April 7, 2023 by BIGAL Quote
wk9128 Posted April 7, 2023 Author Posted April 7, 2023 Hi BIGAL Please look at this animation FILE , Really Don't know how to call your LISP MULTI Getvals.rar Quote
BIGAL Posted April 7, 2023 Posted April 7, 2023 Look at my post of thursday that is the code the 3 lines. You need to have Multi Getvals saved in your support path, or add the location of the file. eg (if (not AH:getvalsm)(load "c:\\mycompany\\lisp files\\from cadtutor\\Multi Getvals.lsp")) Just copy the lines 1 at a time and paste to command line to test. Then can do !len to see the value you have entered. 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.