ラベル スタイルは、ラベルのさまざまなフィーチャのコレクションです。これらのコレクションを含むプロパティとしては、記号用の AeccLabelStyle.BlockComponents、方向矢印用の AeccLabelStyle.DirectionArrowComponents、線分用の AeccLabelStyle.LineComponents、文字用の AeccLabelStyle.TextComponents、主および副ティック マーク用の AeccLabelStyle.TickComponents があります。 ラベル スタイル タイプによっては、これらすべてが意味を持つとは限りません。たとえば、ティック マーク コンポーネントをポイント用のラベル スタイルに追加しても、表示上の効果はまったくありません。また、ラベル スタイルは、グラフィカル オブジェクトが現在のドキュメントの一部であるかどうかに依存します。たとえば、スタイルが現在のドキュメントの一部ではないブロックを参照している場合、指定したブロックまたはティック コンポーネントは表示されません。
ラベル スタイルにフィーチャを追加するには、対応するコレクションに新しいコンポーネントを追加します。次に、そのコンポーネントのプロパティを適切な値に設定します。その際、Visible プロパティが True に設定されていることを常に確認してください。
' Add a line to the collection of lines in our label style. Dim oLabelStyleLineComponent As AeccLabelStyleLineComponent Set oLabelStyleLineComponent = oLabelStyle.LineComponents _ .Add("New Line") ' Now the line can be changed to suit our purpose. oLabelStyleLineComponent.Visibility = True oLabelStyleLineComponent.color = 40 ' orange-yellow oLabelStyleLineComponent.Angle = 2.094 ' radians, = 120 deg ' Negative lengths are allowed. They mean the line ' is drawn in the opposite direction of the angle ' specified. oLabelStyleLineComponent.Length = -0.015 oLabelStyleLineComponent.StartPointXOffset = 0.005 oLabelStyleLineComponent.StartPointYOffset = -0.005
最初に作成されたラベル スタイル オブジェクトは、環境設定に基づいて設定されます。このため、新しいラベル スタイル オブジェクトには既にフィーチャが含まれている場合があります。新しいラベル スタイル オブジェクトを作成する場合、こうしたフィーチャがあるかどうかをチェックする必要があります。チェックしない場合、意図しない要素が含まれてしまうことがあります。
' Check to see if text components already exist in the ' collection. If any do, just modify the first text ' feature instead of making a new one. Dim oLabelStyleTextComponent As AeccLabelStyleTextComponent If (oLabelStyle.TextComponents.Count > 0) Then Set oLabelStyleTextComponent = oLabelStyle _ .TextComponents.Item(0) Else Set oLabelStyleTextComponent = oLabelStyle _ .TextComponents.Add("New Text") End If
また、環境設定では使用する単位も定義されます。作成するアプリケーションで異なる図面を使用する場合、環境設定を考慮する必要があります。考慮しない場合、それぞれのドキュメントでラベルが予期しない動作を示すことがあります。