多角形を配置する方法を紹介します。
Option Explicit Sub Main() Dim shapeElement As shapeElement 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 shapeElement = CreateShapeElement1(Nothing, pt) ActiveModelReference.AddElement shapeElement End Sub
多角形を配置するには、多角形にあるすべての頂点を指定する必要があります。Point3d型のpt(3)配列を定義し、それぞれの座標値を与えます。
次にCreateShapeElement1メソッドを呼び出し、パラメータを渡してからActiveModelReference.AddElementで追加すれば、多角形が配置できます。
CreateShapeElement1の説明は下記となります:Set ShapeElement = object.CreateShapeElement1 (Template, Vertices [, FillMode])
Part Description 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. Vertices:A Point3d () expression. FillMode: Optional. An MsdFillMode expression.