CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

相关分类

添加跟踪方法 (ActiveX)

2023-1-4 12:05| 发布者: admin| 查看: 611| 评论: 0|来自: AutoCAD

摘要: 从点数组创建跟踪对象。

从点数组创建跟踪对象。

支持的平台:仅窗口

签名

工 务 局:

RetVal = object.AddTrace(PointsArray)
对象

类型:模型空间,图纸空间

此方法适用的对象。

点数组

访问:仅输入

类型:变体(双打数组)

指定跟踪端点的三维 WCS 坐标数组。

返回值(RetVal)

类型:跟踪

新创建的对象。Trace

言论

迹线的端点始终位于中心线上,并且始终被切割为正方形。AutoCAD 会自动计算与相邻追踪段连接的正确斜面。

当填充模式打开时,迹线是实心填充的。当“填充”模式关闭时,仅显示迹线的轮廓。

要设置填充模式,请使用 AutoCAD 填充模式系统变量。AutoCAD TRACEWID 系统变量存储用于对象的当前宽度。Trace

例子

工 务 局:

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

Visual 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)
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

QQ|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 )

GMT+8, 2024-5-12 14:28

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部