Jump to content

autolisp code fragment


vizwhiz
 Share

Recommended Posts

hi There

 

check This out (and let me know if it works)

 

****

 

from CADdepot.com update newsletter

 

"Applying Customization: Right-Click Menus in LISP - AutoCAD tutorial on using the right-click capability to respond to prompts, Dave Pitzer, Autodesk.com"

 

http://usa.autodesk.com/adsk/servlet/item?siteID=123112&id=3369298&linkID=2475176

 

the original is:

 

(defun c: what ;;;etc bla bla bla

....

)

 

so check This out i couldnt resist Tinkering with the original code by Dave Pitzer

 

****

 

This is my version i renamed it to be 3d-doit.lsp

 

****

 

(defun c:3d-doit (/ qaz)

(initget 1 "B C L P R AR CO ER MO RO SC BX CX LX PX RE SB SL SU T U X XT")

(setq qaz (getkword "Draw 3d do-what: [/Bpoly/Circle/Line/Pline/Rectang//ARray/COpy/ERase/MOve/ROtate/SCale//BoX/bPolyX/CircleX/pLineX/REctang//SUbtract/Union/inTersect/SLice/SBlice/eXtrude/eXTrudelast]:"))

(cond

 

;;;2d-doit commands go here

 

((= qaz "B")(command ".bpoly" pause ""))

((= qaz "C") (command ".circle" pause pause))

((= qaz "L") (command ".line"))

((= qaz "P") (command ".pline"))

((= qaz "R") (command ".rectang"))

 

;;;2d-edit commands go here

 

((= qaz "AR")(command ".array"))

((= qaz "CO")(command ".copy"))

((= qaz "ER")(command ".erase"))

((= qaz "MO")(command ".move"))

((= qaz "RO")(command ".rotate"))

((= qaz "SC")(command ".scale"))

 

;;;3d-doit commands go here

 

((= qaz "BX")(c:321)) ;;;(command ".box")

((= qaz "PX")(progn (command ".bpoly" pause "" "") (command ".extrude" "L" "" pause "" 0)))

((= qaz "CX")(progn (command ".circle" pause pause) (command ".extrude" "L" "" pause "" 0)))

((= qaz "LX")(progn (command ".pline") (command ".extrude" "L" "" pause "" 0)))

((= qaz "RE")(progn (command ".rectang" pause pause) (command ".extrude" "L" "" pause "" 0)))

 

;;;3d-edit commands go here

 

((= qaz "SL")(c:342)) ;;;(command ".slice"))

((= qaz "SB")(c:343)) ;;;(command ".slice")) keep Both option:

((= qaz "SU")(command ".subtract"))

((= qaz "T") (command ".intersect"))

((= qaz "U") (command ".union"))

((= qaz "X") (command ".extrude" pause "" pause "" 0 ""))

((= qaz "XT")(command ".extrude" "L" "" pause "" 0))

 

)

)

 

****

 

some of the options reference my own numerical alias system

just replace the front end #'s with the trailing code fragments

 

Thanks

 

Randy

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...