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


C# Element.LookupParameter方法代码示例

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


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

示例1: CreatePropertySets

        /// <summary>
        /// Create property sets for a given element.
        /// </summary>
        /// <param name="doc">The document.</param>
        /// <param name="element">The element being created.</param>
        /// <param name="propertySetsCreated">A concatenated string of property sets created, used to filter schedules.</returns>
        public override void CreatePropertySets(Document doc, Element element, string propertySetsCreated)
        {
            if (PropertySets != null && PropertySets.Count > 0)
            {
                IFCParameterSetByGroup parameterGroupMap = IFCParameterSetByGroup.Create(element);
                foreach (IFCPropertySetDefinition propertySet in PropertySets.Values)
                {
                    KeyValuePair<string, bool> newPropertySetCreated = propertySet.CreatePropertySet(doc, element, parameterGroupMap);
                    if (!newPropertySetCreated.Value || string.IsNullOrWhiteSpace(newPropertySetCreated.Key))
                        continue;

                    if (propertySetsCreated == null)
                        propertySetsCreated = newPropertySetCreated.Key;
                    else
                        propertySetsCreated += ";" + newPropertySetCreated.Key;
                }
                Parameter propertySetList = element.LookupParameter("Type IfcPropertySetList");
                if (propertySetList != null)
                    propertySetList.Set(propertySetsCreated);
            }
        }
开发者ID:whztt07,项目名称:RevitCustomIFCexporter,代码行数:27,代码来源:IFCTypeObject.cs

示例2: RetrieveParameter

    /// <summary>
    /// Examples of retrieving a specific parameter indivisually 
    /// (hard coded for simplicity; This function works best 
    /// with walls and doors).
    /// </summary>
    public void RetrieveParameter(Element e, string header)
    {
      string s = string.Empty;

      // As an experiment, let's pick up some arbitrary parameters. 
      // Comments - most of instance has this parameter 

      // (1) by BuiltInParameter. 
      Parameter param = e.get_Parameter(BuiltInParameter.ALL_MODEL_INSTANCE_COMMENTS);
      if (param != null)
      {
        s += "Comments (by BuiltInParameter) = " + ParameterToString(param) + "\n";
      }

      // (2) by name. (Mark - most of instance has this parameter.) if you use this method, it will language specific. 
      // param = e.get_Parameter("Mark");

      // 'Autodesk.Revit.DB.Element.get_Parameter(string)' is obsolete: 
      // 'This property is obsolete in Revit 2015, as more than one parameter can have the same name on a given element. 
      // Use Element.Parameters to obtain a complete list of parameters on this Element, 
      // or Element.GetParameters(String) to get a list of all parameters by name, 
      // or Element.LookupParameter(String) to return the first available parameter with the given name.'
      //
      //

      param = e.LookupParameter("Mark");
      if (param != null)
      {
        s += "Mark (by Name) = " + ParameterToString(param) + "\n";
      }
      



      // Though the first one is the most commonly used, other possible methods are: 
      // (3) by definition 
      // param = e.Parameter(Definition) 
      // (4) and for shared parameters, you can also use GUID. 
      // parameter = Parameter(GUID) 

      // The following should be in most of type parameter 

      param = e.get_Parameter(BuiltInParameter.ALL_MODEL_TYPE_COMMENTS);
      if (param != null)
      {
        s += "Type Comments (by BuiltInParameter) = " + ParameterToString(param) + "\n";
      }

      //param = e.get_Parameter("Fire Rating"); // Autodesk.Revit.DB.Element.get_Parameter(string)' is obsolete in 2015


      param = e.LookupParameter("Fire Rating");

      if (param != null)
      {
        s += "Fire Rating (by Name) = " + ParameterToString(param) + "\n";
      }

      // Using the BuiltInParameter, you can sometimes access one that is not in the parameters set. 
      // Note: this works only for element type. 

      param = e.get_Parameter(BuiltInParameter.SYMBOL_FAMILY_AND_TYPE_NAMES_PARAM);
      if (param != null)
      {
        s += "SYMBOL_FAMILY_AND_TYPE_NAMES_PARAM (only by BuiltInParameter) = " 
            + ParameterToString(param) + "\n";
      }

      param = e.get_Parameter(BuiltInParameter.SYMBOL_FAMILY_NAME_PARAM);
      if (param != null)
      {
        s += "SYMBOL_FAMILY_NAME_PARAM (only by BuiltInParameter) = " 
            + ParameterToString(param) + "\n";
      }

      // Show it. 

      TaskDialog.Show(header, s);
    }
