AddPolyline 方法 (ActiveX) 
从折点列表创建折线。 支持的平台:仅限 Windows 签名VBA: RetVal = object.AddPolyline(VerticesList) 言论要创建包含圆弧的折线,请先创建直折线,然后使用该方法在特定折点处设置凸起。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)
)
 | 
|Archiver|CAD开发者社区
( 苏ICP备2022047690号-1   苏公网安备32011402011833)
GMT+8, 2025-11-4 15:11
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.