06 文字を配置する方法


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

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

Option Explicit

Sub Main()
    Dim oText As TextElement
    Dim pt As Point3d
    pt.X = 0
    pt.Y = 0
    pt.Z = 0
    
    Set oText = CreateTextElement1(Nothing, "Hello World", pt, Matrix3dIdentity)
    ActiveModelReference.AddElement oText
End Sub

テキストを配置するには、TextElementオブジェクトを利用する必要がありますのでoTextを定義します。
次にCreateTextElement1メソッドを呼び出し、パラメータを渡してからActiveModelReference.AddElementでテキストが配置できます。

Set TextElement = object.CreateTextElement1 (Template, Text, Origin, Rotation)

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.
Text A String expression. The element's text.
Origin A Point3d expression. The element's origin.
Rotation A Matrix3d expression. The element's rotation. For no rotation, specify Matrix3dIdentity.