ポイント注釈キーは、スタイル、ラベル スタイル、方向の情報が欠落しているテキスト ファイルから図面に読み込まれるポイント位置にそれらの情報をアタッチするための方法です。キーは、PointDescriptionKey 型のオブジェクトです。 PointDescriptionKey.Code プロパティは、パターン マッチング コードです。 既存のキーのコードと一致する注釈の新しいポイントが作成された場合、そのポイントにはそのキーのすべての設定が割り当てられます。
コードには、ワイルドカードの「?」と「*」を使用できます。キーは、注釈文字列を通して渡すパラメータに応じて、ポイントの定数の尺度値または回転値を保持するか、または方向値を割り当てることができます。ポイント注釈キーは、PointDescriptionKeySet 型のオブジェクトにセットとして保持されます。ドキュメント内のすべてのセットのコレクションには、PointDescriptionKeySetCollection.GetPointDescriptionKeySets() スタティック メソッドを使用してアクセスします。
すべてのキー セットのコレクションでは SearchOrder プロパティも開示されており、これを使用して、注釈キーが適用されたときに一致するものをキー セットが検索する順序を指定できます。SearchOrder コレクションの先頭のキー セットは、優先度が最も高く、最初に検索されます。下の例では、このプロパティにアクセスし、最後の項目を先頭の位置に移動します。
// Create a Key Set in the collection of all Key Sets: ObjectId pointDescriptionKeySetId = PointDescriptionKeySetCollection.GetPointDescriptionKeySets(_acaddoc.Database).Add("Example Key Set"); PointDescriptionKeySet pointDescriptionKeySet = pointDescriptionKeySetId.GetObject(OpenMode.ForWrite) as PointDescriptionKeySet; // Create a new key in the set we just made. Match with any description starting with "GRND". ObjectId pointDescriptionKeyId = pointDescriptionKeySet.Add("GRND*"); PointDescriptionKey pointDescriptionKey = pointDescriptionKeyId.GetObject(OpenMode.ForWrite) as PointDescriptionKey; // Assign chosen styles and label styles to the key pointDescriptionKey.StyleId = pointStyleId; pointDescriptionKey.ApplyStyleId = true; pointDescriptionKey.LabelStyleId = labelStyleId; pointDescriptionKey.ApplyLabelStyleId = true; // Turn off the scale override, and instead scale // to whatever is passed as the first parameter pointDescriptionKey.ApplyDrawingScale = false; pointDescriptionKey.ScaleParameter = 1; pointDescriptionKey.ApplyScaleParameter = true; pointDescriptionKey.ApplyScaleXY = true; // Turn off the rotation override and rotate // all points using the key 45 degrees clockwise pointDescriptionKey.FixedMarkerRotation = 0.785398163; // radians pointDescriptionKey.RotationDirection = RotationDirType.Clockwise; pointDescriptionKey.ApplyFixedMarkerRotation = true; // Before applying the description keys, we can set the order the key sets are searched // when point description keys are applied. // In this example, we take the last item and make it the first. ObjectIdCollection pdKeySetIds = PointDescriptionKeySetCollection.GetPointDescriptionKeySets(_acaddoc.Database).SearchOrder; ObjectId keySetId = pdKeySetIds[pdKeySetIds.Count-1]; pdKeySetIds.Remove(keySetId); pdKeySetIds.Insert(0, keySetId); PointDescriptionKeySetCollection.GetPointDescriptionKeySets(_acaddoc.Database).SearchOrder = pdKeySetIds; // Apply to point group pointGroup.ApplyDescriptionKeys();