- (defun CLL (/ CMD1 LST OBJ SHORTC SS);C:后面是命令,你自己可以修改成自己需要的
- ;;错误处理
- (defun *error* (msg)
- (vl-bt)
- (if *DOC*
- (_EndUndo *DOC*) ;块内图元增减
- )
- (while (not (equal (getvar "cmdnames") "")) (command nil))
- (if cmd1
- (setvar "cmdecho" cmd1)
- )
- (if SHORTC
- (setvar "SHORTCUTMENU" SHORTC)
- )
- (setvar "nomutt" 0)
- (princ "\n 出错啦!")
- (princ)
- )
- (if (cadr (ssgetfirst))
- (setq ss (ssget "_P" '((0 . "*TEXT"))))
- )
- (setq cmd1 (getvar "cmdecho"))
- (setvar "cmdecho" 0)
- (or *DOC*
- (setq *DOC* (vla-get-ActiveDocument (vlax-get-acad-object)))
- )
- (_StartUndo *DOC*)
- (cond
- (ss nil)
- (T
- (princ "\n 选择文字连线")
- (setvar "nomutt" 1)
- (setq ss (ssget '((0 . "*TEXT"))))
- (setvar "nomutt" 0)
- )
- )
- (if ss
- (progn
- ;;如果文字对齐方法式不同,可以先预处理
- (command "_.JUSTIFYTEXT" ss "" "BL");如果不处理,则去掉此句
- (setq obj (vlax-ename->vla-object (ssname ss 0)))
- (setq obj(vlax-get obj 'height));字高,用作排序误差
- (setq lst (VL-CATCH-ALL-APPLY 'HH:ss:Sort1 (list ss "Yx" obj)));"Yx",是连线顺序,自己可以修改
- (VL-CATCH-ALL-APPLY 'Make-LWPOLYLINE (list lst))
- )
- )
|