02 弧を配置する方法


 プロダクト:MicroStation 
 バージョン:CONNECT
 環境:N/A
 エリア:Programming
 サブエリア:MVBA

弧を配置する方法を紹介します。

Option Explicit

Sub Main()
    Dim arcElement As arcElement
    Dim pt(3) As Point3d
    
    pt(0).X = 0
    pt(0).Y = 0
    pt(0).Z = 0
    pt(1).X = 200
    pt(1).Y = 50
    pt(1).Z = 0
    pt(2).X = 400
    pt(2).Y = 0
    pt(2).Z = 0
    Set arcElement = CreateArcElement1(Nothing, pt(0), pt(1), pt(2))
    ActiveModelReference.AddElement arcElement
End Sub

弧を配置するには、スタートポイント、中心ポイントとエンドポイントを指定する必要があります。Point3d型のpt(3)配列を定義し、それぞれの座標値を与えます。

次にCreateArcElement1メソッドを呼び出し、パラメータを渡してからActiveModelReference.AddElementで追加すれば、弧が配置できます。

CreateArcElement1の説明は下記となります:

Set ArcElement = object.CreateArcElement1 (Template, StartPoint, CenterPoint, EndPoint)

object: A valid object.
Template:An Element expression. An existing element whose settings are used to initialize the new element. If Nothing, the new element's settings are initialized from MicroStation's active settings.
StartPoint:A Point3d expression. The element's starting point.
CenterPoint:A Point3d expression. The element's center point.
EndPoint:A Point3d expression. The element's ending point.