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


C# Element.get_Parameter方法代码示例

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


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

示例1: LightFixture

        /// <summary>
        /// Default Constructor
        /// </summary>
        /// <param name="e">Accepts generic element (after processing) as input</param>
        public LightFixture(Element e, FamilyInstance fi)
        {
            // Set properties initially based on passed FamilyInstance
            CandlePower = e.get_Parameter(BuiltInParameter.FBX_LIGHT_LIMUNOUS_INTENSITY).AsDouble();
            Lumens = e.get_Parameter(BuiltInParameter.FBX_LIGHT_LIMUNOUS_FLUX).AsDouble();
            Efficacy = e.get_Parameter(BuiltInParameter.FBX_LIGHT_EFFICACY).AsDouble();
            LightLossFactor = e.get_Parameter(BuiltInParameter.FBX_LIGHT_TOTAL_LIGHT_LOSS).AsDouble();
            CoefficientOfUtilization = e.get_Parameter(BuiltInParameter.RBS_ELEC_CALC_COEFFICIENT_UTILIZATION).AsDouble();

            Elevation = fi.get_Parameter(BuiltInParameter.INSTANCE_ELEVATION_PARAM).AsDouble();

            LocationPoint = fi.Location as LocationPoint;

            // Future
            // TODO: Get photometric file and parse IES to provide correct
        }
开发者ID:kmorin,项目名称:LightingAnalysis,代码行数:20,代码来源:LightFixture.cs

示例2: GetGUID

        /// <summary>
        /// Returns the IFC GUID associated with an element.
        /// </summary>
        /// <param name="elem">The element.</param>
        /// <returns>The string containing the GUID, or null if it doesn't exist.</returns>
        static public string GetGUID(Element elem)
        {
            BuiltInParameter paramId = (elem is ElementType) ? BuiltInParameter.IFC_TYPE_GUID : BuiltInParameter.IFC_GUID;
            Parameter param = elem.get_Parameter(paramId);
            if (param == null)
                return null;   // This Element was generated by other means.

            return param.AsString();
        }
开发者ID:whztt07,项目名称:RevitCustomIFCexporter,代码行数:14,代码来源:IFCGUIDUtil.cs

示例3: DoorData

        /// <summary>
        /// Constructor from BIM to serialise for
        /// the REST POST or PUT request.
        /// </summary>
        /// <param name="door"></param>
        /// <param name="project_id"></param>
        /// <param name="paramGuid"></param>
        public DoorData(
            Element door,
            string project_id_arg,
            Guid paramGuid)
        {
            Document doc = door.Document;

              _id = door.UniqueId;

              project_id = project_id_arg;

              level = doc.GetElement( door.LevelId ).Name;

              tag = door.get_Parameter(
            BuiltInParameter.ALL_MODEL_MARK ).AsString();

              firerating = door.get_Parameter( paramGuid )
            .AsDouble();
        }
开发者ID:jaimerosales,项目名称:FireRatingCloud,代码行数:26,代码来源:DoorData.cs

示例4: DoorData

        /// <summary>
        /// DoorData constructor to generate the data to
        /// serialise for the REST POST or PUT request.
        /// </summary>
        public DoorData(
            Element door,
            string project_id_arg,
            Guid paramGuid,
            uint timestamp)
        {
            Document doc = door.Document;

              _id = door.UniqueId;

              project_id = project_id_arg;

              level = doc.GetElement( door.LevelId ).Name;

              tag = door.get_Parameter( BipMark ).AsString();

              firerating = door.get_Parameter( paramGuid )
            .AsDouble();

              modified = timestamp;
        }
开发者ID:jeremytammik,项目名称:FireRatingCloud,代码行数:25,代码来源:DoorData.cs

示例5: Calculate

        /// <summary>
        /// Calculates slope for a ramp flight.
        /// </summary>
        /// <param name="exporterIFC">The ExporterIFC object.</param>
        /// <param name="extrusionCreationData">The IFCExtrusionCreationData.</param>
        /// <param name="element">The element to calculate the value.</param>
        /// <param name="elementType">The element type.</param>
        /// <returns>True if the operation succeed, false otherwise.</returns>
        public override bool Calculate(ExporterIFC exporterIFC, IFCExtrusionCreationData extrusionCreationData, Element element, ElementType elementType)
        {
            if (element == null)
                return false;

            Parameter parameter = element.get_Parameter(BuiltInParameter.RAMP_ATTR_MIN_INV_SLOPE);

            if (parameter != null && parameter.HasValue && parameter.StorageType == StorageType.Double)
            {
                m_Slope = parameter.AsDouble();
                if (!MathUtil.IsAlmostZero(m_Slope))
                {
                    m_Slope = Math.Atan(m_Slope) * 180 / Math.PI; // ratio -> radians -> degrees
                    return true;
                }
            }

            return false;
        }
开发者ID:whztt07,项目名称:BIM-IFC,代码行数:27,代码来源:RampFlightSlopeCalculator.cs

