本文整理汇总了C#中BuiltInParameter类的典型用法代码示例。如果您正苦于以下问题:C# BuiltInParameter类的具体用法?C# BuiltInParameter怎么用?C# BuiltInParameter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BuiltInParameter类属于命名空间,在下文中一共展示了BuiltInParameter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CreateFilterRuleBuilder
/// <summary>
/// Convert FilterRule to our custom FilterRuleBuilder which will be displayed in form controls
/// </summary>
/// <param name="param">Parameter to which the FilterRule is applied.</param>
/// <param name="rule">FilterRule to be converted.</param>
/// <returns>Custom FilterRuleBuilder data converted from FilterRule</returns>
public static FilterRuleBuilder CreateFilterRuleBuilder(BuiltInParameter param, FilterRule rule)
{
// Maybe FilterRule is inverse rule, we need to find its inner rule(FilterValueRule)
// Note that the rule may be inversed more than once.
bool inverted = false;
FilterRule innerRule = ReflectToInnerRule(rule, out inverted);
if (innerRule is FilterStringRule)
{
FilterStringRule strRule = innerRule as FilterStringRule;
FilterStringRuleEvaluator evaluator = strRule.GetEvaluator();
return new FilterRuleBuilder(param, GetEvaluatorCriteriaName(evaluator, inverted), strRule.RuleString, strRule.CaseSensitive);
}
else if (innerRule is FilterDoubleRule)
{
FilterDoubleRule dbRule = innerRule as FilterDoubleRule;
FilterNumericRuleEvaluator evaluator = dbRule.GetEvaluator();
return new FilterRuleBuilder(param, GetEvaluatorCriteriaName(evaluator, inverted), dbRule.RuleValue, dbRule.Epsilon);
}
else if (innerRule is FilterIntegerRule)
{
FilterIntegerRule intRule = innerRule as FilterIntegerRule;
FilterNumericRuleEvaluator evaluator = intRule.GetEvaluator();
return new FilterRuleBuilder(param, GetEvaluatorCriteriaName(evaluator, inverted), intRule.RuleValue);
}
else if (innerRule is FilterElementIdRule)
{
FilterElementIdRule idRule = innerRule as FilterElementIdRule;
FilterNumericRuleEvaluator evaluator = idRule.GetEvaluator();
return new FilterRuleBuilder(param, GetEvaluatorCriteriaName(evaluator, inverted), idRule.RuleValue);
}
//
// for other rule, not supported yet
throw new System.NotImplementedException("The filter rule is not recognizable and supported yet!");
}
开发者ID:AMEE,项目名称:revit,代码行数:40,代码来源:FilterUtil.cs
示例2: ParameterData
public ParameterData(
BuiltInParameter bip,
Parameter parameter,
string valueStringOrElementDescription,
bool containedInCollection,
/*
* Edited by Chekalin Victor 13.12.2012
*/
string parameterName)
{
_enum = bip;
_parameter = parameter;
/*
* Edited by Chekalin Victor 13.12.2012
*/
_parameterName = parameterName;
ValueString = valueStringOrElementDescription;
Value = GetValue;
Definition d = _parameter.Definition;
ParameterGroup = d.ParameterGroup.ToString();
GroupName = LabelUtils.GetLabelFor(d.ParameterGroup);
ContainedInCollection = containedInCollection ? "Y" : "N";
}
开发者ID:jeremytammik,项目名称:BipChecker,代码行数:26,代码来源:ParameterData.cs
示例3: 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;
}
para.Set(value);
return true;
}
开发者ID:AMEE,项目名称:revit,代码行数:18,代码来源:ParameterUtil.cs
示例4: CreateFrequencyPropertyFromElementOrSymbol
/// <summary>
/// Create a Frequency measure property from the element's or type's parameter.
/// </summary>
/// <param name="file">The IFC file.</param>
/// <param name="exporterIFC">The ExporterIFC.</param>
/// <param name="elem">The Element.</param>
/// <param name="revitParameterName">The name of the parameter.</param>
/// <param name="revitBuiltInParam">The built in parameter to use, if revitParameterName isn't found.</param>
/// <param name="ifcPropertyName">The name of the property.</param>
/// <param name="valueType">The value type of the property.</param>
/// <returns>The created property handle.</returns>
public static IFCAnyHandle CreateFrequencyPropertyFromElementOrSymbol(IFCFile file, ExporterIFC exporterIFC, Element elem,
string revitParameterName, BuiltInParameter revitBuiltInParam, string ifcPropertyName, PropertyValueType valueType)
{
IFCAnyHandle propHnd = CreateFrequencyPropertyFromElement(file, exporterIFC, elem, revitParameterName, ifcPropertyName, valueType);
if (!IFCAnyHandleUtil.IsNullOrHasNoValue(propHnd))
return propHnd;
if (revitBuiltInParam != BuiltInParameter.INVALID)
{
string builtInParamName = LabelUtils.GetLabelFor(revitBuiltInParam);
propHnd = CreateFrequencyPropertyFromElement(file, exporterIFC, elem, builtInParamName, ifcPropertyName, valueType);
if (!IFCAnyHandleUtil.IsNullOrHasNoValue(propHnd))
return propHnd;
}
// For Symbol
Document document = elem.Document;
ElementId typeId = elem.GetTypeId();
Element elemType = document.GetElement(typeId);
if (elemType != null)
return CreateFrequencyPropertyFromElementOrSymbol(file, exporterIFC, elemType, revitParameterName, revitBuiltInParam, ifcPropertyName, valueType);
else
return null;
}
开发者ID:whztt07,项目名称:RevitIFC,代码行数:35,代码来源:FrequencyPropertyUtil.cs
示例5: SetParameter
/// <summary>
/// find a parameter according to the parameter's name
/// </summary>
/// <param name="element">the host object of the parameter</param>
/// <param name="paraIndex">parameter index</param>
/// <param name="value">the value of the parameter with Autodesk.Revit.DB.ElementId type</param>
/// <returns>if find the parameter return true</returns>
public static bool SetParameter(Element element,
BuiltInParameter paraIndex, ref Autodesk.Revit.DB.ElementId value)
{
Parameter parameter = element.get_Parameter(paraIndex);
if (null == parameter)
{
return false;
}
if (!parameter.IsReadOnly)
{
StorageType parameterType = parameter.StorageType;
if (StorageType.ElementId != parameterType)
{
throw new Exception("The types of value and parameter are different!");
}
parameter.Set(value);
return true;
}
return false;
}
开发者ID:AMEE,项目名称:revit,代码行数:29,代码来源:ParameterUtil.cs
示例6: GetProperty
/// <summary>
/// Get the room property value according the parameter name
/// </summary>
/// <param name="activeDoc">Current active document.</param>
/// <param name="room">an instance of room class</param>
/// <param name="paraEnum">the parameter used to get parameter value</param>
/// <param name="useValue">convert parameter to value type or not.
/// if true, the value of parameter will be with unit.
/// if false, the value of parameter will be without unit.</param>
/// <returns>the string value of property specified by shared parameter</returns>
public static String GetProperty(Document activeDoc, Room room, BuiltInParameter paraEnum, bool useValue)
{
String propertyValue = null; //the value of parameter
// Assuming the build in parameter is legal for room.
// if the room is not placed, some properties are not available, i.g. Level name, Area ...
// trying to retrieve them will throw exception;
// however some parameters are available, e.g.: name, number
Parameter param;
try
{
param = room.get_Parameter(paraEnum);
}
catch (Exception)
{
// throwing exception for this parameter is acceptable if it's a unplaced room
if (null == room.Location)
{
propertyValue = "Not Placed";
return propertyValue;
}
else
{
throw new Exception("Illegal built in parameter.");
}
}
// get the parameter via the built in parameter
if (null == param)
{
return "";
}
// get the parameter's storage type and convert parameter to string
StorageType storageType = param.StorageType;
switch (storageType)
{
case StorageType.Integer:
int iVal = param.AsInteger();
propertyValue = iVal.ToString();
break;
case StorageType.String:
propertyValue = param.AsString();
break;
case StorageType.Double:
// AsValueString will make the return string with unit, it's appreciated.
if (useValue)
{
propertyValue = param.AsValueString();
}
else
{
propertyValue = param.AsDouble().ToString();
}
break;
case StorageType.ElementId:
Autodesk.Revit.DB.ElementId elemId = param.AsElementId();
Element elem = activeDoc.get_Element(elemId);
propertyValue = elem.Name;
break;
default:
propertyValue = param.AsString();
break;
}
return propertyValue;
}
开发者ID:AMEE,项目名称:revit,代码行数:77,代码来源:RoomsData.cs
示例7: SetGUIDParameter
private void SetGUIDParameter(Element element, BuiltInParameter builtInParameter, string guidValue)
{
Parameter parameter = element.get_Parameter(builtInParameter);
if (parameter != null && parameter.HasValue && parameter.StorageType == StorageType.String)
{
parameter.SetValueString(guidValue);
}
else
{
ElementId parameterId = new ElementId(builtInParameter);
ExporterIFCUtils.AddValueString(element, parameterId, guidValue);
}
}
开发者ID:whztt07,项目名称:RevitCustomIFCexporter,代码行数:13,代码来源:IFCCommandOverrideApplication.cs
示例8: GetElementIdValueFromElementOrSymbol
/// <summary>
/// Gets element id value from parameter of an element or its element type.
/// </summary>
/// <param name="element">The element.</param>
/// <param name="builtInParameter">The built in parameter.</param>
/// <param name="propertyValue">The output property value.</param>
/// <returns>The parameter, or null if not found.</returns>
public static Parameter GetElementIdValueFromElementOrSymbol(Element element, BuiltInParameter builtInParameter, out ElementId propertyValue)
{
Parameter parameter = GetElementIdValueFromElement(element, builtInParameter, out propertyValue);
if (parameter != null)
return parameter;
Document document = element.Document;
ElementId typeId = element.GetTypeId();
Element elemType = document.GetElement(typeId);
if (elemType != null)
return GetElementIdValueFromElement(elemType, builtInParameter, out propertyValue);
return null;
}
开发者ID:whztt07,项目名称:RevitCustomIFCexporter,代码行数:22,代码来源:ParameterUtil.cs
示例9: SetStringParameter
/// <summary>
/// Sets string value of a built-in parameter of an element.
/// </summary>
/// <param name="element">The element.</param>
/// <param name="builtInParameter">The built-in parameter.</param>
/// <param name="propertyValue">The property value.</param>
/// <exception cref="System.ArgumentNullException">Thrown when element is null.</exception>
/// <exception cref="System.ArgumentException">Thrown when builtInParameter in invalid.</exception>
public static void SetStringParameter(Element element, BuiltInParameter builtInParameter, string propertyValue)
{
if (element == null)
throw new ArgumentNullException("element");
if (builtInParameter == BuiltInParameter.INVALID)
throw new ArgumentException("BuiltInParameter is INVALID", "builtInParameter");
Parameter parameter = element.get_Parameter(builtInParameter);
if (parameter != null && parameter.HasValue && parameter.StorageType == StorageType.String)
{
parameter.SetValueString(propertyValue);
return;
}
ElementId parameterId = new ElementId(builtInParameter);
ExporterIFCUtils.AddValueString(element, parameterId, propertyValue);
}
开发者ID:whztt07,项目名称:RevitCustomIFCexporter,代码行数:26,代码来源:ParameterUtil.cs
示例10: GetStringValueFromElement
/// <summary>
/// Gets string value from built-in parameter of an element.
/// </summary>
/// <param name="element">The element.</param>
/// <param name="builtInParameter">The built-in parameter.</param>
/// <param name="propertyValue">The output property value.</param>
/// <exception cref="System.ArgumentNullException">Thrown when element is null.</exception>
/// <exception cref="System.ArgumentException">Thrown when builtInParameter in invalid.</exception>
/// <returns>The parameter, or null if not found.</returns>
public static Parameter GetStringValueFromElement(Element element, BuiltInParameter builtInParameter, out string propertyValue)
{
if (element == null)
throw new ArgumentNullException("element");
if (builtInParameter == BuiltInParameter.INVALID)
throw new ArgumentException("BuiltInParameter is INVALID", "builtInParameter");
propertyValue = String.Empty;
Parameter parameter = element.get_Parameter(builtInParameter);
if (parameter != null && parameter.HasValue)
{
switch (parameter.StorageType)
{
case StorageType.Double:
propertyValue = parameter.AsDouble().ToString();
return parameter;
case StorageType.Integer:
propertyValue = parameter.AsInteger().ToString();
return parameter;
case StorageType.String:
propertyValue = parameter.AsString();
return parameter;
case StorageType.ElementId:
propertyValue = PropertyUtil.ElementIdParameterAsString(parameter);
return parameter;
}
}
return null;
}
开发者ID:whztt07,项目名称:RevitCustomIFCexporter,代码行数:41,代码来源:ParameterUtil.cs
示例11: ParameterAlreadyExist
/// <summary>
/// Check to see if rule for this parameter exists or not
/// </summary>
/// <param name="param">Parameter to be checked.</param>
/// <returns>True if this parameter already has filter rule, otherwise false.</returns>
bool ParameterAlreadyExist(BuiltInParameter param)
{
if (m_currentFilterData == null || m_currentFilterData.RuleData.Count == 0)
return false;
for (int ruleNo = 0; ruleNo < m_currentFilterData.RuleData.Count; ruleNo++)
{
if (m_currentFilterData.RuleData[ruleNo].Parameter == param)
return true;
}
return false;
}
开发者ID:AMEE,项目名称:revit,代码行数:16,代码来源:ViewFiltersForm.cs
示例12: FilterRuleBuilder
/// <summary>
/// Create FilterRuleBuilder for double FilterRule
/// </summary>
/// <param name="param">Parameter of FilterRule.</param>
/// <param name="ruleCriteria">Rule criteria.</param>
/// <param name="ruleValue">Rule value.</param>
/// <param name="tolerance">Epsilon for double values comparison.</param>
public FilterRuleBuilder(BuiltInParameter param, String ruleCriteria, double ruleValue, double tolearance)
{
InitializeMemebers();
//
// set data with specified values
ParamType = StorageType.Double;
Parameter = param;
RuleCriteria = ruleCriteria;
RuleValue = ruleValue.ToString();
Epsilon = tolearance;
}
开发者ID:AMEE,项目名称:revit,代码行数:18,代码来源:FilterData.cs
示例13: SetParameter
/// <summary>
/// set parameter whose storage type is double
/// </summary>
/// <param name="elem">Element has parameter</param>
/// <param name="builtInPara">BuiltInParameter to find parameter</param>
/// <param name="value">value to set</param>
/// <returns>is successful</returns>
private bool SetParameter(ModelElement elem,
BuiltInParameter builtInPara, double value)
{
Parameter para = elem.get_Parameter(builtInPara);
if (null != para && para.StorageType == StorageType.Double && !para.IsReadOnly)
{
var result = para.Set(value);
return result;
}
return false;
}
开发者ID:AMEE,项目名称:revit,代码行数:18,代码来源:FrameBuilder.cs
示例14: CreatePositiveLengthMeasurePropertyFromElementOrSymbol
/// <summary>
/// Create a positive length property from the element's or type's parameter.
/// </summary>
/// <param name="file">The IFC file.</param>
/// <param name="exporterIFC">The ExporterIFC.</param>
/// <param name="elem">The Element.</param>
/// <param name="revitParameterName">The name of the parameter.</param>
/// <param name="revitBuiltInParam">The optional built-in parameter.</param>
/// <param name="ifcPropertyName">The name of the property.</param>
/// <param name="valueType">The value type of the property.</param>
/// <returns>The created property handle.</returns>
public static IFCAnyHandle CreatePositiveLengthMeasurePropertyFromElementOrSymbol(IFCFile file, ExporterIFC exporterIFC, Element elem,
string revitParameterName, BuiltInParameter revitBuiltInParam, string ifcPropertyName, PropertyValueType valueType)
{
double propertyValue;
if (ParameterUtil.GetDoubleValueFromElement(elem, revitParameterName, out propertyValue))
{
propertyValue *= exporterIFC.LinearScale;
return CreatePositiveLengthMeasureProperty(file, ifcPropertyName, propertyValue, valueType);
}
if (revitBuiltInParam != BuiltInParameter.INVALID)
{
string builtInParamName = LabelUtils.GetLabelFor(revitBuiltInParam);
IFCAnyHandle propHnd = CreatePositiveLengthMeasurePropertyFromElement(file, exporterIFC, elem, builtInParamName, ifcPropertyName, valueType);
if (!IFCAnyHandleUtil.IsNullOrHasNoValue(propHnd))
return propHnd;
}
// For Symbol
Document document = elem.Document;
ElementId typeId = elem.GetTypeId();
Element elemType = document.GetElement(typeId);
if (elemType != null)
return CreatePositiveLengthMeasurePropertyFromElement(file, exporterIFC, elemType, revitParameterName, ifcPropertyName, valueType);
else
return null;
}
开发者ID:stiter,项目名称:ifcexporter,代码行数:38,代码来源:PropertyUtil.cs
示例15: GetProperty
/// <summary>
/// get the room property and Department property according the property name
/// </summary>
/// <param name="room">a instance of room class</param>
/// <param name="paraEnum">the property name</param>
public String GetProperty(Room room, BuiltInParameter paraEnum)
{
String propertyValue = null; //the value of parameter
// get the parameter via the parameterId
Parameter param = room.get_Parameter(paraEnum);
if (null == param)
{
return "";
}
// get the parameter's storage type
StorageType storageType = param.StorageType;
switch (storageType)
{
case StorageType.Integer:
int iVal = param.AsInteger();
propertyValue = iVal.ToString();
break;
case StorageType.String:
String stringVal = param.AsString();
propertyValue = stringVal;
break;
case StorageType.Double:
Double dVal = param.AsDouble();
dVal = Math.Round(dVal, 2);
propertyValue = dVal.ToString();
break;
default:
break;
}
return propertyValue;
}
开发者ID:AMEE,项目名称:revit,代码行数:37,代码来源:RoomsData.cs
示例16: CreateNewFilterRule
/// <summary>
/// Create new FilterRuleBuilder for current parameter
/// </summary>
/// <param name="curParam">Current selected parameter.</param>
/// <returns>New FilterRuleBuilder for this parameter, null if parameter is not recognizable.</returns>
FilterRuleBuilder CreateNewFilterRule(BuiltInParameter curParam)
{
StorageType paramType = m_doc.get_TypeOfStorage(curParam);
String criteria = criteriaComboBox.SelectedItem as String;
if (paramType == StorageType.String)
{
return new FilterRuleBuilder(curParam, criteria,
ruleValueComboBox.Text, caseSensitiveCheckBox.Checked);
}
else if (paramType == StorageType.Double)
{
double ruleValue = 0, epsilon = 0;
if (!GetRuleValueDouble(false, ref ruleValue)) return null;
if (!GetRuleValueDouble(true, ref epsilon)) return null;
return new FilterRuleBuilder(curParam, criteria,
ruleValue, epsilon);
}
else if (paramType == StorageType.Integer)
{
int ruleValue = 0;
if (!GetRuleValueInt(ref ruleValue)) return null;
return new FilterRuleBuilder(curParam, criteria, ruleValue);
}
else if (paramType == StorageType.ElementId)
{
int ruleValue = 0;
if (!GetRuleValueInt(ref ruleValue)) return null;
return new FilterRuleBuilder(curParam, criteria, new ElementId(ruleValue));
}
else
return null;
}
开发者ID:AMEE,项目名称:revit,代码行数:37,代码来源:ViewFiltersForm.cs
示例17: ParameterInUse
/// <summary>
/// Check if selected parameter already in use(has criteria)
/// </summary>
/// <param name="selParameter">Parameter to be checked.</param>
/// <returns>True if this parameter already has criteria, otherwise false.</returns>
bool ParameterInUse(BuiltInParameter selParameter)
{
if (!HasFilterData() || m_currentFilterData.RuleData.Count == 0
|| rulesListBox.Items.Count == 0)
return false;
//
// Get all existing rules and check if this parameter is in used
int paramIndex = 0;
bool paramIsInUse = false;
ICollection<FilterRuleBuilder> rules = m_currentFilterData.RuleData;
foreach (FilterRuleBuilder rule in rules)
{
if (rule.Parameter == selParameter)
{
paramIsInUse = true;
break;
}
paramIndex++;
}
//
// If parameter is in use, switch to this parameter and update criteria and rules
if (paramIsInUse)
rulesListBox.SetSelected(paramIndex, true);
return paramIsInUse;
}
开发者ID:AMEE,项目名称:revit,代码行数:30,代码来源:ViewFiltersForm.cs
示例18: 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
示例19: GetStringValueFromElementOrSymbol
/// <summary>Gets string value from built-in parameter of an element or its type.</summary>
/// <param name="element">The element.</param>
/// <param name="builtInParameter">The built-in parameter.</param>
/// <param name="nullAllowed">true if we allow the property value to be empty.</param>
/// <param name="propertyValue">The output property value.</param>
/// <returns>The parameter, or null if not found.</returns>
public static Parameter GetStringValueFromElementOrSymbol(Element element, BuiltInParameter builtInParameter, bool nullAllowed, out string propertyValue)
{
Parameter parameter = GetStringValueFromElement(element, builtInParameter, out propertyValue);
if (parameter != null)
{
if (!String.IsNullOrEmpty(propertyValue))
return parameter;
}
parameter = null;
Element elementType = element.Document.GetElement(element.GetTypeId());
if (elementType != null)
{
parameter = GetStringValueFromElement(elementType, builtInParameter, out propertyValue);
if ((parameter != null) && !nullAllowed && String.IsNullOrEmpty(propertyValue))
parameter = null;
}
return parameter;
}
开发者ID:whztt07,项目名称:RevitCustomIFCexporter,代码行数:26,代码来源:ParameterUtil.cs
示例20: GetElementIdValueFromElementOrSymbol
/// <summary>
/// Gets element id value from parameter of an element or its element type.
/// </summary>
/// <param name="element">The element.</param>
/// <param name="builtInParameter">The built in parameter.</param>
/// <param name="propertyValue">The output property value.</param>
/// <returns>True if get the value successfully, false otherwise.</returns>
public static bool GetElementIdValueFromElementOrSymbol(Element element, BuiltInParameter builtInParameter, out ElementId propertyValue)
{
if (GetElementIdValueFromElement(element, builtInParameter, out propertyValue))
return true;
else
{
Document document = element.Document;
ElementId typeId = element.GetTypeId();
Element elemType = document.GetElement(typeId);
if (elemType != null)
{
return GetElementIdValueFromElement(elemType, builtInParameter, out propertyValue);
}
else
return false;
}
}
开发者ID:stiter,项目名称:ifcexporter,代码行数:25,代码来源:ParameterUtil.cs
注:本文中的BuiltInParameter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论