03 円を配置する方法


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

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

Option Explicit

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

円を配置するには、円にある三つのポイントを指定する必要があります。Point3d型のpt(3)配列を定義し、それぞれの座標値を与えます。

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

CreateEllipseElement1の説明は下記となります:
Set EllipseElement = object.CreateEllipseElement1 (Template, PerimeterPoint1, PerimeterPoint2, PerimeterPoint3 [, FillMode])

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.
PerimeterPoint1 A Point3d expression. A point on the perimeter.
PerimeterPoint2 A Point3d expression. A point on the perimeter.
PerimeterPoint3 A Point3d expression. A point on the perimeter.
FillMode Optional. An MsdFillMode expression. Indicates whether the element is filled. If the value is not specified or it is msdFillModeUseActive, MicroStation's active fill mode is used.