示例6: BumpOccupancy

        /// <summary>
        /// Read the value of the element ROOM_OCCUPANCY parameter.
        /// If it ends in a number, increment the number, else append "1".
        /// </summary>
        static void BumpOccupancy( Element e )
        {
            Parameter p = e.get_Parameter(
            BuiltInParameter.ROOM_OCCUPANCY );

              if( null == p )
              {
            Debug.Print(
              "{0} has no room occupancy parameter.",
              Util.ElementDescription( e ) );
              }
              else
              {
            string occupancy = p.AsString();

            string newOccupancy = BumpStringSuffix(
              occupancy );

            p.Set( newOccupancy );
              }
        }
开发者ID:nbright,项目名称:the_building_coder_samples,代码行数:25,代码来源:CmdSetRoomOccupancy.cs

示例7: getParam

 private static Value getParam(Element fi, string paramName)
 {
     var p = fi.get_Parameter(paramName);
     if (p != null)
     {
         return _getParam(p);
     }
     throw new Exception("Parameter \"" + paramName + "\" was not found!");
 }
开发者ID:parchjs,项目名称:Dynamo,代码行数:9,代码来源:FamilyInstance.cs

示例8: SetDescription

 /// <summary>
 /// Add a parameter "IfcDescription" to an element containing the description of the generating entity. 
 /// If the element has the built-in parameter ALL_MODEL_DESCRIPTION, populate that also.
 /// </summary>
 /// <param name="doc">The document.</param>
 /// <param name="element">The created parameter.</param>
 private void SetDescription(Document doc, Element element)
 {
    // If the element has the built-in ALL_MODEL_DESCRIPTION parameter, populate that also.
    // We will create/populate the parameter even if the description is empty or null.
    string description = string.IsNullOrWhiteSpace(Description) ? "" : Description;
    Parameter descriptionParameter = element.get_Parameter(BuiltInParameter.ALL_MODEL_DESCRIPTION);
    if (descriptionParameter != null)
       descriptionParameter.SetValueString(description);
    IFCPropertySet.AddParameterString(doc, element, this, IFCSharedParameters.IfcDescription, description, Id);
 }
开发者ID:whztt07,项目名称:RevitCustomIFCexporter,代码行数:16,代码来源:IFCObjectDefinition.cs

示例9: CreateParametersInternal

      protected virtual void CreateParametersInternal(Document doc, Element element)
      {
         if (element != null)
         {
            // Set the element name.
            SetName(doc, element);

            // Set the element description.
            SetDescription(doc, element);

            // The list of materials.
            SetMaterialParameter(doc, element);

            // Set the "IfcSystem" parameter.
            SetSystemParameter(doc, element);

            // Set the element GUID.
            bool elementIsType = (element is ElementType);
            BuiltInParameter ifcGUIDId = GetGUIDParameter(element, elementIsType);
            Parameter guidParam = element.get_Parameter(ifcGUIDId);
            if (guidParam != null && !guidParam.IsReadOnly)
               guidParam.Set(GlobalId);
            else
               ExporterIFCUtils.AddValueString(element, new ElementId(ifcGUIDId), GlobalId);

            // Set the "IfcExportAs" parameter.
            string ifcExportAs = IFCCategoryUtil.GetCustomCategoryName(this);
            if (!string.IsNullOrWhiteSpace(ifcExportAs))
               IFCPropertySet.AddParameterString(doc, element, "IfcExportAs", ifcExportAs, Id);

            // Add property set-based parameters.
            // We are going to create this "fake" parameter so that we can filter elements in schedules based on their property sets.
            string propertySetListName = elementIsType ? "Type IfcPropertySetList" : "IfcPropertySetList";
            IFCPropertySet.AddParameterString(doc, element, propertySetListName, "", Id);

            // Set the IFCElementAssembly Parameter
            if (Decomposes != null && Decomposes is IFCElementAssembly)
            {
               IFCPropertySet.AddParameterString(doc, element, "IfcElementAssembly", Decomposes.Name, Id);
            }
         }
      }
开发者ID:whztt07,项目名称:RevitCustomIFCexporter,代码行数:42,代码来源:IFCObjectDefinition.cs

示例10: SheetDescription

    /// <summary>
    /// Return a string describing the given sheet:
    /// sheet number and name.
    /// </summary>
    public static string SheetDescription(
      Element e )
    {
      string sheet_number = e.get_Parameter(
        BuiltInParameter.SHEET_NUMBER )
          .AsString();

      return string.Format( "{0} - {1}",
        sheet_number, e.Name );
    }
开发者ID:mtumminello,项目名称:RoomEditorApp,代码行数:14,代码来源:Util.cs

