Jump to content

AUTOLISP DCL Oblong hole, vertical direction, horizontal direction, circle diameter, how long


Recommended Posts

Posted

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

 

 

Oblong hole.jpg

Posted

Which one did you pick ? Helps others and completes the post.

Posted

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)
  )

 

Posted

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.

Posted

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.

Posted

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.lspimage.png.2dfcfe9103bb99728016be75703d5597.png

Posted

hi BIGAL You provide LISP, what command should COMMAND need to execute after loading? I really don’t understand ?

Posted (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 by BIGAL
Posted

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.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...