本文整理汇总了C#中SchemaBuilder.Finish方法的典型用法代码示例。如果您正苦于以下问题:C# SchemaBuilder.Finish方法的具体用法?C# SchemaBuilder.Finish怎么用?C# SchemaBuilder.Finish使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SchemaBuilder
的用法示例。
在下文中一共展示了SchemaBuilder.Finish方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetOrCreateSchema
public override Schema GetOrCreateSchema()
{
SchemaBuilder sb = new SchemaBuilder(SchemaGuid);
sb.SetSchemaName(SchemaName);
sb.AddSimpleField("someBool", typeof(bool));
return sb.Finish();
}
示例2: GetOrCreateSchema
public override Schema GetOrCreateSchema()
{
SchemaBuilder sb = new SchemaBuilder(SchemaGuid);
sb.SetSchemaName(SchemaName);
sb.AddArrayField("someStringArray", typeof(string));
return sb.Finish();
}
示例3: CreateSchemeAndStoreData
// Create a data structure, attach it to a wall, populate it with data, and retrieve the data back from the wall
public void CreateSchemeAndStoreData(FamilySymbol titleblock)
{
SchemaBuilder schemaBuilder = new SchemaBuilder(new Guid("1a68d420-96dd-44aa-a1de-000774a6104b"));
schemaBuilder.SetReadAccessLevel(AccessLevel.Public); // allow anyone to read the object
schemaBuilder.SetSchemaName("TitleBlockSettings");
// create a field to store data
FieldBuilder fieldBuilder_titleblockName = schemaBuilder.AddSimpleField("titleblockName", typeof(string));
FieldBuilder fieldBuilder_cellSizeDistance_X = schemaBuilder.AddSimpleField("cellSizeDistance_X", typeof(string));
//fieldBuilder_cellSizeDistance_X.SetUnitType(UnitType.UT_Length);
FieldBuilder fieldBuilder_lowerGap_X = schemaBuilder.AddSimpleField("lowerGap_X", typeof(string));
//fieldBuilder_lowerGap_X.SetUnitType(UnitType.UT_Length);
FieldBuilder fieldBuilder_additionalEdge_X = schemaBuilder.AddSimpleField("additionalEdge_X", typeof(string));
//fieldBuilder_additionalEdge_X.SetUnitType(UnitType.UT_Length);
FieldBuilder fieldBuilder_fineTune_X = schemaBuilder.AddSimpleField("fineTune_X", typeof(string));
//fieldBuilder_fineTune_X.SetUnitType(UnitType.UT_Length);
FieldBuilder fieldBuilder_cellSizeDistance_Y = schemaBuilder.AddSimpleField("cellSizeDistance_Y", typeof(string));
//fieldBuilder_cellSizeDistance_Y.SetUnitType(UnitType.UT_Length);
FieldBuilder fieldBuilder_lowerGap_Y = schemaBuilder.AddSimpleField("lowerGap_Y", typeof(string));
//fieldBuilder_lowerGap_Y.SetUnitType(UnitType.UT_Length);
FieldBuilder fieldBuilder_additionalEdge_Y = schemaBuilder.AddSimpleField("additionalEdge_Y", typeof(string));
//fieldBuilder_additionalEdge_Y.SetUnitType(UnitType.UT_Length);
FieldBuilder fieldBuilder_fineTune_Y = schemaBuilder.AddSimpleField("fineTune_Y", typeof(string));
//fieldBuilder_fineTune_Y.SetUnitType(UnitType.UT_Length);
FieldBuilder fieldBuilder_cellGrid_Length = schemaBuilder.AddSimpleField("cellGrid_Length", typeof(string));
FieldBuilder fieldBuilder_cellGrid_Height = schemaBuilder.AddSimpleField("cellGrid_Height", typeof(string));
//fieldBuilder.SetDocumentation("store length of cell size in X direction.");
Schema schema = schemaBuilder.Finish(); // register the Schema object
}
示例4: 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();
}
}
示例5: 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();
}
}
示例6: GetSchema
private static Schema GetSchema()
{
Schema schema = Schema.Lookup(s_schemaId);
if (schema == null)
{
SchemaBuilder classificationBuilder = new SchemaBuilder(s_schemaId);
classificationBuilder.SetSchemaName("IFCClassification");
classificationBuilder.AddSimpleField(s_ClassificationName, typeof(string));
classificationBuilder.AddSimpleField(s_ClassificationSource, typeof(string));
classificationBuilder.AddSimpleField(s_ClassificationEdition, typeof(string));
classificationBuilder.AddSimpleField(s_ClassificationEditionDate_Day, typeof(Int32));
classificationBuilder.AddSimpleField(s_ClassificationEditionDate_Month, typeof(Int32));
classificationBuilder.AddSimpleField(s_ClassificationEditionDate_Year, typeof(Int32));
classificationBuilder.AddSimpleField(s_ClassificationLocation, typeof(string));
classificationBuilder.AddSimpleField(s_ClassificationFieldName, typeof(string));
schema = classificationBuilder.Finish();
}
return schema;
}
示例7: IFCClassificationMgr
/// <summary>
/// the IFC Classification Manager
/// </summary>
public IFCClassificationMgr()
{
if (m_schema == null)
{
m_schema = Schema.Lookup(s_schemaId);
}
if (m_schema == null)
{
SchemaBuilder classificationBuilder = new SchemaBuilder(s_schemaId);
classificationBuilder.SetSchemaName("IFCClassification");
classificationBuilder.AddSimpleField(s_ClassificationName, typeof(string));
classificationBuilder.AddSimpleField(s_ClassificationSource, typeof(string));
classificationBuilder.AddSimpleField(s_ClassificationEdition, typeof(string));
classificationBuilder.AddSimpleField(s_ClassificationEditionDate_Day, typeof(Int32));
classificationBuilder.AddSimpleField(s_ClassificationEditionDate_Month, typeof(Int32));
classificationBuilder.AddSimpleField(s_ClassificationEditionDate_Year, typeof(Int32));
classificationBuilder.AddSimpleField(s_ClassificationLocation, typeof(string));
m_schema = classificationBuilder.Finish();
}
}
示例8: CreateObjects
private void CreateObjects(List<RevitObject> revitObjects, Document doc, Guid uniqueId, int runId, string nickName)
{
// Create new Revit objects.
//List<LyrebirdId> newUniqueIds = new List<LyrebirdId>();
// Get the levels from the project
FilteredElementCollector lvlCollector = new FilteredElementCollector(doc);
lvlCollector.OfClass(typeof(Level)).ToElements().OfType<Level>();
// Determine what kind of object we're creating.
RevitObject ro = revitObjects[0];
#region Normal Origin based Family Instance
if (ro.Origin != null)
{
// Find the FamilySymbol
FamilySymbol symbol = FindFamilySymbol(ro.FamilyName, ro.TypeName, doc);
LevelType lt = FindLevelType(ro.TypeName, doc);
if (symbol != null || lt != null)
{
// Get the hosting ID from the family.
Family fam = null;
Parameter hostParam = null;
int hostBehavior = 0;
try
{
fam = symbol.Family;
hostParam = fam.get_Parameter(BuiltInParameter.FAMILY_HOSTING_BEHAVIOR);
hostBehavior = hostParam.AsInteger();
}
catch{}
using (Transaction t = new Transaction(doc, "Lyrebird Create Objects"))
{
t.Start();
try
{
// Create the Schema for the instances to store the GH Component InstanceGUID and the path
Schema instanceSchema = null;
try
{
instanceSchema = Schema.Lookup(instanceSchemaGUID);
}
catch (Exception ex)
{
Debug.WriteLine(ex.Message);
}
if (instanceSchema == null)
{
SchemaBuilder sb = new SchemaBuilder(instanceSchemaGUID);
sb.SetWriteAccessLevel(AccessLevel.Vendor);
sb.SetReadAccessLevel(AccessLevel.Public);
sb.SetVendorId("LMNA");
// Create the field to store the data in the family
FieldBuilder guidFB = sb.AddSimpleField("InstanceID", typeof(string));
guidFB.SetDocumentation("Component instance GUID from Grasshopper");
// Create a filed to store the run number
FieldBuilder runIDFB = sb.AddSimpleField("RunID", typeof(int));
runIDFB.SetDocumentation("RunID for when multiple runs are created from the same data");
// Create a field to store the GH component nickname.
FieldBuilder nickNameFB = sb.AddSimpleField("NickName", typeof(string));
nickNameFB.SetDocumentation("Component NickName from Grasshopper");
sb.SetSchemaName("LMNAInstanceGUID");
instanceSchema = sb.Finish();
}
FamilyInstance fi = null;
XYZ origin = XYZ.Zero;
if (lt != null)
{
// Create a level for the object.
foreach (RevitObject obj in revitObjects)
{
try
{
Level lvl = doc.Create.NewLevel(UnitUtils.ConvertToInternalUnits(obj.Origin.Z, lengthDUT));
lvl.LevelType = lt;
// Set the parameters.
SetParameters(lvl, obj.Parameters, doc);
// Assign the GH InstanceGuid
AssignGuid(lvl, uniqueId, instanceSchema, runId, nickName);
}
catch { }
}
}
else if (hostBehavior == 0)
{
int x = 0;
foreach (RevitObject obj in revitObjects)
{
try
{
List<LyrebirdPoint> originPts = new List<LyrebirdPoint>();
Level lvl = GetLevel(originPts, doc);
//.........这里部分代码省略.........
示例9: UpdateInitialParameters
// Setup routine: updates parameters of the window to the appropriate values on load
internal void UpdateInitialParameters(Document doc)
{
Transaction t = new Transaction(doc, "Update parameters");
t.Start();
SchemaBuilder builder = new SchemaBuilder(m_schemaId); //(new Guid("{4DE4BE80-0857-4785-A7DF-8A8918851CB2}"));
builder.AddSimpleField("Position", typeof(XYZ)).SetUnitType(UnitType.UT_Length);
builder.AddSimpleField("Orientation", typeof(XYZ)).SetUnitType(UnitType.UT_Length);
builder.SetSchemaName("WallPositionData");
builder.SetDocumentation("Two points in a Window element that assist in placing a section view.");
builder.SetVendorId("adsk");
builder.SetApplicationGUID(doc.Application.ActiveAddInId.GetGUID());
m_schema = builder.Finish();
t.Commit();
t.Start();
Field fieldPosition = m_schema.GetField("Position");
Field fieldOrientation = m_schema.GetField("Orientation");
FamilyInstance window = doc.get_Element(m_windowId) as FamilyInstance;
Entity storageEntity = new Entity(m_schema);
LocationPoint lp = window.Location as LocationPoint;
XYZ location = lp.Point;
storageEntity.Set<XYZ>(fieldPosition, location, DisplayUnitType.DUT_FEET_FRACTIONAL_INCHES);
XYZ orientation = window.FacingOrientation;
storageEntity.Set<XYZ>(fieldOrientation, orientation, DisplayUnitType.DUT_FEET_FRACTIONAL_INCHES);
window.SetEntity(storageEntity);
t.Commit();
}
示例10: 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)
{
if (m_schema == null)
{
m_schema = Schema.Lookup(s_schemaId);
}
// 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_schema == null)
return;
if (m_schema == null)
{
SchemaBuilder builder = new SchemaBuilder(s_schemaId);
builder.SetSchemaName("IFCExportConfiguration");
builder.AddSimpleField(s_setupName, typeof(String));
builder.AddSimpleField(s_setupDescription, typeof(String));
builder.AddSimpleField(s_setupVersion, typeof(int));
builder.AddSimpleField(s_setupFileFormat, typeof(int));
builder.AddSimpleField(s_setupSpaceBoundaries, typeof(int));
builder.AddSimpleField(s_setupQTO, typeof(bool));
builder.AddSimpleField(s_splitWallsAndColumns, typeof(bool));
builder.AddSimpleField(s_setupCurrentView, typeof(bool));
builder.AddSimpleField(s_setupExport2D, typeof(bool));
builder.AddSimpleField(s_setupExportRevitProps, typeof(bool));
builder.AddSimpleField(s_setupUse2DForRoomVolume, typeof(bool));
builder.AddSimpleField(s_setupUseFamilyAndTypeName, typeof(bool));
builder.AddSimpleField(s_setupExportPartsAsBuildingElements, typeof(bool));
m_schema = 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);
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 entity = new Entity(m_schema);
entity.Set(s_setupName, configuration.Name);
entity.Set(s_setupDescription, configuration.Description);
entity.Set(s_setupVersion, (int)configuration.IFCVersion);
entity.Set(s_setupFileFormat, (int)configuration.IFCFileType);
entity.Set(s_setupSpaceBoundaries, configuration.SpaceBoundaries);
entity.Set(s_setupQTO, configuration.ExportBaseQuantities);
entity.Set(s_setupCurrentView, configuration.VisibleElementsOfCurrentView);
entity.Set(s_splitWallsAndColumns, configuration.SplitWallsAndColumns);
entity.Set(s_setupExport2D, configuration.Export2DElements);
entity.Set(s_setupExportRevitProps, configuration.ExportInternalRevitPropertySets);
entity.Set(s_setupUse2DForRoomVolume, configuration.Use2DRoomBoundaryForVolume);
entity.Set(s_setupUseFamilyAndTypeName, configuration.UseFamilyAndTypeNameForReference);
entity.Set(s_setupExportPartsAsBuildingElements, configuration.ExportPartsAsBuildingElements);
configStorage.SetEntity(entity);
}
List<ElementId> elementsToDelete = new List<ElementId>();
for (; savedConfigurationIndex < savedConfigurationCount; savedConfigurationIndex++)
{
DataStorage configStorage = savedConfigurations[savedConfigurationIndex];
elementsToDelete.Add(configStorage.Id);
}
if (elementsToDelete.Count > 0)
document.Delete(elementsToDelete);
transaction.Commit();
//.........这里部分代码省略.........
示例11: InitializeSchema
/// <summary>
/// Retrieve our extensible storage schema
/// or optionally create a new one if it does
/// not yet exist.
/// </summary>
public static Schema InitializeSchema(
bool create = true)
{
Schema schema = Schema.Lookup(SchemaGuid);
if (create && null == schema)
{
SchemaBuilder schemaBuilder =
new SchemaBuilder(SchemaGuid);
schemaBuilder.SetSchemaName(
"SlackitSettings");
schemaBuilder.SetReadAccessLevel(AccessLevel.Public);
schemaBuilder.SetWriteAccessLevel(AccessLevel.Public);
schemaBuilder.AddSimpleField(
"slackOn", typeof(Boolean));
schemaBuilder.AddSimpleField(
"slackWSWarn", typeof(Boolean));
schemaBuilder.AddSimpleField(
"slackModelWarn", typeof(Boolean));
schemaBuilder.AddSimpleField(
"slackBPWarn", typeof(Boolean));
schemaBuilder.AddSimpleField(
"slackWSInfo", typeof(Boolean));
schemaBuilder.AddSimpleField(
"slackModelInfo", typeof(Boolean));
schemaBuilder.AddSimpleField(
"slackBPInfo", typeof(Boolean));
schemaBuilder.AddSimpleField(
"slackExtraTrackPin", typeof(Boolean));
schemaBuilder.AddSimpleField(
"giphySet", typeof(int));
schemaBuilder.AddSimpleField(
"tidySet", typeof(int));
schemaBuilder.AddSimpleField(
"slackToken", typeof(String));
schemaBuilder.AddSimpleField(
"slackCh", typeof(String));
schemaBuilder.AddSimpleField(
"slackChId", typeof(String));
schema = schemaBuilder.Finish();
}
return schema;
}
示例12: 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());
//.........这里部分代码省略.........
示例13: 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());
//.........这里部分代码省略.........
示例14: IFCClassificationMgr
/// <summary>
/// the IFC Classification Manager
/// </summary>
/// <param name="document">The document.</param>
public IFCClassificationMgr(Document document)
{
if (Schema == null)
{
SchemaBuilder classificationBuilder = new SchemaBuilder(s_schemaId);
classificationBuilder.SetSchemaName("IFCClassification");
classificationBuilder.AddSimpleField(s_ClassificationName, typeof(string));
classificationBuilder.AddSimpleField(s_ClassificationSource, typeof(string));
classificationBuilder.AddSimpleField(s_ClassificationEdition, typeof(string));
classificationBuilder.AddSimpleField(s_ClassificationEditionDate_Day, typeof(Int32));
classificationBuilder.AddSimpleField(s_ClassificationEditionDate_Month, typeof(Int32));
classificationBuilder.AddSimpleField(s_ClassificationEditionDate_Year, typeof(Int32));
classificationBuilder.AddSimpleField(s_ClassificationLocation, typeof(string));
classificationBuilder.AddSimpleField(s_ClassificationFieldName, typeof(string));
m_schema = classificationBuilder.Finish();
}
// Potentially delete obsolete schema.
if (SchemaV1 != null)
{
IList<IFCClassification> classifications;
bool hasOldClassifications = GetSavedClassifications(document, SchemaV1, out classifications);
if (hasOldClassifications)
{
Transaction transaction = new Transaction(document, "Upgrade saved IFC classification");
transaction.Start();
IList<DataStorage> oldSchemaData = GetClassificationInStorage(document, SchemaV1);
IList<ElementId> oldDataToDelete = new List<ElementId>();
foreach (DataStorage oldData in oldSchemaData)
{
Entity savedClassification = oldData.GetEntity(SchemaV1);
DataStorage classificationStorage = DataStorage.Create(document);
Entity entIFCClassification = new Entity(Schema);
string classificationName = savedClassification.Get<string>(s_ClassificationName);
if (classificationName != null) entIFCClassification.Set<string>(s_ClassificationName, classificationName);
string classificationSource = savedClassification.Get<string>(s_ClassificationSource);
if (classificationSource != null) entIFCClassification.Set<string>(s_ClassificationSource, classificationSource);
string classificationEdition = savedClassification.Get<string>(s_ClassificationEdition);
if (classificationEdition != null) entIFCClassification.Set<string>(s_ClassificationEdition, classificationEdition);
Int32 classificationEditionDateDay = savedClassification.Get<Int32>(s_ClassificationEditionDate_Day);
Int32 classificationEditionDateMonth = savedClassification.Get<Int32>(s_ClassificationEditionDate_Month);
Int32 classificationEditionDateYear = savedClassification.Get<Int32>(s_ClassificationEditionDate_Year);
entIFCClassification.Set<Int32>(s_ClassificationEditionDate_Day, classificationEditionDateDay);
entIFCClassification.Set<Int32>(s_ClassificationEditionDate_Month, classificationEditionDateMonth);
entIFCClassification.Set<Int32>(s_ClassificationEditionDate_Year, classificationEditionDateYear);
string classificationLocation = savedClassification.Get<string>(s_ClassificationLocation);
if (classificationLocation != null) entIFCClassification.Set<string>(s_ClassificationLocation, classificationLocation);
classificationStorage.SetEntity(entIFCClassification);
oldDataToDelete.Add(oldData.Id);
}
if (oldDataToDelete.Count > 0)
document.Delete(oldDataToDelete);
transaction.Commit();
}
}
}
示例15: GetStorageSchema
private Schema GetStorageSchema()
{
var bld = new SchemaBuilder(_schemaGuid);
bld.SetSchemaName("BimLibraryData");
bld.SetWriteAccessLevel(AccessLevel.Public);
bld.SetReadAccessLevel(AccessLevel.Public);
//bld.SetVendorId("ADSK");
bld.SetDocumentation("This schema stores project specific application data of Czech BIM Library.");
bld.AddSimpleField(FieldNameData, typeof(String)).SetDocumentation("Data field");
return bld.Finish();
}