当前位置: 首页>>代码示例>>C#>>正文


C# SchemaBuilder.AddSimpleField方法代码示例

本文整理汇总了C#中SchemaBuilder.AddSimpleField方法的典型用法代码示例。如果您正苦于以下问题:C# SchemaBuilder.AddSimpleField方法的具体用法?C# SchemaBuilder.AddSimpleField怎么用?C# SchemaBuilder.AddSimpleField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SchemaBuilder的用法示例。


在下文中一共展示了SchemaBuilder.AddSimpleField方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetOrCreateSchema

 public override Schema GetOrCreateSchema()
 {
     SchemaBuilder sb = new SchemaBuilder(SchemaGuid);
      sb.SetSchemaName(SchemaName);
      sb.AddSimpleField("someBool", typeof(bool));
      return sb.Finish();
 }
开发者ID:halad,项目名称:RevitLookup,代码行数:7,代码来源:EStorageBundle1.cs

示例2: 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;
 }
开发者ID:whztt07,项目名称:RevitCustomIFCexporter,代码行数:19,代码来源:IFCClassificationMgr.cs

示例3: 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();
     }
 }
开发者ID:whztt07,项目名称:RevitCustomIFCexporter,代码行数:23,代码来源:IFCClassificationMgr.cs

示例4: Execute

    public Result Execute(
      ExternalCommandData commandData,
      ref string message,
      ElementSet elements)
    {
      UIDocument uiDoc = commandData.Application.ActiveUIDocument;
      Document doc = uiDoc.Document;

      // Create transaction for working with schema

      Transaction trans = new Transaction(doc, "Extensible Storage");
      trans.Start();

      // Select a wall element

      Wall wall = null;

      try
      {
        Reference r = uiDoc.Selection.PickObject(ObjectType.Element,
          new WallSelectionFilter());

        wall = doc.GetElement(r) as Wall;
      }
      catch (Autodesk.Revit.Exceptions.OperationCanceledException)
      {
        message = "Nothing selected; please select a wall to attach extensible data to.";
        return Result.Failed;
      }

      Debug.Assert(null != wall, "expected a wall to be selected");

      if (null == wall)
      {
        message = "Please select a wall to attach extensible data to.";
        return Result.Failed;
      }

      // Create a schema builder

      SchemaBuilder builder = new SchemaBuilder(_guid);

      // Set read and write access levels

      builder.SetReadAccessLevel(AccessLevel.Public);
      builder.SetWriteAccessLevel(AccessLevel.Public);

      // Note: if this was set as vendor or application access, 
      // we would have been additionally required to use SetVendorId

      // Set name to this schema builder

      builder.SetSchemaName("WallSocketLocation");
      builder.SetDocumentation("Data store for socket related info in a wall");

      // Create field1

      FieldBuilder fieldBuilder1 =
        builder.AddSimpleField("SocketLocation", typeof(XYZ));

      // Set unit type

      fieldBuilder1.SetUnitType(UnitType.UT_Length);

      // Add documentation (optional)

      // Create field2

      FieldBuilder fieldBuilder2 =
        builder.AddSimpleField("SocketNumber", typeof(string));

      //fieldBuilder2.SetUnitType(UnitType.UT_Custom);

      // Register the schema object

      Schema schema = builder.Finish();

      // Create an entity (object) for this schema (class)

      Entity ent = new Entity(schema);
      Field socketLocation = schema.GetField("SocketLocation");
      ent.Set<XYZ>(socketLocation, new XYZ(2, 0, 0), DisplayUnitType.DUT_METERS);

      Field socketNumber = schema.GetField("SocketNumber");
      ent.Set<string>(socketNumber, "200");

      wall.SetEntity(ent);

      // Now create another entity (object) for this schema (class)

      Entity ent2 = new Entity(schema);
      Field socketNumber1 = schema.GetField("SocketNumber");
      ent2.Set<String>(socketNumber1, "400");
      wall.SetEntity(ent2);

      // Note: this will replace the previous entity on the wall 

      // List all schemas in the document

      string s = string.Empty;
//.........这里部分代码省略.........
开发者ID:vnoves,项目名称:RevitTrainingMaterial,代码行数:101,代码来源:6_ExtensibleStorage.cs

示例5: ModifyObjects

        private void ModifyObjects(List<RevitObject> existingObjects, List<ElementId> existingElems, Document doc, Guid uniqueId, bool profileWarning, string nickName, int runId)
        {
            // Create new Revit objects.
            //List<LyrebirdId> newUniqueIds = new List<LyrebirdId>();

            // Determine what kind of object we're creating.
            RevitObject ro = existingObjects[0];


            #region Normal Origin based FamilyInstance
            // Modify origin based family instances
            if (ro.Origin != null)
            {
                // Find the FamilySymbol
                FamilySymbol symbol = FindFamilySymbol(ro.FamilyName, ro.TypeName, doc);

                LevelType lt = FindLevelType(ro.TypeName, doc);

                GridType gt = FindGridType(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{}

                    //FamilyInstance existingInstance = doc.GetElement(existingElems[0]) as FamilyInstance;
                    
                    using (Transaction t = new Transaction(doc, "Lyrebird Modify Objects"))
                    {
                        t.Start();
                        try
                        {
                            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)
                            {
                                for (int i = 0; i < existingObjects.Count; i++)
                                {
                                    RevitObject obj = existingObjects[i];
                                    Level lvl = doc.GetElement(existingElems[i]) as Level;

                                    if (lvl.ProjectElevation != (UnitUtils.ConvertToInternalUnits(obj.Origin.Z, lengthDUT)))
                                    {
                                        double offset = lvl.Elevation - lvl.ProjectElevation;
                                        lvl.Elevation = (UnitUtils.ConvertToInternalUnits(obj.Origin.Z + offset, lengthDUT));
                                    }

                                    SetParameters(lvl, obj.Parameters, doc);
                                }
                            }
                            else if (hostBehavior == 0)
                            {

                                for (int i = 0; i < existingObjects.Count; i++)
                                {
                                    RevitObject obj = existingObjects[i];
                                    fi = doc.GetElement(existingElems[i]) as FamilyInstance;

                                    // Change the family and symbol if necessary
//.........这里部分代码省略.........
开发者ID:samuto,项目名称:Lyrebird,代码行数:101,代码来源:LyrebirdService.cs

示例6: 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);
//.........这里部分代码省略.........
开发者ID:samuto,项目名称:Lyrebird,代码行数:101,代码来源:LyrebirdService.cs

示例7: 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();
        }
开发者ID:AMEE,项目名称:revit,代码行数:37,代码来源:SectionUpdater.cs

示例8: 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();
//.........这里部分代码省略.........
开发者ID:whztt07,项目名称:BIM-IFC,代码行数:101,代码来源:IFCExportConfigurationsMap.cs

示例9: 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
        }
开发者ID:dannysbentley,项目名称:alignviewtosheetcell,代码行数:35,代码来源:SchemaAndStoreData.cs

示例10: 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();
                }
            }
        }
开发者ID:whztt07,项目名称:RevitCustomIFCexporter,代码行数:70,代码来源:IFCClassificationMgr.cs

示例11: 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();
        }
开发者ID:martin1cerny,项目名称:BIM-Library-CZ-Revit,代码行数:12,代码来源:ProjectSettingsManager.cs

示例12: 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;
            }
开发者ID:pix3lot,项目名称:Slackit,代码行数:65,代码来源:ExtensibleStorage.cs

示例13: GetSchema

            /// <summary>
            /// Retrieve our extensible storage schema 
            /// or optionally create a new one if it does
            /// not yet exist.
            /// </summary>
            public static Schema GetSchema(
                bool create = true)
            {
                Schema schema = Schema.Lookup( SchemaGuid );

                if( create && null == schema )
                {
                  SchemaBuilder schemaBuilder =
                new SchemaBuilder( SchemaGuid );

                  schemaBuilder.SetSchemaName(
                "JtNamedGuiStorage" );

                  schemaBuilder.AddSimpleField(
                "Guid", typeof( Guid ) );

                  schema = schemaBuilder.Finish();
                }
                return schema;
            }
开发者ID:jeremytammik,项目名称:the_building_coder_samples,代码行数:25,代码来源:JtNamedGuidStorage.cs


注:本文中的SchemaBuilder.AddSimpleField方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。