CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

相关分类

GetBulge Method (ActiveX)

2023-1-4 09:40| 发布者: admin| 查看: 703| 评论: 0|来自: AutoCAD

摘要: 获取折线的给定索引处的凸起值。

获取折线的给定索引处的凸起值。

支持的平台:仅窗口

签名

工 务 局:

RetVal = object.GetBulge(Index)
对象

类型:长线折线

此方法适用的对象。

指数

访问:仅输入

类型:整数

要查询的顶点的索引位置。索引必须是以零开头的正整数。

返回值(RetVal)

类型:

给定索引处顶点的凸起值。

言论

折线:如果折线属性不是,则此方法将失败。TypeacSimplePoly

凸起是所选顶点与折线顶点列表中的下一个顶点之间的弧的包含角度的 1/4 的切线。负凸起值表示弧从所选顶点顺时针移动到下一个顶点。凸起 0 表示直线段,凸起 1 表示半圆。

例子

工 务 局:

Sub Example_GetBulge()
    ' This example creates a lightweight polyline in model space.
    ' It then finds and changes the bulge for a given segment.
    
    Dim plineObj As AcadLWPolyline
    Dim points(0 To 11) 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
    points(10) = 4: points(11) = 1
        
    ' Create a lightweight Polyline object in model space
    Set plineObj = ThisDrawing.ModelSpace.AddLightWeightPolyline(points)
    ZoomAll
    
    ' Find the bulge of the third segment
    Dim currentBulge As Double
    currentBulge = plineObj.GetBulge(3)
    MsgBox "The bulge for the third segment is " & plineObj.GetBulge(3), , "GetBulge Example"
    
    ' Change the bulge of the third segment
    plineObj.SetBulge 3, -0.5
    plineObj.Update
    MsgBox "The bulge for the third segment is now " & plineObj.GetBulge(3), , "GetBulge Example"
    
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetBulge()
    ;; This example creates a lightweight polyline in model space.
    ;; It then finds and changes the bulge for a given segment.
    (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 . 11)))
    (vlax-safearray-fill points '(1 1
                                  1 2
                                  2 2
                                  3 2
                                  4 4
                                  4 1
                                 )
    )   
        
    ;; Create a lightweight Polyline object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq plineObj (vla-AddLightWeightPolyline modelSpace points))
    (vla-ZoomAll acadObj)
    
    ;; Find the bulge of the third segment
    (setq currentBulge (vla-GetBulge plineObj 3))
    (alert (strcat "The bulge for the third segment is " (rtos (vla-GetBulge plineObj 3) 2)))
    
    ;; Change the bulge of the third segment
    (vla-SetBulge plineObj 3 -0.5)
    (vla-Update plineObj)
    (alert (strcat "The bulge for the third segment is now " (rtos (vla-GetBulge plineObj 3) 2)))
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

GMT+8, 2024-5-11 14:59

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部