本文整理汇总了C#中Element.GetTypeId方法的典型用法代码示例。如果您正苦于以下问题:C# Element.GetTypeId方法的具体用法?C# Element.GetTypeId怎么用?C# Element.GetTypeId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Element
的用法示例。
在下文中一共展示了Element.GetTypeId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Calculate
/// <summary>
/// Calculates height for a railing
/// </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;
RailingType railingType = element.Document.GetElement(element.GetTypeId()) as RailingType;
if (railingType == null)
return false;
m_Height = UnitUtil.ScaleLength(railingType.TopRailHeight);
return true;
}
示例2: CreateIFCObjectName
/// <summary>
/// Creates an IFC object name from export state.
/// </summary>
/// <remarks>
/// It is combined with family name and element type id.
/// </remarks>
/// <param name="exporterIFC">
/// The ExporterIFC object.
/// </param>
/// <param name="element">
/// The element.
/// </param>
/// <returns>
/// The string contains the name string value.
/// </returns>
public static string CreateIFCObjectName(ExporterIFC exporterIFC, Element element)
{
ElementId typeId = element != null ? element.GetTypeId() : ElementId.InvalidElementId;
string objectName = exporterIFC.GetFamilyName();
if (typeId != ElementId.InvalidElementId)
{
if (objectName == "")
return typeId.ToString();
else
return (objectName + ":" + typeId.ToString());
}
return "";
}
示例3: GetMemberTypeHandle
/// <summary>
/// The IfcMemberType shared by all stringers to keep their type. This is a placeholder IfcMemberType.
/// </summary>
public static IFCAnyHandle GetMemberTypeHandle(ExporterIFC exporterIFC, Element stringer)
{
Element stringerType = stringer.Document.GetElement(stringer.GetTypeId());
IFCAnyHandle memberType = ExporterCacheManager.ElementToHandleCache.Find(stringerType.Id);
if (IFCAnyHandleUtil.IsNullOrHasNoValue(memberType))
{
IFCFile file = exporterIFC.GetFile();
IFCAnyHandle ownerHistory = exporterIFC.GetOwnerHistoryHandle();
string stringerTypeGUID = ExporterIFCUtils.CreateGUID(stringerType);
string origInstanceName = stringerType.Name;
string stringerTypeName = NamingUtil.GetNameOverride(stringerType, origInstanceName);
string stringerTypeDescription = NamingUtil.GetDescriptionOverride(stringerType, null);
string stringerTypeElemId = NamingUtil.CreateIFCElementId(stringerType);
memberType = IFCInstanceExporter.CreateMemberType(file, ExporterIFCUtils.CreateGUID(),
ownerHistory, stringerTypeName, stringerTypeDescription, null, null, null, stringerTypeElemId,
null, IFCMemberType.Stringer);
ExporterCacheManager.ElementToHandleCache.Register(stringerType.Id, memberType);
}
return memberType;
}
示例4: GetMemberTypeHandle
/// <summary>
/// The IfcMemberType shared by all stringers to keep their type. This is a placeholder IfcMemberType.
/// </summary>
public static IFCAnyHandle GetMemberTypeHandle(ExporterIFC exporterIFC, Element stringer)
{
Element stringerType = stringer.Document.GetElement(stringer.GetTypeId());
IFCAnyHandle memberType = ExporterCacheManager.ElementToHandleCache.Find(stringerType.Id);
if (IFCAnyHandleUtil.IsNullOrHasNoValue(memberType))
{
IFCFile file = exporterIFC.GetFile();
IFCAnyHandle ownerHistory = exporterIFC.GetOwnerHistoryHandle();
string stringerTypeGUID = GUIDUtil.CreateGUID(stringerType);
string stringerTypeName = NamingUtil.GetNameOverride(stringerType, NamingUtil.GetIFCName(stringerType));
string stringerTypeDescription = NamingUtil.GetDescriptionOverride(stringerType, null);
string stringerTypeTag = NamingUtil.GetTagOverride(stringerType, NamingUtil.CreateIFCElementId(stringerType));
string stringerApplicableOccurence = NamingUtil.GetOverrideStringValue(stringerType, "IfcApplicableOccurence", null);
string stringerElementType = NamingUtil.GetOverrideStringValue(stringerType, "IfcElementType", null);
memberType = IFCInstanceExporter.CreateMemberType(file, stringerTypeGUID,
ownerHistory, stringerTypeName, stringerTypeDescription, stringerApplicableOccurence, null, null, stringerTypeTag,
stringerElementType, IFCMemberType.Stringer);
ExporterCacheManager.ElementToHandleCache.Register(stringerType.Id, memberType);
}
return memberType;
}
示例5: ExportElementQuantities
/// <summary>
/// Exports the IFC element quantities.
/// </summary>
/// <param name="exporterIFC">The IFC exporter object.</param>
/// <param name="element ">The element whose quantities are exported.</param>
/// <param name="productWrapper">The ProductWrapper object.</param>
private static void ExportElementQuantities(ExporterIFC exporterIFC, Element element, ProductWrapper productWrapper)
{
if (productWrapper.IsEmpty())
return;
IFCFile file = exporterIFC.GetFile();
using (IFCTransaction transaction = new IFCTransaction(file))
{
Document doc = element.Document;
ElementType elemType = doc.GetElement(element.GetTypeId()) as ElementType;
IFCAnyHandle ownerHistory = exporterIFC.GetOwnerHistoryHandle();
ICollection<IFCAnyHandle> productSet = productWrapper.GetAllObjects();
IList<IList<QuantityDescription>> quantitiesToCreate = ExporterCacheManager.ParameterCache.Quantities;
foreach (IList<QuantityDescription> currStandard in quantitiesToCreate)
{
foreach (QuantityDescription currDesc in currStandard)
{
foreach (IFCAnyHandle prodHnd in productSet)
{
if (currDesc.IsAppropriateType(prodHnd))
{
IFCExtrusionCreationData ifcParams = productWrapper.FindExtrusionCreationParameters(prodHnd);
HashSet<IFCAnyHandle> quantities = currDesc.ProcessEntries(file, exporterIFC, ifcParams, element, elemType);
if (quantities.Count > 0)
{
string paramSetName = currDesc.Name;
string methodName = currDesc.MethodOfMeasurement;
IFCAnyHandle propertySet = IFCInstanceExporter.CreateElementQuantity(file, GUIDUtil.CreateGUID(), ownerHistory, paramSetName, methodName, null, quantities);
IFCAnyHandle prodHndToUse = prodHnd;
DescriptionCalculator ifcRDC = currDesc.DescriptionCalculator;
if (ifcRDC != null)
{
IFCAnyHandle overrideHnd = ifcRDC.RedirectDescription(exporterIFC, element);
if (!IFCAnyHandleUtil.IsNullOrHasNoValue(overrideHnd))
prodHndToUse = overrideHnd;
}
HashSet<IFCAnyHandle> relatedObjects = new HashSet<IFCAnyHandle>();
relatedObjects.Add(prodHndToUse);
IFCInstanceExporter.CreateRelDefinesByProperties(file, GUIDUtil.CreateGUID(), ownerHistory, null, null, relatedObjects, propertySet);
}
}
}
}
}
transaction.Commit();
}
}
示例6: IsElementExternal
/// <summary>
/// Checks if element is external.
/// </summary>
/// <remarks>
/// An element is considered external if either:
/// <li> A special Yes/No parameter "IsExternal" is applied to it or its type and it's value is set to "yes".</li>
/// <li> The element itself has information about being an external element.</li>
/// All other elements are internal.
/// </remarks>
/// <param name="element">The element.</param>
/// <returns>True if the element is external, false otherwise.</returns>
public static bool IsElementExternal(Element element)
{
if (element == null)
return false;
Document document = element.Document;
// Look for a parameter "IsExternal", potentially localized.
{
ElementId elementId = element.Id;
bool? maybeIsExternal = null;
if (!ExporterCacheManager.IsExternalParameterValueCache.TryGetValue(elementId, out maybeIsExternal))
{
int intIsExternal = 0;
string localExternalParamName = PropertySetEntryUtil.GetLocalizedIsExternal(ExporterCacheManager.LanguageType);
if ((localExternalParamName != null) && (ParameterUtil.GetIntValueFromElementOrSymbol(element, localExternalParamName, out intIsExternal) != null))
maybeIsExternal = (intIsExternal != 0);
if (!maybeIsExternal.HasValue && (ExporterCacheManager.LanguageType != LanguageType.English_USA))
{
string externalParamName = PropertySetEntryUtil.GetLocalizedIsExternal(LanguageType.English_USA);
if (ParameterUtil.GetIntValueFromElementOrSymbol(element, externalParamName, out intIsExternal) != null)
maybeIsExternal = (intIsExternal != 0);
}
ExporterCacheManager.IsExternalParameterValueCache.Add(new KeyValuePair<ElementId, bool?>(elementId, maybeIsExternal));
}
if (maybeIsExternal.HasValue)
return maybeIsExternal.Value;
}
// Many element types have the FUNCTION_PARAM parameter. If this is set, use its value.
ElementType elementType = document.GetElement(element.GetTypeId()) as ElementType;
int elementFunction;
if ((elementType != null) && ParameterUtil.GetIntValueFromElement(elementType, BuiltInParameter.FUNCTION_PARAM, out elementFunction) != null)
{
// Note that the WallFunction enum value is the same for many different kinds of objects.
return elementFunction != ((int)WallFunction.Interior);
}
// Specific element types that know if they are external or not if the built-in parameter isn't set.
// Categories are used, and not types, to also support in-place families
// Roofs are always external
ElementId categoryId = element.Category.Id;
if (categoryId == new ElementId(BuiltInCategory.OST_Roofs) ||
categoryId == new ElementId(BuiltInCategory.OST_MassExteriorWall))
return true;
// Mass interior walls are always internal
if (categoryId == new ElementId(BuiltInCategory.OST_MassInteriorWall))
return false;
// Family instances may be hosted on an external element
if (element is FamilyInstance)
{
FamilyInstance familyInstance = element as FamilyInstance;
Element familyInstanceHost = familyInstance.Host;
if (familyInstanceHost == null)
{
Reference familyInstanceHostReference = familyInstance.HostFace;
if (familyInstanceHostReference != null)
familyInstanceHost = document.GetElement(familyInstanceHostReference);
}
if (familyInstanceHost != null)
return IsElementExternal(familyInstanceHost);
}
return false;
}
示例7: CreateElectricalCurrentMeasurePropertyFromElementOrSymbol
/// <summary>
/// Create an electrical current measure property from the element's or type's parameter.
/// </summary>
/// <param name="file">The IFC file.</param>
/// <param name="elem">The Element.</param>
/// <param name="revitParameterName">The name of the 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 CreateElectricalCurrentMeasurePropertyFromElementOrSymbol(IFCFile file, Element elem, string revitParameterName, string ifcPropertyName, PropertyValueType valueType)
{
double propertyValue;
if (ParameterUtil.GetDoubleValueFromElement(elem, null, revitParameterName, out propertyValue) != null)
{
return CreateElectricalCurrentMeasurePropertyFromCache(file, ifcPropertyName, propertyValue, valueType);
}
// For Symbol
Document document = elem.Document;
ElementId typeId = elem.GetTypeId();
Element elemType = document.GetElement(typeId);
if (elemType != null)
return CreateElectricalCurrentMeasurePropertyFromElementOrSymbol(file, elemType, revitParameterName, ifcPropertyName, valueType);
else
return null;
}
示例8: GetIFCBaseName
/// <summary>
/// Generates the IFC name for the current element.
/// </summary>
/// <param name="element">The element.</param>
/// <returns> The string containing the name.</returns>
static private string GetIFCBaseName(Element element)
{
if (element == null)
return "";
bool isType = (element is ElementType);
string elementName = element.Name;
if (elementName == "???")
elementName = "";
string familyName = "";
ElementType elementType = (isType ? element : element.Document.GetElement(element.GetTypeId())) as ElementType;
if (elementType != null)
{
familyName = ExporterIFCUtils.GetFamilyName(elementType);
if (familyName == "???")
familyName = "";
}
string fullName = familyName;
if (elementName != "")
{
if (fullName != "")
fullName = fullName + ":" + elementName;
else
fullName = elementName;
}
if (isType)
return fullName;
if (fullName != "")
return fullName + ":" + CreateIFCElementId(element);
return CreateIFCElementId(element);
}
示例9: 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;
}
示例10: CreateSimpleSweptSolid
/// <summary>
/// Creates a simple swept solid.
/// </summary>
/// <param name="exporterIFC">The exporter.</param>
/// <param name="element">The element.</param>
/// <param name="solid">The solid.</param>
/// <param name="normal">The normal of the plane that the path lies on.</param>
/// <returns>The swept solid representation handle.</returns>
public static IFCAnyHandle CreateSimpleSweptSolid(ExporterIFC exporterIFC, Element element, Solid solid, XYZ normal)
{
try
{
if (element == null || element.Document == null)
return null;
SimpleSweptSolidAnalyzer sweptAnalyzer = SimpleSweptSolidAnalyzer.Create(element.Document.Application.Create, solid, normal);
if (sweptAnalyzer != null)
{
// TODO: support openings and recess for a swept solid
if (sweptAnalyzer.UnalignedFaces != null && sweptAnalyzer.UnalignedFaces.Count > 0)
return null;
IList<GeometryUtil.FaceBoundaryType> faceBoundaryTypes;
IList<CurveLoop> faceBoundaries = GeometryUtil.GetFaceBoundaries(sweptAnalyzer.ProfileFace, null, out faceBoundaryTypes);
string profileName = null;
if (element != null)
{
ElementType type = element.Document.GetElement(element.GetTypeId()) as ElementType;
if (type != null)
profileName = type.Name;
}
return CreateSimpleSweptSolid(exporterIFC, profileName, faceBoundaries, normal, sweptAnalyzer.PathCurve);
}
}
catch (Exception)
{
return null;
}
return null;
}
示例11: ExportWallType
/// <summary>
/// Exports wall types.
/// </summary>
/// <param name="exporterIFC">The exporter.</param>
/// <param name="wrapper">The ProductWrapper class.</param>
/// <param name="elementHandle">The element handle.</param>
/// <param name="element">The element.</param>
/// <param name="overrideMaterialId">The material id used for the element type.</param>
/// <param name="isStandard">True if it is a standard wall, false otherwise.</param>
/// <param name="asFooting">Export as IfcFootingType instead.</param>
public static void ExportWallType(ExporterIFC exporterIFC, ProductWrapper wrapper, IFCAnyHandle elementHandle, Element element, ElementId overrideMaterialId,
bool isStandard, bool asFooting)
{
if (elementHandle == null || element == null)
return;
Document doc = element.Document;
ElementId typeElemId = element.GetTypeId();
Element elementType = doc.GetElement(typeElemId);
if (elementType == null)
return;
IFCAnyHandle wallType = null;
if (ExporterCacheManager.WallTypeCache.TryGetValue(typeElemId, out wallType))
{
ExporterCacheManager.TypeRelationsCache.Add(wallType, elementHandle);
return;
}
string elemGUID = GUIDUtil.CreateGUID(elementType);
string elemName = NamingUtil.GetNameOverride(elementType, NamingUtil.GetIFCName(elementType));
string elemDesc = NamingUtil.GetDescriptionOverride(elementType, null);
string elemTag = NamingUtil.GetTagOverride(elementType, NamingUtil.CreateIFCElementId(elementType));
string elemApplicableOccurence = NamingUtil.GetOverrideStringValue(elementType, "IfcApplicableOccurence", null);
string elemElementType = NamingUtil.GetOverrideStringValue(elementType, "IfcElementType", null);
// Property sets will be set later.
if (asFooting)
wallType = IFCInstanceExporter.CreateFootingType(exporterIFC.GetFile(), elemGUID, exporterIFC.GetOwnerHistoryHandle(),
elemName, elemDesc, elemApplicableOccurence, null, null, null, null, null);
else
wallType = IFCInstanceExporter.CreateWallType(exporterIFC.GetFile(), elemGUID, exporterIFC.GetOwnerHistoryHandle(),
elemName, elemDesc, elemApplicableOccurence, null, null, elemTag, elemElementType, isStandard ? "STANDARD" : "NOTDEFINED");
wrapper.RegisterHandleWithElementType(elementType as ElementType, wallType, null);
if (overrideMaterialId != ElementId.InvalidElementId)
{
CategoryUtil.CreateMaterialAssociation(exporterIFC, wallType, overrideMaterialId);
}
else
{
// try to get material set from the cache
IFCAnyHandle materialLayerSet = ExporterCacheManager.MaterialLayerSetCache.Find(typeElemId);
if (materialLayerSet != null)
ExporterCacheManager.MaterialLayerRelationsCache.Add(materialLayerSet, wallType);
}
ExporterCacheManager.WallTypeCache[typeElemId] = wallType;
ExporterCacheManager.TypeRelationsCache.Add(wallType, elementHandle);
}
示例12: CreateInternalRevitPropertySets
/// <summary>
/// Creates property sets for Revit groups and parameters, if export options is set.
/// </summary>
/// <param name="exporterIFC">The ExporterIFC.</param>
/// <param name="element">The Element.</param>
/// <param name="elementSets">The collection of IFCAnyHandles to relate properties to.</param>
public static void CreateInternalRevitPropertySets(ExporterIFC exporterIFC, Element element, ICollection<IFCAnyHandle> elementSets)
{
if (exporterIFC == null || element == null ||
!ExporterCacheManager.ExportOptionsCache.PropertySetOptions.ExportInternalRevit)
return;
// We will allow creating internal Revit property sets for element types with no associated element handles.
if ((elementSets == null || elementSets.Count == 0) && !(element is ElementType))
return;
IFCFile file = exporterIFC.GetFile();
double lengthScale = exporterIFC.LinearScale;
double scale = 0.3048;
double angleScale = 180.0 / Math.PI;
ElementId typeId = element.GetTypeId();
Element elementType = element.Document.GetElement(typeId);
int whichStart = elementType != null ? 0 : (element is ElementType ? 1 : 0);
if (whichStart == 1)
{
typeId = element.Id;
elementType = element as ElementType;
}
IDictionary<string, int> paramGroupNameToSubElemIndex = new Dictionary<string, int>();
SortedDictionary<string, HashSet<IFCAnyHandle>>[] propertySets;
propertySets = new SortedDictionary<string, HashSet<IFCAnyHandle>>[2];
propertySets[0] = new SortedDictionary<string, HashSet<IFCAnyHandle>>(StringComparer.InvariantCultureIgnoreCase);
propertySets[1] = new SortedDictionary<string, HashSet<IFCAnyHandle>>(StringComparer.InvariantCultureIgnoreCase);
// pass through: element and element type. If the element is a ElementType, there will only be one pass.
for (int which = whichStart; which < 2; which++)
{
Element whichElement = (which == 0) ? element : elementType;
if (whichElement == null)
continue;
bool createType = (which == 1);
if (createType)
{
if (ExporterCacheManager.TypePropertyInfoCache.HasTypeProperties(typeId))
continue;
}
IDictionary<BuiltInParameterGroup, ParameterElementCache> parameterElementCache =
ParameterUtil.GetNonIFCParametersForElement(whichElement.Id);
if (parameterElementCache == null)
continue;
foreach (KeyValuePair<BuiltInParameterGroup, ParameterElementCache> parameterElementGroup in parameterElementCache)
{
BuiltInParameterGroup parameterGroup = parameterElementGroup.Key;
string groupName = LabelUtils.GetLabelFor(parameterGroup);
HashSet<IFCAnyHandle> currPropertiesForGroup = new HashSet<IFCAnyHandle>();
propertySets[which][groupName] = currPropertiesForGroup;
int unadjustedSubElementIndex = -(5000000 + (int)parameterGroup + 99);
if (unadjustedSubElementIndex > 0)
{
int subElementIndex = unadjustedSubElementIndex + (int)IFCGenericSubElements.PSetRevitInternalStart;
if (subElementIndex <= (int)IFCGenericSubElements.PSetRevitInternalEnd)
paramGroupNameToSubElemIndex[groupName] = subElementIndex;
}
foreach (Parameter parameter in parameterElementGroup.Value.ParameterCache.Values)
{
if (!parameter.HasValue)
continue;
Definition parameterDefinition = parameter.Definition;
if (parameterDefinition == null)
continue;
string parameterCaption = parameterDefinition.Name;
switch (parameter.StorageType)
{
case StorageType.None:
break;
case StorageType.Integer:
{
int value = parameter.AsInteger();
string valueAsString = parameter.AsValueString();
// YesNo or actual integer?
if (parameterDefinition.ParameterType == ParameterType.YesNo)
{
currPropertiesForGroup.Add(CreateBooleanPropertyFromCache(file, parameterCaption, value != 0, PropertyValueType.SingleValue));
}
else if (parameterDefinition.ParameterType == ParameterType.Invalid && (valueAsString != null))
{
//.........这里部分代码省略.........
示例13: CreatePlaneAngleMeasurePropertyFromElementOrSymbol
/// <summary>
/// Create a plane angle measure property from the element's or type's parameter.
/// </summary>
/// <param name="file">The IFC file.</param>
/// <param name="elem">The Element.</param>
/// <param name="revitParameterName">The name of the 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 CreatePlaneAngleMeasurePropertyFromElementOrSymbol(IFCFile file, Element elem, string revitParameterName, string ifcPropertyName, PropertyValueType valueType)
{
double propertyValue;
if (ParameterUtil.GetDoubleValueFromElement(elem, null, revitParameterName, out propertyValue) != null)
{
// Although the default units for IFC files is radians, IFC files almost universally use degrees as their unit of measurement.
// However, many old IFC files failed to include degrees as the unit of measurement.
// As such, we assume that the IFC file is in degrees, regardless of whether or not it is explicitly stated in the file.
propertyValue *= 180 / Math.PI;
return CreatePlaneAngleMeasurePropertyFromCache(file, ifcPropertyName, propertyValue, valueType);
}
// For Symbol
Document document = elem.Document;
ElementId typeId = elem.GetTypeId();
Element elemType = document.GetElement(typeId);
if (elemType != null)
return CreatePlaneAngleMeasurePropertyFromElementOrSymbol(file, elemType, revitParameterName, ifcPropertyName, valueType);
else
return null;
}
示例14: CreatePositiveRatioPropertyFromElementOrSymbol
/// <summary>
/// Create a positive ratio 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="ifcPropertyName">The name of the property. Also, the backup name of the parameter.</param>
/// <param name="valueType">The value type of the property.</param>
/// <returns>The created property handle.</returns>
public static IFCAnyHandle CreatePositiveRatioPropertyFromElementOrSymbol(IFCFile file, ExporterIFC exporterIFC, Element elem,
string revitParameterName, string ifcPropertyName, PropertyValueType valueType)
{
double propertyValue;
if (ParameterUtil.GetDoubleValueFromElement(elem, null, revitParameterName, out propertyValue) != null)
return CreatePositiveRatioMeasureProperty(file, ifcPropertyName, propertyValue, valueType);
if (ParameterUtil.GetDoubleValueFromElement(elem, null, ifcPropertyName, out propertyValue) != null)
return CreatePositiveRatioMeasureProperty(file, ifcPropertyName, propertyValue, valueType);
// For Symbol
Document document = elem.Document;
ElementId typeId = elem.GetTypeId();
Element elemType = document.GetElement(typeId);
if (elemType == null)
return null;
return CreatePositiveRatioPropertyFromElementOrSymbol(file, exporterIFC, elemType, revitParameterName, ifcPropertyName, valueType);
}
示例15: CreateIntegerPropertyFromElementOrSymbol
/// <summary>
/// Create an integer property from the element's or type's parameter.
/// </summary>
/// <param name="file">The IFC file.</param>
/// <param name="elem">The Element.</param>
/// <param name="revitParameterName">The name of the 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 CreateIntegerPropertyFromElementOrSymbol(IFCFile file, Element elem,
string revitParameterName, string ifcPropertyName, PropertyValueType valueType)
{
int propertyValue;
if (ParameterUtil.GetIntValueFromElement(elem, revitParameterName, out propertyValue) != null)
return CreateIntegerPropertyFromCache(file, ifcPropertyName, propertyValue, valueType);
// For Symbol
Document document = elem.Document;
ElementId typeId = elem.GetTypeId();
Element elemType = document.GetElement(typeId);
if (elemType != null)
return CreateIntegerPropertyFromElementOrSymbol(file, elemType, revitParameterName, ifcPropertyName, valueType);
else
return null;
}