示例11: GetBaseLevelIdForElement

      public static ElementId GetBaseLevelIdForElement(Element elem)
      {
         if (elem.ViewSpecific)
         {
            ElementId viewId = elem.OwnerViewId;
            ElementId viewSpecificlevelId;
            if (ExporterCacheManager.DBViewsToExport.TryGetValue(viewId, out viewSpecificlevelId))
               return viewSpecificlevelId;
         }

         Parameter levelParameter = null;
         if (elem is FamilyInstance)
         {
            // If this is a nested family, check the top-level instance for the level parameter information.
            Element elemToCheck = (elem as FamilyInstance).SuperComponent;
            if (elemToCheck == null)
               elemToCheck = elem;

            // There are two Family-related parameters: INSTANCE_SCHEDULE_ONLY_LEVEL_PARAM and INSTANCE_SCHEDULE_ONLY_LEVEL_PARAM.
            // We prioritize INSTANCE_SCHEDULE_ONLY_LEVEL_PARAM over INSTANCE_SCHEDULE_ONLY_LEVEL_PARAM.
            levelParameter = elemToCheck.get_Parameter(BuiltInParameter.INSTANCE_SCHEDULE_ONLY_LEVEL_PARAM);
            if (levelParameter != null && levelParameter.StorageType == StorageType.ElementId)
            {
               ElementId levelId = levelParameter.AsElementId();
               if (levelId != ElementId.InvalidElementId)
                  return levelId;
            }

            levelParameter = elemToCheck.get_Parameter(BuiltInParameter.INSTANCE_REFERENCE_LEVEL_PARAM);
         }
         else if (elem is Truss)
            levelParameter = elem.get_Parameter(BuiltInParameter.TRUSS_ELEMENT_REFERENCE_LEVEL_PARAM);
         else if (elem is Stairs || StairsExporter.IsLegacyStairs(elem))
            levelParameter = elem.get_Parameter(BuiltInParameter.STAIRS_BASE_LEVEL_PARAM);
         else if (elem is ExtrusionRoof)
            levelParameter = elem.get_Parameter(BuiltInParameter.ROOF_CONSTRAINT_LEVEL_PARAM);

         if (levelParameter != null && levelParameter.StorageType == StorageType.ElementId)
            return levelParameter.AsElementId();
         else
            return elem.LevelId;
      }
开发者ID:whztt07,项目名称:RevitCustomIFCexporter,代码行数:42,代码来源:PlacementSetter.cs

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

示例13: GetParameterValueString

        ///
        /// Return a string value for the specified
        /// built-in parameter if it is available on
        /// the given element, else an empty string.
        ///
        string GetParameterValueString(
            Element e,
            BuiltInParameter bip)
        {
            Parameter p = e.get_Parameter( bip );

              string s = string.Empty;

              if( null != p )
              {
            switch( p.StorageType )
            {
              case StorageType.Integer:
            s = p.AsInteger().ToString();
            break;

              case StorageType.ElementId:
            s = p.AsElementId().IntegerValue.ToString();
            break;

              case StorageType.Double:
            s = Util.RealString( p.AsDouble() );
            break;

              case StorageType.String:
            s = string.Format( "{0} ({1})",
              p.AsValueString(),
              Util.RealString( p.AsDouble() ) );
            break;

              default: s = "";
            break;
            }
            s = ", " + bip.ToString() + "=" + s;
              }
              return s;
        }
开发者ID:JesseMom,项目名称:the_building_coder_samples,代码行数:42,代码来源:CmdSheetSize.cs

示例14: GetDoorData

    /// <summary>
    /// Retrieve the door instance data to store in 
    /// the external database and return it as a
    /// dictionary-like object. 
    /// Obsolete, replaced by DoorData constructor.
    /// </summary>
    object GetDoorData(
      Element door,
      string project_id,
      Guid paramGuid )
    {
      Document doc = door.Document;

      string levelName = doc.GetElement(
        door.LevelId ).Name;

      string tagValue = door.get_Parameter(
        BuiltInParameter.ALL_MODEL_MARK ).AsString();

      double fireratingValue = door.get_Parameter(
        paramGuid ).AsDouble();

      object data = new
      {
        _id = door.UniqueId,
        project_id = project_id,
        level = levelName,
        tag = tagValue,
        firerating = fireratingValue
      };

      return data;
    }
开发者ID:jeremytammik,项目名称:FireRatingCloud,代码行数:33,代码来源:Cmd_2a_ExportSharedParameterValues.cs

示例15: SetParaInt

        /// <summary>
        /// set certain parameter of given element to int value
        /// </summary>
        /// <param name="elem">given element</param>
        /// <param name="paraIndex">BuiltInParameter</param>
        /// <param name="value"></param>
        /// <returns></returns>
        public static bool SetParaInt(Element elem, BuiltInParameter paraIndex, int value)
        {
            Parameter para = elem.get_Parameter(paraIndex);
            if (null == para)
            {
                return false;
            }

            if (!para.IsReadOnly)
            {
                para.Set(value);
                return true;
            }

            return false;
        }
开发者ID:AMEE,项目名称:revit,代码行数:23,代码来源:ParameterUtil.cs


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