用lisp代码帮忙写个CAD小程序

用lisp代码帮忙写个CAD小程序,第1张

(defun c:n3()

(vl-load-com)

(setq cm (getvar "cmdecho") os (getvar "osmode"))

(setvar "cmdecho" 0)

(command "_undo" "be")

(setq pdbz nil)

(vlax-for obj (vla-get-Linetypes (vla-get-ActiveDocument (vlax-get-acad-object)))

(if (= (vla-get-name obj) "ACAD_ISO04W100")

(setq pdbz t)

)

)

(if (= pdbz nil)

(command "_linetype" "l" "ACAD_ISO04W100" "" "")

)

(while (and (setvar "osmode" 33)

(setq pt1 (getpoint "\n请指定PT1<回车结束>:"))

)

(setvar "orthomode" 1)

(if (and (setq pt2 (getpoint pt1 "\n请指定PT2:"))

(setq d (getreal "\n请输入d值:"))

(setq w (getreal "\n请输入w值:"))

)

(progn

(setvar "orthomode" 0) (setvar "osmode" 0)

(setq p1 (mapcar '+ pt2 (list ( 05 d) 00))

p6 (mapcar '+ pt2 (list ( -05 d) 00))

p3 (mapcar '+ pt1 (list ( 05 w) 00))

p4 (mapcar '+ pt1 (list ( -05 w) 00))

p7 (mapcar '+ pt1 (list 00 ( -05 w)))

p8 (mapcar '+ pt1 (list ( 05 d) 00))

p9 (mapcar '+ pt1 (list ( -05 d) 00))

p2 (inters p1 p8 p3 p7)

p5 (inters p6 p9 p4 p7)

)

(entmake (list '(0 "LWPOLYLINE") '(100 "AcDbEntity") '(100 "AcDbPolyline")

'(62 4) '(90 4) '(70 1)

(cons 10 p1) (cons 10 p2) (cons 10 p5) (cons 10 p6)

)

)

(entmake (list '(0 "LWPOLYLINE") '(100 "AcDbEntity") '(100 "AcDbPolyline")

'(62 4) '(90 4) '(70 1)

(cons 10 p2) (cons 10 p3) (cons 10 p4) (cons 10 p5)

)

)

(entmake (list '(0 "LINE") '(100 "AcDbEntity") '(100 "AcDbLine")

'(62 1) '(6 "ACAD_ISO04W100") '(48 001)

(cons 10 (mapcar '+ pt1 '(0 30)))

(cons 11 (mapcar '+ pt2 '(0 -30)))

)

)

)

)

)

(command "_undo" "e")

(setvar "osmode" os) (setvar "cmdecho" cm)

(princ)

)

试一试下面的程序

(defun c:try (/ p)

(setq p (getpoint "from point: "))

(command "PLINE")

(while p

(command p)

(setq p (getpoint "to point: "))

)

(command)

)

以上就是关于用lisp代码帮忙写个CAD小程序全部的内容,包括:用lisp代码帮忙写个CAD小程序、用autocad lisp编写一程序,在给定的一系列点之间绘制高压输电线、等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zz/10088677.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-05
下一篇 2023-05-05

发表评论

登录后才能评论

评论列表(0条)

保存