本帖最后由 kucha007 于 2022-11-22 16:08 编辑
这里应该可以查到你需要的东西,例子仅供参考:
https://help.autodesk.com/cloudhelp/2019/CHS/AutoCAD-ActiveX-Reference/files/index.htm
- (defun c:TT (/ INSPT MYSPACE TABLE CellRow CellCols)
- ;https://help.autodesk.com/view/OARX/2018/ENU/?guid=GUID-A5A767A8-98D0-40B4-89D1-1F0E5AC52EB7
- ;创建表格并且设置插入点
- (setq INSPT (getpoint "\n→请选择表格插入点: "))
- (if (/= 0 (getvar "tilemode"))
- (setq MYSPACE (vla-get-modelspace(vla-get-activedocument (vlax-get-acad-object))))
- (setq MYSPACE (vla-get-paperspace(vla-get-activedocument (vlax-get-acad-object))))
- )
- (setq TABLE (vla-addtable MYSPACE (vlax-3d-point INSPT) 17 3 15 100));添加表格:插入点、行数、列数、行高、列宽
- (vla-settext TABLE 0 0 "大标题");标题
- (vla-settext TABLE 1 0 "小标题1")
- (vla-settext TABLE 1 1 "小标题2")
- (vla-settext TABLE 1 2 "小标题3")
- (setq CellRow 0)(setq CellCols 0)
- (while (< CellRow (vla-get-rows TABLE))
- (while (< CellCols (vla-get-columns TABLE))
- (vla-setCelltextHeight TABLE CellRow CellCols 5.0);设置文字高度
- (vla-setCellAlignment TABLE CellRow CellCols acMiddleCenter);设置文字居中
- (setq CellCols (1+ CellCols))
- );while
- (setq CellRow (1+ CellRow))
- (setq CellCols 0)
- )
- )
|