这个给您参考
LE Jul 17 2002, 7:12 am show options
Newsgroups: autodesk.autocad.customization From: "LE" <www.arqcom.com.mx> - Find messages by this author Date: Tue, 16 Jul 2002 15:48:49 -0700 Local: Wed, Jul 17 2002 6:48 am Subject: Re: Getpoint function fails Reply to Author | Forward | Print | Individual Message | Show original | Report Abuse
Richard Preator
There you go sir...
(defun c:rpball (/ old oldsnap sty ang scl scl1 Dscl Cscl storela k#clayer ldr_start ldr_end a aang Ascl point circl txt) (setvar "cmdecho" 0) (setq old (getvar "orthomode")) (setvar "orthomode" 0) (setq oldsnap (getvar "osmode")) (setq sty (getvar "snapstyl")) (setvar "snapstyl" 0) (setq ang (getvar "snapang")) (setq scl (getvar "dimtxt")) (setq scl1 (getvar "dimscale")) (setq Dscl (* scl scl1)) (setq Cscl (* Dscl 1.2)) (setq storela (getvar "curlayer")) (setq k#clayer (getvar "clayer")) (if (/= storela "DIM") (command "._layer" "_m" "DIM" "")) (command "._osmode" 512) (setq ldr_start (getpoint "\n Enter Start Point of Leader at Object: ")) (prompt "\n Enter Center of Balloon: ") (command "._osnap" "_none") (command "._line" ldr_start pause "") (setq ldr_end (getvar "lastpoint")) (command "._erase" "_l" "") (setq A (angle ldr_start ldr_end)) (setq Aang (* 180 (/ A pi))) (setq Ascl (* 0.32 Dscl)) (setq point (polar ldr_start A Dscl)) (command "._pline" ldr_start ldr_end "") (command "._pedit" "_l" "_edit" "_insert" point "_P" "_w" "0.0" Ascl "_x" "_x") (command "._circle" ldr_end Cscl) (setq circl (entlast)) (command "._change" circl "" "_p" "_c" 1 "") (command "._trim" circl "" ldr_end "") (setq txt (getstring "\nItem Number: ")) (command "._text" "_j" "_m" ldr_end Dscl "0" (princ txt)) (command "._change" "_l" "" "_p" "_c" 1 "") (setvar "cmdecho" 1) (setvar "snapstyl" sty) (setvar "snapang" ang) (setvar "orthomode" old) (setvar "clayer" k#clayer) (setvar "osmode" oldsnap) (princ)) (princ)
|