怎样编写lsp程序
发布网友
发布时间:2022-05-10 21:24
我来回答
共1个回答
热心网友
时间:2022-05-15 14:35
(defun c:nnn() ;*
(setq ColorCode (getint "\n请输入字体颜色代码(红1/黄2/绿3/青4/蓝5/紫6/白7):")) ;*
(command "-layer" "m" "编号" "c" "7" " " "") ;*
(command "-style""编号""romans""0""0.5""0""n""n""n") ;*
(command "osmode" "0") ;*
(command "_color" ColorCode) ;*
(setq Radius (getdist "\n请输入圆圈半径: ")) ;*
(setq Num (getint "\n请输入起始编号:")) ;*
(while (> ColorCode 0) ;*
(setq CenterPt (getpoint "\n请指定下一个点: ")) ;*
(if CenterPt ;*
(progn ;*
(command "circle" CenterPt Radius) ;*
(command "text" "j" "m" CenterPt (* 1.2 Radius) "0" Num) ;*
(setq Num (+ Num 1)) ;*
) ;*
(setq ColorCode 0) ;*
) ;*
)
(command "-layer" "m" "0" "c" "7" " " "")
(command "-style""standard""宋体""0""1""0""n""n""n")
(command "color" "bylayer")
(command "osmode" "699")
(princ)
)
;;;*******************************************
;;;************以下为新建圆形视口程序*************
(defun c:wc()
(setq CenPt (getpoint "\n请指定圆心: "))
(setq SenPt (getpoint CenPt "\n请指定圆周点: "))
(command "-vports" "p" SenPt "a" "ce" CenPt "a" 359.99999 SenPt "cl")
(princ)
)
;;;*******************************************
(defun c:tt()
(command "undo" "1" )
(princ)
)
(prompt "\n<<NNN>>")
(prin1)
看这个行不行。把代码复制到记事本,扩展名改为*.lsp 打开CAD,工具-->AutoLISP-->加载 加载保存的lsp文件 然后在命令行打nnn 就可以使用了》
能用的话记得加分哦 o(∩_∩)o...