| AddTrace 方法 (ActiveX) 从点数组创建 Trace 对象。 支持的平台:仅限 Windows 签名VBA: RetVal = object.AddTrace(PointsArray) 言论迹线的端点始终位于中心线上,并且始终被切成正方形。AutoCAD 会自动计算连接到相邻迹线段的正确斜角。 当“填充”模式打开时,迹线是实心填充的。当“填充”模式关闭时,仅显示迹线的轮廓。 要设置填充模式,请使用 AutoCAD FILLMODE 系统变量。AutoCAD TRACEWID 系统变量存储用于对象的当前宽度。Trace 例子VBA: Sub Example_AddTrace()
    ' This example creates a trace in model space.
    
    Dim traceObj As AcadTrace
    Dim tracePts(0 To 11) As Double       ' 4 (3D) points
    
    ' Define the points of the trace
    tracePts(0) = 1: tracePts(1) = 1: tracePts(2) = 0
    tracePts(3) = 3: tracePts(4) = 3: tracePts(5) = 0
    tracePts(6) = 5: tracePts(7) = 3: tracePts(8) = 0
    tracePts(9) = 5: tracePts(10) = 1: tracePts(11) = 0
    
    ' Turn on the system variable (FILLMODE)
    ' to fill the outline of the trace
    ThisDrawing.SetVariable "FILLMODE", 1
        
    ' Create the trace object in model space
    Set traceObj = ThisDrawing.ModelSpace.AddTrace(tracePts)
    ZoomAll
    
End Sub可视化 LISP: (vl-load-com)
(defun c:Example_AddTrace()
    ;; This example creates a trace in model space.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    
    ;; Define the points of the trace
    (setq tracePts (vlax-make-safearray vlax-vbDouble '(0 . 11)))
    (vlax-safearray-fill tracePts '(1 1 0
                                    3 3 0
                                    5 3 0
                                    5 1 0
                                   )
    )
    
    ;; Turn on the system variable (FILLMODE)
    ;; to fill the outline of the trace
    (vla-SetVariable doc "FILLMODE" 1)
        
    ;; Create the trace object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq traceObj (vla-AddTrace modelSpace tracePts))
    (vla-ZoomAll acadObj)
) | 
 |Archiver|CAD开发者社区
( 苏ICP备2022047690号-1   苏公网安备32011402011833)
|Archiver|CAD开发者社区
( 苏ICP备2022047690号-1   苏公网安备32011402011833)
GMT+8, 2025-10-30 20:35
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.