| プロダクト: | MicroStation | ||
| バージョン: | CONNECT | ||
| 環境: | N/A | ||
| エリア: | Programming | ||
| サブエリア: | MVBA |
線分を配置する方法を紹介します。
Option Explicit
Sub Main()
Dim lineElement As lineElement
Dim pt(2) As Point3d
pt(0).X = 0
pt(0).Y = 0
pt(0).Z = 0
pt(1).X = 100
pt(1).Y = 100
pt(1).Z = 100
Set lineElement = CreateLineElement2(Nothing, pt(0), pt(1))
ActiveModelReference.AddElement lineElement
End Sub
二つのポイントで線分が決められますのでまずPoint3d型のpt(2)配列を定義し、それぞれの座標値を与えます。
次にCreateLineElement2メソッドを呼び出し、パラメータを渡してからActiveModelReference.AddElementで追加すれば、線分が配置できます。
CreateLineElement2の説明は下記となります:
Set LineElement = object.CreateLineElement2 (Template, StartPoint, EndPoint)
The CreateLineElement2 method syntax has these parts:
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.
EndPoint :A Point3d expression