启用或禁用表块的再生。 支持的平台:仅窗口 属性值只读:不 类型:布尔
言论更改 Table 对象的所有方法都执行以下操作:
重新计算大型表会消耗大量时间和内存,因为对象是从头开始重建的。Table 为避免性能问题,在通过 API 修改大型表时,应暂时禁用对象的重新生成,然后应用修改并重新启用重新生成。Table 例子工 务 局: Sub Example_RegenerateTableSuppressed()
Dim MyModelSpace As AcadModelSpace
Dim MyTable As IAcadTable
Dim pt(2) As Double
Set MyModelSpace = ThisDrawing.ModelSpace
Set MyTable = MyModelSpace.AddTable(pt, 100, 5, 5, 10)
'Temporarily disable the recomputing of table block
MyTable.RegenerateTableSuppressed = True
Dim i As Integer, j As Integer
For i = 0 To 99
For j = 0 To 4
Call MyTable.SetText(i, j, "my string " & i & ", " & j)
Next j
Next i
'Now force the recomputing of table block
'so that we can see the update table results
MyTable.RegenerateTableSuppressed = False
'You can also call RecomputeTableBlock(true) instead
'to force the regeneration of table
'MyTable.RecomputeTableBlock(True)
End Sub
Visual LISP: (vl-load-com)
(defun c:Example_RegenerateTableSuppressed()
(setq acadObj (vlax-get-acad-object))
(setq doc (vla-get-ActiveDocument acadObj))
(setq pt (vlax-3d-point 0 0 0))
(setq MyModelSpace (vla-get-ModelSpace doc))
(setq MyTable (vla-AddTable MyModelSpace pt 100 5 5 10))
;; Temporarily disable the recomputing of table block
(vla-put-RegenerateTableSuppressed MyTable :vlax-true)
(setq i 1
j 0)
(while (>= 99 i)
(while (>= 4 j)
(vla-SetText MyTable i j (strcat "my string " (itoa i) ", " (itoa j)))
(setq j (1+ j))
)
(setq i (1+ i)
j 0)
)
;; Now force the recomputing of table block
;; so that we can see the update table results
(vla-put-RegenerateTableSuppressed MyTable :vlax-false)
;; You can also call (vla-RecomputeTableBlock obj :vl;ax-true) instead
;; to force the regeneration of table
;;(vla-RecomputeTableBlock MyTable :vlax-true)
)
|
|Archiver|CAD开发者社区
( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-10-29 08:51
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.