开发者ID:FlintSable,项目名称:RevitTrainingMaterial,代码行数:84,代码来源:2_DbElement.cs

示例3: SetParameters

        /// <summary>
        /// Sets Parameter Values
        /// </summary>
        /// <param name="component"></param>
        /// <param name="element">The Element to apply parameters to</param>
        public static void SetParameters(this Grevit.Types.Component component, Element element)
        {
            if (element != null)
            {
                if (component.parameters != null)
                {
                    foreach (Grevit.Types.Parameter componentParameter in component.parameters)
                    {
                        int iid;
                        Autodesk.Revit.DB.Parameter elementParameter = null;

                        if (int.TryParse(componentParameter.name, out iid))
                        {
                            foreach (Autodesk.Revit.DB.Parameter p in element.Parameters) if (p.Id.IntegerValue == iid) elementParameter = p;
                        }
                        else elementParameter = element.LookupParameter(componentParameter.name);

                        if (elementParameter != null)
                        {
                            switch (elementParameter.StorageType)
                            {
                                case StorageType.Double:
                                    if (componentParameter.value.GetType() == typeof(double)) elementParameter.Set((double)componentParameter.value);
                                    break;

                                case StorageType.Integer:
                                    if (componentParameter.value.GetType() == typeof(int)) elementParameter.Set((int)componentParameter.value);
                                    break;

                                case StorageType.String:
                                    if (componentParameter.value.GetType() == typeof(string)) elementParameter.Set((string)componentParameter.value);
                                    break;
                                case StorageType.ElementId:
                                    if (componentParameter.value.GetType() == typeof(Grevit.Types.ElementID))
                                    {
                                        Grevit.Types.ElementID grvid = (Grevit.Types.ElementID)componentParameter.value;
                                        ElementId id = new ElementId(grvid.ID);
                                        if (GrevitBuildModel.document.GetElement(id) != null) elementParameter.Set(id);
                                    }
                                    else if (componentParameter.value.GetType() == typeof(Grevit.Types.SearchElementID))
                                    {
                                        Grevit.Types.SearchElementID grvid = (Grevit.Types.SearchElementID)componentParameter.value;
                                        Element e = GrevitBuildModel.document.GetElementByName(grvid.Name);
                                        if (e != null) elementParameter.Set(e.Id);
                                    }

                                    break;


                            }

                        }
                    }
                }


                Autodesk.Revit.DB.Parameter grevitIdParameter = element.LookupParameter("GID");
                
                if (grevitIdParameter == null)
                {
                    GrevitBuildModel.document.GrevitAddSharedParameter();
                    grevitIdParameter = element.LookupParameter("GID");
                }
                
                if (grevitIdParameter != null && !grevitIdParameter.IsReadOnly) grevitIdParameter.Set(component.GID);
                
            }
        }
开发者ID:samuto,项目名称:Grevit,代码行数:73,代码来源:ParameterExtension.cs

示例4: CreatePropertySets

        /// <summary>
        /// Create property sets for a given element.
        /// </summary>
        /// <param name="doc">The document.</param>
        /// <param name="element">The element being created.</param>
        /// <param name="propertySetsCreated">A concatenated string of property sets created, used to filter schedules.</returns>
        public override void CreatePropertySets(Document doc, Element element, string propertySetsCreated)
        {
            if (PropertySets != null && PropertySets.Count > 0)
            {
                IFCParameterSetByGroup parameterGroupMap = IFCParameterSetByGroup.Create(element);
                foreach (IFCPropertySetDefinition propertySet in PropertySets.Values)
                {
                    string newPropertySetCreated = propertySet.CreatePropertySet(doc, element, parameterGroupMap);
                    if (propertySetsCreated == null)
                        propertySetsCreated = newPropertySetCreated;
                    else
                        propertySetsCreated += ";" + newPropertySetCreated;
                }

                Parameter propertySetList = element.LookupParameter("IfcPropertySetList");
                if (propertySetList != null)
                    propertySetList.Set(propertySetsCreated);
            }
        }
开发者ID:whztt07,项目名称:RevitIFC,代码行数:25,代码来源:IFCObject.cs

示例5: GetElementOrientationParameter

 /// <summary>
 /// Orientation Parameter
 /// </summary>
 /// <param name="e"></param>
 /// <returns></returns>
 internal static Parameter GetElementOrientationParameter(Element e)
 {
     Parameter p = e.LookupParameter("CurveOrientation");
     return p;
 }
开发者ID:WeConnect,项目名称:case-apps,代码行数:10,代码来源:clsUtil.cs


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