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


C# Schema.GetField方法代码示例

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


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

示例1: 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

示例2: AssignGuid

 private void AssignGuid(Grid grid, Guid guid, Schema instanceSchema, int run, string nickName)
 {
     Entity entity = null;
     try
     {
         entity = grid.GetEntity(instanceSchema);
     }
     catch (Exception ex)
     {
         Debug.Write("Error", ex.Message);
     }
     try
     {
         if (!entity.IsValid())
         {
             entity = new Entity(instanceSchema);
         }
         Field field = instanceSchema.GetField("InstanceID");
         entity.Set<string>(field, guid.ToString());
         field = instanceSchema.GetField("RunID");
         entity.Set<int>(field, run);
         field = instanceSchema.GetField("NickName");
         entity.Set<string>(field, nickName);
         grid.SetEntity(entity);
     }
     catch (Exception ex)
     {
         TaskDialog.Show("Error", ex.Message);
     }
 }
开发者ID:samuto,项目名称:Lyrebird,代码行数:30,代码来源:LyrebirdService.cs

示例3: GetSavedClassifications

        /// <summary>
        /// Get the List of Classifications saved in the Extensible Storage
        /// </summary>
        /// <param name="document">The document.</param>
        /// <param name="schema">The schema.  If null is passed in, the default schema is used.</param>
        /// <param name="classifications">The list of classifications.</param>
        /// <returns>True if any classifications were found.<returns>
        public static bool GetSavedClassifications(Document document, Schema schema, out IList<IFCClassification> classifications)
        {
            IList<IFCClassification> ifcClassificationSaved = new List<IFCClassification>();
            Boolean ret = false;

            if (schema == null)
                schema = GetSchema();

            if (schema != null)
            {
                Schema schemaV1 = GetSchemaV1();

                // This section handles multiple definitions of Classifications, but at the moment not in the UI
                IList<DataStorage> classificationStorage = GetClassificationInStorage(document, schema);

                for (int noClass = 0; noClass < classificationStorage.Count; noClass++)
                {
                    Entity savedClassification = classificationStorage[noClass].GetEntity(schema);

                    ifcClassificationSaved.Add(new IFCClassification());

                    ifcClassificationSaved[noClass].ClassificationName = savedClassification.Get<string>(schema.GetField(s_ClassificationName));
                    ifcClassificationSaved[noClass].ClassificationSource = savedClassification.Get<string>(schema.GetField(s_ClassificationSource));
                    ifcClassificationSaved[noClass].ClassificationEdition = savedClassification.Get<string>(schema.GetField(s_ClassificationEdition));

                    Int32 cldateDay = savedClassification.Get<Int32>(schema.GetField(s_ClassificationEditionDate_Day));
                    Int32 cldateMonth = savedClassification.Get<Int32>(schema.GetField(s_ClassificationEditionDate_Month));
                    Int32 cldateYear = savedClassification.Get<Int32>(schema.GetField(s_ClassificationEditionDate_Year));
                    try
                    {
                        ifcClassificationSaved[noClass].ClassificationEditionDate = new DateTime(cldateYear, cldateMonth, cldateDay);
                    }
                    catch
                    {
                        ifcClassificationSaved[noClass].ClassificationEditionDate = DateTime.Now;
                    }

                    ifcClassificationSaved[noClass].ClassificationLocation = savedClassification.Get<string>(schema.GetField(s_ClassificationLocation));
                    // Only for newest schema.
                    if (schemaV1 == null || (schema.GUID != schemaV1.GUID))
                        ifcClassificationSaved[noClass].ClassificationFieldName = savedClassification.Get<string>(schema.GetField(s_ClassificationFieldName));
                    ret = true;
                }
            }

            // Create at least one new Classification in the List, otherwise caller may fail
            if (ifcClassificationSaved.Count == 0)
                ifcClassificationSaved.Add(new IFCClassification());

            classifications = ifcClassificationSaved;
            return ret;
        }
开发者ID:whztt07,项目名称:RevitCustomIFCexporter,代码行数:59,代码来源:IFCClassificationMgr.cs


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