CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

AutoCAD 2025 开发者帮助

AddLightWeightPolyline 方法 (ActiveX)

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

AddLightWeightPolyline 方法 (ActiveX)

从顶点列表创建轻量级折线。

支持的平台:仅限 Windows

签名

VBA:

RetVal = object.AddLightWeightPolyline(VerticesList)
对象

类型:模型空间纸空间

此方法应用到的对象。

顶点列表

访问:仅输入

类型:变体(双打数组)

指定折线顶点的 2D OCS 坐标数组。构建轻量级折线至少需要两个点(四个元素)。数组大小必须是 2 的倍数。

返回值 (RetVal)

类型:轻量级折线

新创建的对象。LightweightPolyline

言论

折点指定构成折线的线段的端点。要添加圆弧段,请首先创建包含所有线段的折线,然后向要作为圆弧的各个圆弧添加凸起。若要向区段添加凸起值,请使用该方法。SetBulge

折线的高程将设置为布局的当前高程。使用 or 属性确定折线的高程。ElevationModelspaceElevationPaperspace

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

例子

VBA:

Sub Example_AddLightWeightPolyline()
    ' This example creates a lightweight polyline in model space.
    
    Dim plineObj As AcadLWPolyline
    Dim points(0 To 9) As Double
    
    ' Define the 2D polyline points
    points(0) = 1: points(1) = 1
    points(2) = 1: points(3) = 2
    points(4) = 2: points(5) = 2
    points(6) = 3: points(7) = 2
    points(8) = 4: points(9) = 4
        
    ' Create a lightweight Polyline object in model space
    Set plineObj = ThisDrawing.ModelSpace.AddLightWeightPolyline(points)
    ZoomAll
    
End Sub

可视化 LISP:

(vl-load-com)
(defun c:Example_AddLightWeightPolyline()
    ;; This example creates a lightweight 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 . 9)))
    (vlax-safearray-fill points '(1 1
                                  1 2
                                  2 2
                                  3 2
                                  4 4
                                 )
    ) 
        
    ;; Create a lightweight Polyline object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq plineObj (vla-AddLightWeightPolyline modelSpace points))
    (vla-ZoomAll acadObj)
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

GMT+8, 2024-6-27 16:08

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部