CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

AutoCAD 2021 开发者帮助

AddPolyline 方法 (ActiveX)

2024-5-18 18:32| 发布者: admin| 查看: 139| 评论: 0|原作者: admin|来自: AutoCAD

AddPolyline 方法 (ActiveX)

从折点列表创建折线。

支持的平台:仅限 Windows

签名

VBA:

RetVal = object.AddPolyline(VerticesList)
对象

类型:模型空间纸空间

此方法应用到的对象。

顶点列表

访问:仅输入

类型:变体(双打数组)

用于创建折线顶点的 OCS 坐标数组。每个顶点由三个元素表示,前两个是 OCS 中的 XY 坐标;第三个元素被忽略。构造折线对象至少需要两个点(六个元素)。数组大小必须是 3 的倍数。

返回值 (RetVal)

类型:折线

新创建的对象。Polyline

言论

要创建包含圆弧的折线,请先创建直折线,然后使用该方法在特定折点处设置凸起。SetBulge

此方法仅用于向后兼容。使用该方法创建具有优化格式的折线,以节省内存和磁盘空间。AddLightweightPolyline

可以使用该方法将坐标转换为 OCS 或从 OCS 转换坐标。TranslateCoordinates

例子

VBA:

Sub Example_AddPolyline()
    ' This example creates a polyline in model space.
    
    Dim plineObj As AcadPolyline
    Dim points(0 To 14) As Double
    
    ' Define the 2D polyline points
    points(0) = 1: points(1) = 1: points(2) = 0
    points(3) = 1: points(4) = 2: points(5) = 0
    points(6) = 2: points(7) = 2: points(8) = 0
    points(9) = 3: points(10) = 2: points(11) = 0
    points(12) = 4: points(13) = 4: points(14) = 0
        
    ' Create a lightweight Polyline object in model space
    Set plineObj = ThisDrawing.ModelSpace.AddPolyline(points)
    ZoomAll
    
End Sub

可视化 LISP:

(vl-load-com)
(defun c:Example_AddPolyline()
    ;; This example creates a polyline in model space.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
  
    ;; Define the 2D polyline points
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 14)))
    (vlax-safearray-fill points '(1 1 0
                                  1 2 0
                                  2 2 0
                                  3 2 0
                                  4 4 0
                                 )
    )
        
    ;; Create a lightweight Polyline object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq plineObj (vla-AddPolyline modelSpace points))
    (vla-ZoomAll acadObj)
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

群   号:715888130

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

GMT+8, 2025-5-13 11:34

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部