ayman_48 发表于 2022-7-5 18:03:34

请修改t

你好:
这个lisp为我需要输入每个点名称的点自动编号
还需要从表中删除z值
波茨。LSP

BIGAL 发表于 2022-7-5 18:34:26

代码并不是使Autocad表格成为一个有线条的多文本显示,我之所以这么说,是因为使用“表格”和填充会更容易。
 

for no z
;(command "text" "j" "mc" poin11 "0" (rtos z1 2 3) "")

ayman_48 发表于 2022-7-5 19:01:33

 
谢谢你的帮助,但如何在这段代码中制表我不知道更多关于autolisp如果你为我做这件事,我会很感谢的

BIGAL 发表于 2022-7-5 19:19:16

下面是一个如何制作表格并填写的示例
 

; dwg index to a table
; by Alan H NOV 2013
(defun AH:dwgindex (/ doc objtable ss1 lay ans ans2 plotabs ss1 tag2 tag3 list1 list2 curlayout colwidth numcolumns numrows INC rowheight )

(vl-load-com)
(setq curlayout (getvar "ctab"))
(if (= curlayout "Model")
(progn
(Alert "You need to be in a layout for this option")
(exit)
) ; end progn
) ; end if model
(setq doc (vla-get-activedocument (vlax-get-acad-object)))
(setq curspace (vla-get-paperspace doc))
(setq pt1 (vlax-3d-point (getpoint "\nPick point for top left hand of table:")))

; read values from title blocks

(setq bname "DA1DRTXT")

(setq tag2 "DRG_NO") ;attribute tag name
(setq tag3 "WORKS_DESCRIPTION") ;attribute tag name

(setq ss1 (ssget "x"(list (cons 0 "INSERT") (cons 2 bname))))

(if (= ss1 nil) ; for tomkinson jobs
(progn
(setq bname "COGG_TITLE")
(setq ss1 (ssget "x"(list (cons 0 "INSERT") (cons 2 bname))))
)
)

(setq INC (sslength ss1))
(repeat INC
(foreach att (vlax-invoke (vlax-ename->vla-object (ssname SS1 (SETQ INC (- INC 1)) )) 'getattributes)
       (if (= tag2 (strcase (vla-get-tagstring att)))
         (progn
         (setq ans (vla-get-textstring att))
         (if (/= ans NIL)
         (setq list1 (cons ans list1))
         ) ; if
         ); end progn
         ) ; end if
       (if (= tag3 (strcase (vla-get-tagstring att)))
         (progn
         (setq ans2 (vla-get-textstring att))
         (if (/= ans2 NIL)
             (setq list2 (cons ans2 list2))
          ) ; end if
          ) ; end progn
) ; end if tag3
   
) ; end foreach

) ; end repeat
(setvar 'ctab curlayout)
(command "Zoom" "E")
(command "regen")


(reverse list1)
;(reverse list2)

; now do table
(setq numrows (+ 2 (sslength ss1)))
(setq numcolumns 2)
(setq rowheight 0.2)
(setq colwidth 150)
(setq objtable (vla-addtable curspace pt1 numrows numcolumns rowheight colwidth))
(vla-settext objtable 0 0 "DRAWING REGISTER")
(vla-settext objtable 1 0 "DRAWING NUMBER")
(vla-settext objtable 1 1 "DRAWING TITLE")

(SETQ X 0)
(SETQ Y 2)

(REPEAT (sslength ss1)
(vla-settext objtable Y 0 (NTH X LIST1))
(vla-settext objtable Y 1 (NTH X LIST2))
(vla-setrowheight objtable y 7)

(SETQ X (+ X 1))
(SETQ Y (+ Y 1))
)

(vla-setcolumnwidth objtable 0 55)
(vla-setcolumnwidth objtable 1 170)

(command "_zoom" "e")

); end AH defun

(AH:dwgindex)

(princ)
页: [1]
查看完整版本: 请修改t