yunfengning 发表于 2013-2-1 18:12:24

求lsp程序,在“tmp123”图层画矩形的同时,以矩形的对角点连线画上交叉线。

求lsp程序,在“tmp123”图层画矩形的同时,以矩形的对角点连线画上交叉线。

kwok 发表于 2013-2-1 18:36:08

(defun c:recx ()
   (setq clayer (getvar "clayer"))
   (command "layer" "m" "tmp123""c" 7 "" "")
   (setq pt3 (getcorner (setq pt1 (getpoint)) "选择另一点"))
   (setq pt2 (list (car pt3) (car (cdr pt1))))
   (setq pt4 (list (car pt1) (car (cdr pt3))))
   (command "PLINE" pt1 pt2 pt3 pt4 "c" "")
   (command "line" pt1 pt3 "")
   (command "line" Pt2 pt4 "")
   (setvar "clayer" clayer)
   (princ)
)

yjr111 发表于 2013-2-1 18:39:40

(defun c:tt(/ p1 p2)
(setvar 'cmdecho 0)
(setvar 'clayer "tmp123")
(vl-cmdf "rectang" (setq p1(getpoint"\n第一点"))(setq p2(getcorner p1"\n第二点")))
(vl-cmdf "line" p1 p2)
(princ)
)

yunfengning 发表于 2013-2-1 18:55:08

感谢哥几个,帮了大忙了。

ljwsyzf 发表于 2019-4-12 10:53:42

感谢哥几个,帮了大忙了。

stonedesign 发表于 2022-12-30 21:32:20

yjr111 发表于 2013-2-1 18:39
(defun c:tt(/ p1 p2)
(setvar 'cmdecho 0)
(setvar 'clayer "tmp123")


你代码错的

ferious 发表于 2023-4-21 10:21:42

kwok 发表于 2013-2-1 18:36
(defun c:recx ()
   (setq clayer (getvar "clayer"))
   (command "layer" "m" "tmp123""c" 7 "" "") ...

请问为何报错无线型c?之前都是这么建层没报错?:lol


(defun c:recx ()
   (setq clayer (getvar "clayer"))
    (command "layer"   "m"   "1CL14-DK-SETBLOCK"   "c" "9" ""    "l" "c" ""    "");;;1材料垫块114
   (setq pt3 (getcorner (setq pt1 (getpoint)) "选择另一点"))
   (setq pt2 (list (car pt3) (car (cdr pt1))))
   (setq pt4 (list (car pt1) (car (cdr pt3))))
   (command "PLINE" pt1 pt2 pt3 pt4 "c" "")
   (command "line" pt1 pt3 "")
   (command "line" Pt2 pt4 "")
   (setvar "clayer" clayer)
   (princ)
)


页: [1]
查看完整版本: 求lsp程序,在“tmp123”图层画矩形的同时,以矩形的对角点连线画上交叉线。