Luís Augusto 发表于 2022-7-5 23:39:15

文档vla对象到au

我想知道是否有处理autoCADtables的文档。
有几个线程展示了如何使用AddTable方法创建一个表,以及其他如何创建一个表样式的教学,但没有发现任何关于哪些属性可以更改的内容,等等。
说明表支持哪些方法和属性以及如何配置这些方法和属性的文档。
可以使用由Lee Mac创建的转储工具进行分析,在Autocadable中有许多东西需要配置。
有人知道吗?
能告诉我怎么走吗?
我发誓,我在网上扫了一眼,没有找到。
 
非常感谢你。
 
祝你好运,路易斯·奥古斯托。

BIGAL 发表于 2022-7-5 23:52:36

我发现这很容易,你也可以改变一个细胞,像文字高度颜色等东西。
 
; example of creating a table style
(vl-load-com)
(defun c:CreateTableStyle()
   ;; Get the AutoCAD application and current document
   (setq acad (vlax-get-acad-object))
   (setq doc (vla-get-ActiveDocument acad))
   ;; Get the Dictionaries collection and the TableStyle dictionary
   (setq dicts (vla-get-Dictionaries doc))
   (setq dictObj (vla-Item dicts "acad_tablestyle"))
   
   ;; Create a custom table style
   (setq key "MyTableStyle"
         class "AcDbTableStyle")
   (setq custObj (vla-AddObject dictObj key class))
   ;; Set the name and description for the style
   (vla-put-Name custObj "MyTableStyle")
   (vla-put-Description custObj "This is my custom table style")
   ;; Sets the bit flag value for the style
   (vla-put-BitFlags custObj 1)
   ;; Sets the direction of the table, top to bottom or bottom to top
   (vla-put-FlowDirection custObj acTableTopToBottom)
   ;; Sets the supression of the table header
   (vla-put-HeaderSuppressed custObj :vlax-false)
   ;; Sets the horizontal margin for the table cells
   (vla-put-HorzCellMargin custObj 0.22)
   ;; Sets the supression of the table title
   (vla-put-TitleSuppressed custObj :vlax-false)
   ;; Sets the vertical margin for the table cells
   (vla-put-VertCellMargin custObj 0.22)
   ;; Set the alignment for the Data, Header, and Title rows
   (vla-SetAlignment custObj (+ acDataRow acTitleRow) acMiddleLeft)
   (vla-SetAlignment custObj acHeaderRow acMiddleCenter)
   ;; Set the background color for the Header and Title rows
   (setq colObj (vlax-create-object "AutoCAD.AcCmColor.19"))
   (vla-SetRGB colObj 98 136 213)
   (vla-SetBackgroundColor custObj (+ acHeaderRow acTitleRow) colObj)
   ;; Clear the background color for the Data rows
   (vla-SetBackgroundColorNone custObj acDataRow :vlax-true)
   ;; Set the bottom grid color for the Title row
   (vla-SetRGB colObj 0 0 255)
   (vla-SetGridColor custObj acHorzBottom acTitleRow colObj)
   ;; Set the bottom grid lineweight for the Title row
   (vla-SetGridLineWeight tableStyle acHorzBottom acTitleRow acLnWt025)
   ;; Set the inside grid lines visible for the data and header rows
   (vla-SetGridVisibility custObj acHorzInside(+ acDataRow acHeaderRow) :vlax-true)
   ;; Set the text height for the Title, Header and Data rows
   (vla-SetTextHeight custObj acTitleRow 1.5)
   (vla-SetTextHeight custObj (+ acDataRow acHeaderRow) 1.0)
   ;; Set the text height and style for the Title row
   (vla-SetTextStyle custObj (+ acDataRow acHeaderRow acTitleRow) "Standard")
   ;; Release the color object
   (vlax-release-object colObj)
(princ)
)

Luís Augusto 发表于 2022-7-5 23:57:27

尊敬的Bigal,感谢您的回复。
你在这里找到了这个代码?
密码
 
我觉得有必要了解它,只是想改变这个程序。我正在创建错误处理,这意味着如果图形中不存在表格样式。
 
我可能错了,但没有看到在哪里修改列的数量和宽度。细胞也是如此。
如果这是清楚的,请对我有耐心,因为我只是一个初学者。
 
我必须创建的表格样式非常简单,如果我发布了,肯定会有人帮我。让我困惑的是,这样的文档似乎并不存在!
 
我很感激你能帮助我。如果你知道如何为每一个列设置数量和大小,我将非常感激。
 
感谢您分享您的知识。
 
你好,路易斯·奥古斯托。

Spaj 发表于 2022-7-6 00:01:55

你好
 
关于这个问题,有一些非盟的说明可能会有所帮助。
 
在此处尝试http://forums.augi.com/showthread.php?148682-CP34-3-LISP-Table-Magic

BIGAL 发表于 2022-7-6 00:09:32

现在不在工作,做表格大小很容易,明天会发帖子,我很容易找到如何创建表格的例子。这花了几秒钟的时间,VLA创建表格AutoCAD有很多例子

Luís Augusto 发表于 2022-7-6 00:12:56

 
很棒的材料Spaj。欢迎评论代码。
实际上很有启发性,但我觉得它缺少了一些需要操作的属性,还是我错了?
 
非常感谢分享。
 
 
我期待着你的职位。
谢谢比格尔。

BIGAL 发表于 2022-7-6 00:25:15

这个例子是从更大的代码中截取的。但有必要的部分
 
(setq doc (vla-get-activedocument (vlax-get-acad-object)))
(setq curspace (vla-get-paperspace doc)) ; must be in paper space which layout to put table in change to modelspace if required.
(setq pt1 (vlax-3d-point (getpoint "\nPick point for top left hand of table:")))

; now do table
(setq numrows (+ 2 (sslength ss1))) ; ss1 is a list of data for table
(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 10)
(SETQ X (+ X 1))
(SETQ Y (+ Y 1))
)

Luís Augusto 发表于 2022-7-6 00:26:06

 
比格尔,谢谢你的贡献。
我希望这个帖子能帮助别人,也能帮助我。
 
谢谢大家。

BIGAL 发表于 2022-7-6 00:33:19

别担心

asos2000 发表于 2022-7-6 00:40:24

查找附件
LISPTableMagicUpload2。拉链
au06_Table_Magic。拉链
页: [1]
查看完整版本: 文档vla对象到au