GetBulge 方法 (ActiveX)
获取折线的给定索引处的凸起值。 支持的平台:仅限 Windows 签名VBA: RetVal = object.GetBulge(Index)
返回值 (RetVal)类型:双 给定索引处顶点的凸起值。 言论折线:如果折线属性不是 。TypeacSimplePoly 凸起是所选顶点与折线顶点列表中的下一个顶点之间的弧所包含角度的 1/4 的切线。负凸起值表示圆弧从所选顶点顺时针方向移动到下一个顶点。凸起 0 表示直线段,凸起 1 表示半圆。 例子VBA: 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
可视化 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)))
)
|
|Archiver|CAD开发者社区
( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-10-29 10:00
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.