本文整理汇总了C#中SchemaBuilder.AddMapField方法的典型用法代码示例。如果您正苦于以下问题:C# SchemaBuilder.AddMapField方法的具体用法?C# SchemaBuilder.AddMapField怎么用?C# SchemaBuilder.AddMapField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SchemaBuilder
的用法示例。
在下文中一共展示了SchemaBuilder.AddMapField方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IFCAddress
/// <summary>
/// IFC address initialization
/// </summary>
public IFCAddress()
{
if (m_schema == null)
{
m_schema = Schema.Lookup(s_schemaId);
}
if (m_schema == null)
{
SchemaBuilder addressBuilder = new SchemaBuilder(s_schemaId);
addressBuilder.SetSchemaName("IFCAddress");
addressBuilder.AddMapField(s_addressMapField, typeof(String), typeof(String));
m_schema = addressBuilder.Finish();
}
}
示例2: IFCFileHeader
/// <summary>
/// the IFC File Header
/// </summary>
public IFCFileHeader()
{
if (m_schema == null)
{
m_schema = Schema.Lookup(s_schemaId);
}
if (m_schema == null)
{
SchemaBuilder fileHeaderBuilder = new SchemaBuilder(s_schemaId);
fileHeaderBuilder.SetSchemaName("IFCFileHeader");
fileHeaderBuilder.AddMapField(s_FileHeaderMapField, typeof(String), typeof(String));
m_schema = fileHeaderBuilder.Finish();
}
}
示例3: UpdateSavedConfigurations
/// <summary>
/// Updates the setups to save into the document.
/// </summary>
public void UpdateSavedConfigurations()
{
// delete the old schema and the DataStorage.
if (m_schema == null)
{
m_schema = Schema.Lookup(s_schemaId);
}
if (m_schema != null)
{
IList<DataStorage> oldSavedConfigurations = GetSavedConfigurations(m_schema);
if (oldSavedConfigurations.Count > 0)
{
Transaction deleteTransaction = new Transaction(IFCCommandOverrideApplication.TheDocument,
Properties.Resources.DeleteOldSetups);
try
{
deleteTransaction.Start();
List<ElementId> dataStorageToDelete = new List<ElementId>();
foreach (DataStorage dataStorage in oldSavedConfigurations)
{
dataStorageToDelete.Add(dataStorage.Id);
}
IFCCommandOverrideApplication.TheDocument.Delete(dataStorageToDelete);
deleteTransaction.Commit();
}
catch (System.Exception)
{
if (deleteTransaction.HasStarted())
deleteTransaction.RollBack();
}
}
}
// update the configurations to new map schema.
if (m_mapSchema == null)
{
m_mapSchema = Schema.Lookup(s_mapSchemaId);
}
// Are there any setups to save or resave?
List<IFCExportConfiguration> setupsToSave = new List<IFCExportConfiguration>();
foreach (IFCExportConfiguration configuration in m_configurations.Values)
{
if (configuration.IsBuiltIn)
continue;
// Store in-session settings in the cached in-session configuration
if (configuration.IsInSession)
{
IFCExportConfiguration.SetInSession(configuration);
continue;
}
setupsToSave.Add(configuration);
}
// If there are no setups to save, and if the schema is not present (which means there are no
// previously existing setups which might have been deleted) we can skip the rest of this method.
if (setupsToSave.Count <= 0 && m_mapSchema == null)
return;
if (m_mapSchema == null)
{
SchemaBuilder builder = new SchemaBuilder(s_mapSchemaId);
builder.SetSchemaName("IFCExportConfigurationMap");
builder.AddMapField(s_configMapField, typeof(String), typeof(String));
m_mapSchema = builder.Finish();
}
// Overwrite all saved configs with the new list
Transaction transaction = new Transaction(IFCCommandOverrideApplication.TheDocument, Properties.Resources.UpdateExportSetups);
try
{
transaction.Start();
IList<DataStorage> savedConfigurations = GetSavedConfigurations(m_mapSchema);
int savedConfigurationCount = savedConfigurations.Count<DataStorage>();
int savedConfigurationIndex = 0;
foreach (IFCExportConfiguration configuration in setupsToSave)
{
DataStorage configStorage;
if (savedConfigurationIndex >= savedConfigurationCount)
{
configStorage = DataStorage.Create(IFCCommandOverrideApplication.TheDocument);
}
else
{
configStorage = savedConfigurations[savedConfigurationIndex];
savedConfigurationIndex++;
}
Entity mapEntity = new Entity(m_mapSchema);
IDictionary<string, string> mapData = new Dictionary<string, string>();
mapData.Add(s_setupName, configuration.Name);
mapData.Add(s_setupVersion, configuration.IFCVersion.ToString());
mapData.Add(s_setupFileFormat, configuration.IFCFileType.ToString());
mapData.Add(s_setupSpaceBoundaries, configuration.SpaceBoundaries.ToString());
mapData.Add(s_setupQTO, configuration.ExportBaseQuantities.ToString());
//.........这里部分代码省略.........
示例4: UpdateSavedConfigurations
/// <summary>
/// Updates the setups to save into the document.
/// </summary>
/// <param name="document">The document storing the saved configuration.</param>
public void UpdateSavedConfigurations(Document document)
{
// delete the old schema and the DataStorage.
if (m_schema == null)
{
m_schema = Schema.Lookup(s_schemaId);
}
if (m_schema != null)
{
IList<DataStorage> oldSavedConfigurations = GetSavedConfigurations(document, m_schema);
if (oldSavedConfigurations.Count > 0)
{
Transaction deleteTransaction = new Transaction(document, "Delete old IFC export setups");
deleteTransaction.Start();
List<ElementId> dataStorageToDelete = new List<ElementId>();
foreach (DataStorage dataStorage in oldSavedConfigurations)
{
dataStorageToDelete.Add(dataStorage.Id);
}
document.Delete(dataStorageToDelete);
deleteTransaction.Commit();
}
}
// update the configurations to new map schema.
if (m_mapSchema == null)
{
m_mapSchema = Schema.Lookup(s_mapSchemaId);
}
// Are there any setups to save or resave?
List<IFCExportConfiguration> setupsToSave = new List<IFCExportConfiguration>();
foreach (IFCExportConfiguration configuration in m_configurations.Values)
{
if (configuration.IsBuiltIn)
continue;
// Store in-session settings in the cached in-session configuration
if (configuration.IsInSession)
{
IFCExportConfiguration.SetInSession(configuration);
continue;
}
setupsToSave.Add(configuration);
}
// If there are no setups to save, and if the schema is not present (which means there are no
// previously existing setups which might have been deleted) we can skip the rest of this method.
if (setupsToSave.Count <= 0 && m_mapSchema == null)
return;
if (m_mapSchema == null)
{
SchemaBuilder builder = new SchemaBuilder(s_mapSchemaId);
builder.SetSchemaName("IFCExportConfigurationMap");
builder.AddMapField(s_configMapField, typeof(String), typeof(String));
m_mapSchema = builder.Finish();
}
// Overwrite all saved configs with the new list
Transaction transaction = new Transaction(document, "Update IFC export setups");
transaction.Start();
IList<DataStorage> savedConfigurations = GetSavedConfigurations(document, m_mapSchema);
int savedConfigurationCount = savedConfigurations.Count<DataStorage>();
int savedConfigurationIndex = 0;
foreach (IFCExportConfiguration configuration in setupsToSave)
{
DataStorage configStorage;
if (savedConfigurationIndex >= savedConfigurationCount)
{
configStorage = DataStorage.Create(document);
}
else
{
configStorage = savedConfigurations[savedConfigurationIndex];
savedConfigurationIndex ++;
}
Entity mapEntity = new Entity(m_mapSchema);
IDictionary<string, string> mapData = new Dictionary<string, string>();
mapData.Add(s_setupName, configuration.Name);
mapData.Add(s_setupDescription, configuration.Description);
mapData.Add(s_setupVersion, configuration.IFCVersion.ToString());
mapData.Add(s_setupFileFormat, configuration.IFCFileType.ToString());
mapData.Add(s_setupSpaceBoundaries, configuration.SpaceBoundaries.ToString());
mapData.Add(s_setupQTO, configuration.ExportBaseQuantities.ToString());
mapData.Add(s_setupCurrentView, configuration.VisibleElementsOfCurrentView.ToString());
mapData.Add(s_splitWallsAndColumns, configuration.SplitWallsAndColumns.ToString());
mapData.Add(s_setupExport2D, configuration.Export2DElements.ToString());
mapData.Add(s_setupExportRevitProps, configuration.ExportInternalRevitPropertySets.ToString());
mapData.Add(s_setupExportIFCCommonProperty, configuration.ExportIFCCommonPropertySets.ToString());
mapData.Add(s_setupUse2DForRoomVolume, configuration.Use2DRoomBoundaryForVolume.ToString());
mapData.Add(s_setupUseFamilyAndTypeName, configuration.UseFamilyAndTypeNameForReference.ToString());
mapData.Add(s_setupExportPartsAsBuildingElements, configuration.ExportPartsAsBuildingElements.ToString());
mapData.Add(s_setupExportSurfaceStyles, configuration.ExportSurfaceStyles.ToString());
//.........这里部分代码省略.........