从当前位置移动标题栏
您好,我最近开始使用LISP代码。以下是我需要在标题栏位于模型空间的现有图形中使用LISP例程所做的操作。1、全选
2、移动
3、指定基点:
4.指定第二个点:0,0
这将移动整个图形对象,并将标题栏的左下角设置为0,0。
我写了下面的LISP例程,但它不工作。有人能帮忙吗?我想避免用户提示
(defun c:test()
(setq X1(应用“min(mapcar”车点列表)))
(setq Y1(应用“min(mapcar”cadr点列表)))
(setq X2(应用“max(mapcar)”car点列表)
(setq X2(应用“max(mapcar)”car点列表)
; (setq LL(getpoint“\nX1 Y1:”)
(setq LL(列表X1 Y1))
(setq LR(列表X2 Y1))
(setq UR(列表X2 Y2))
(setq UL(列表X1-Y2))
;(setq newbp(getpoint’(0 0)“新基点”)
;(setq sel1(ssget LL UR))
(命令“Move”“all”“LL”(0 0))
(普林斯)
)
谢谢
hssiway公司 首先需要保存当前图层状态,然后启用、解冻和解锁所有图层。你需要确保你移动了所有东西。
下次重新生成并使用(getvar“EXTMIN”)作为LL值。
全部移动,然后重置该层状态。 更好的方法是找到标题栏插入点,然后相对于0,0移动所有内容。
布局中标题栏的示例。代码中的标题栏位于左下角,作为插入点,并移动到0,0
; move title blocks
; By Alan H
(PROMPT ".....now moving dwgs....")
(setq doc (vla-get-activedocument (vlax-get-acad-object)))
(vlax-for lay (vla-get-Layouts doc)
(setq plotabs (cons (vla-get-name lay) plotabs))
)
(setq plottablist (acad_strlsort plotabs))
(setq len (length plottablist))
(setq oldsnap (getvar "osmode"))
(setvar "osmode" 0)
(setq en (entsel "Pick Title Block:"))
(setq K 0)
(repeat len
(setq name (nth K plottablist))
(princ name)
(if (/= name "Model")
(progn
(setvar "ctab" name)
(setq minxy(getvar "extmin"))
(setq maxxy (getvar "extmax"))
(setqed (entget (car en)))
(setq ss (ssget "_X" (list (cons 0 "INSERT")(cons 410 name) (cons 2 (cdr (assoc 2 ed))) ) ))
(setq n (sslength ss))
(setq en (ssname ss 0))
(setq xy (assoc 10 (entget en)))
; insertion pt (setq xy (assoc 10 el))
(setq xy (list (cadr xy)(caddr xy)))
(command "move" "w" minxy maxxy"" xy "0,0")
(command "zoom" "E")
) ;end progn
) ; end if
(setq K (+ K 1))
(princ k)
(setq ss '()
xy nil)
) ; end repeat
(setvar "osmode" oldsnap)
(princ)
请阅读代码发布指南,并编辑代码以包含在代码标签中。
Your Code Here=
Your Code Here
页:
[1]