曲線を配置する方法を紹介します。
Option Explicit Sub Main() Dim oBsplineCurveElement As BsplineCurveElement Dim oFitCurve As InterpolationCurve Dim aFitPoints(4) As Point3d ' Create an interpolation-based B-spline curve aFitPoints(0) = Point3dZero aFitPoints(1) = Point3dFromXYZ(0#, 1#, 0#) aFitPoints(2) = Point3dFromXYZ(1#, 2#, -2#) aFitPoints(3) = Point3dFromXYZ(2#, 2#, -1#) aFitPoints(4) = Point3dFromXYZ(3#, 2#, 3#) Set oFitCurve = New InterpolationCurve oFitCurve.SetFitPoints aFitPoints ' Draw the Interpolation Curve (a fit-point based flavor of B-spline curve) Set oBsplineCurveElement = CreateBsplineCurveElement2(Nothing, oFitCurve) ActiveModelReference.AddElement oBsplineCurveElement oBsplineCurveElement.Redraw End Sub
挿入ポイントによる曲線を放置するには、各挿入ポイントを指定する必要がありますのでaFitPoints配列を定義し、各挿入ポイント座標値を保存します。またNew InterpolationCurveでoFitCurveを設定し、oFitCurve.SetFitPointsで各挿入ポイントをoFitCurveに設定します。次にCreateBsplineCurveElement2を呼び出し、パラメータを渡してから、ActiveModelReference.AddElementで曲線が放置できます。
CreateBsplineCurveElement2の説明は下記となります:Set BsplineCurveElement = object.CreateBsplineCurveElement2 (Template, Curve)
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. Curve:An InterpolationCurve expression.