Jump to content

lisp routine for 3D mitered elbows


Mark Eiberg

Recommended Posts

Does anybody know how to make a 3D mitered or 2D mitered elbow with a lisp routine.Would you share the lisp routine.I use auto-cad 2004

Link to comment
Share on other sites

  • 6 years later...

;3D HOLLOW DOUBLE MITER ELBOW

;CREATS P-LINE & EXTRACTS

;NOT FOR SMALLER PIPE SIZES WITH FRACTIONAL OUTSIDE DIAMETERS

(defun dtr (a)

(* pi(/ a 180.0))

)

(defun C:DMELB (/ dia thk len p1 p2 p3 p4 com en1 en2 en3 en4)

(setq dia(getdist "\nEnter pipe O.D.: ")

thk(getdist "\nEnter wall thickness: "))

(initget 1 "L S")

(setq len(strcase(getkword "\nEnter ong or hort radius: ")))

(if(= len "L")

(setq len(* dia 0.62132034))

(setq len(* dia 0.41421356))

)

(setq p1(getpoint "\nPick starting endpoint for Double Mitre Elbow: "))

(setq p2(polar p1 (dtr 90) len))

(setq p3(polar p2 (dtr 135) (* len 2.0)))

(setq p4(polar p3 (dtr 180) len))

(setq comode(getvar "osmode"))

(setvar "osmode" 0)

(command "pline" p1 p2 p3 p4 "")

(setq en1 (entlast))

(command "ucs" "za" p1 p2)

(command "_.circle" "0,0,0" "d" dia p2)

(setq en2 (entlast))

(command "._region" en2 "")

(setq en2 (entlast))

(command "_.circle" "0,0,0" "d" (- dia (* thk 2.0)) p2)

(setq en3 (entlast))

(command "_.region" en3 "")

(setq en3 (entlast))

(command "subtract" en2 "" en3 "")

(setq en4 (entlast))

(command "_.extrude" en4 "" "p" en1 "")

(setq en4 (entlast))

(command "ucs" "P")

(setvar "osmode" comode)

(command "rotate" en4 "" p1 pause)

(princ)

)

Link to comment
Share on other sites

Don't know where the smiley face came from but that line is supposed to be C:DMELB (the letter C followed by a colon, followed by the letters "DMELB".

Link to comment
Share on other sites

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