下の表にあるクラスは、DWG や DGN などさまざまな形式への書き出しのマッピングに使用されるテーブルへの読み込みと書き出しアクセスを表しています。各クラスにはマッピング データのペア(キー、情報)が含まれます。
クラス |
説明 |
ExportLayerTable |
さまざまなレイヤ プロパティ(カテゴリ、名前、色名)をターゲットの書き出し形式でレイヤ名にマッピングするのをサポートするテーブルを表します。 |
ExportLinetypeTable |
ターゲットの書き出し形式で線種名をマッピングするのをサポートするテーブルを表します。 |
ExportPatternTable |
FillPattern の名前と ID をターゲットの書き出し形式で FillPattern の名前にマッピングするのをサポートするテーブルを表します。 |
ExportFontTable |
ターゲットの書き出し形式でのフォント名のマッピングをサポートするテーブルを表します。 |
ExportLineweightTable | ターゲットの書き出し形式での線の太さの名前のマッピングをサポートするテーブルを表します。 |
これらのテーブルの大部分は BaseExportOptions クラス(DGN、DXF、DWG 形式のオプションのベース クラス)を通して使用できます。ExportLineweightTable は DGNExportOptions クラスから使用できます。各テーブルには、対応する Get と Set メソッドがあります。マッピングを修正するには、対応するテーブルを取得し、変更してから、それをオプション クラスに設定し直します。
次の例では、DWG ファイルを書き出す前に ExportLayerTable を修正しています。
コード領域: ExportLayerTable を修正して DWG を書き出し |
public bool ExportDWGModifyLayerTable(Document document, View view) { bool exported = false; IList<string> setupNames = BaseExportOptions.GetPredefinedSetupNames(document); if (setupNames.Count > 0) { // Get the export options for the first predefined setup DWGExportOptions dwgOptions = DWGExportOptions.GetPredefinedOptions(document, setupNames[0]); // Get the export layer table ExportLayerTable layerTable = dwgOptions.GetExportLayerTable(); // Find the first mapping for the Ceilings category string category = "Ceilings"; ExportLayerKey targetKey = layerTable.GetKeys().First<ExportLayerKey>(layerKey => layerKey.CategoryName == category); ExportLayerInfo targetInfo = layerTable[targetKey]; // change the color name and cut color number for this mapping targetInfo.ColorName = "31"; targetInfo.CutColorNumber = 31; // Set the change back to the map layerTable[targetKey] = targetInfo; // Set the modified table back to the options dwgOptions.SetExportLayerTable(layerTable); ICollection<ElementId> views = new List<ElementId>(); views.Add(view.Id); exported = document.Export(Path.GetDirectoryName(document.PathName), Path.GetFileNameWithoutExtension(document.PathName), views, dwgOptions); } return exported; } |