本文整理汇总了C#中BIM.IFC.Utility.ProductWrapper.FindExtrusionCreationParameters方法的典型用法代码示例。如果您正苦于以下问题:C# ProductWrapper.FindExtrusionCreationParameters方法的具体用法?C# ProductWrapper.FindExtrusionCreationParameters怎么用?C# ProductWrapper.FindExtrusionCreationParameters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BIM.IFC.Utility.ProductWrapper
的用法示例。
在下文中一共展示了ProductWrapper.FindExtrusionCreationParameters方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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();
}
}
示例2: ExportElementProperties
/// <summary>
/// Exports the element properties.
/// </summary>
/// <param name="exporterIFC">The IFC exporter object.</param>
/// <param name="element">The element whose properties are exported.</param>
/// <param name="productWrapper">The ProductWrapper object.</param>
private static void ExportElementProperties(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<PropertySetDescription>> psetsToCreate = ExporterCacheManager.ParameterCache.PropertySets;
// In some cases, like multi-story stairs and ramps, we may have the same Pset used for multiple levels.
// If ifcParams is null, re-use the property set.
ISet<string> locallyUsedGUIDs = new HashSet<string>();
IDictionary<Tuple<Element, Element, string>, IFCAnyHandle> createdPropertySets =
new Dictionary<Tuple<Element, Element, string>, IFCAnyHandle>();
IDictionary<IFCAnyHandle, HashSet<IFCAnyHandle>> relDefinesByPropertiesMap =
new Dictionary<IFCAnyHandle, HashSet<IFCAnyHandle>>();
foreach (IFCAnyHandle prodHnd in productSet)
{
IList<PropertySetDescription> currPsetsToCreate = GetCurrPSetsToCreate(prodHnd, psetsToCreate);
if (currPsetsToCreate.Count == 0)
continue;
ElementId overrideElementId = ExporterCacheManager.HandleToElementCache.Find(prodHnd);
Element elementToUse = (overrideElementId == ElementId.InvalidElementId) ? element : doc.GetElement(overrideElementId);
ElementType elemTypeToUse = (overrideElementId == ElementId.InvalidElementId) ? elemType : doc.GetElement(elementToUse.GetTypeId()) as ElementType;
if (elemTypeToUse == null)
elemTypeToUse = elemType;
IFCExtrusionCreationData ifcParams = productWrapper.FindExtrusionCreationParameters(prodHnd);
foreach (PropertySetDescription currDesc in currPsetsToCreate)
{
// Last conditional check: if the property set comes from a ViewSchedule, check if the element is in the schedule.
if (currDesc.ViewScheduleId != ElementId.InvalidElementId)
if (!ExporterCacheManager.ViewScheduleElementCache[currDesc.ViewScheduleId].Contains(elementToUse.Id))
continue;
Tuple<Element, Element, string> propertySetKey = new Tuple<Element, Element, string>(elementToUse, elemTypeToUse, currDesc.Name);
IFCAnyHandle propertySet = null;
if ((ifcParams != null) || (!createdPropertySets.TryGetValue(propertySetKey, out propertySet)))
{
HashSet<IFCAnyHandle> props = currDesc.ProcessEntries(file, exporterIFC, ifcParams, elementToUse, elemTypeToUse);
if (props.Count > 0)
{
int subElementIndex = CheckElementTypeValidityForSubIndex(currDesc, prodHnd, element);
string guid = GUIDUtil.CreateSubElementGUID(elementToUse, subElementIndex);
if (locallyUsedGUIDs.Contains(guid))
guid = GUIDUtil.CreateGUID();
else
locallyUsedGUIDs.Add(guid);
string paramSetName = currDesc.Name;
propertySet = IFCInstanceExporter.CreatePropertySet(file, guid, ownerHistory, paramSetName, null, props);
if (ifcParams == null)
createdPropertySets[propertySetKey] = propertySet;
}
}
if (propertySet != null)
{
IFCAnyHandle prodHndToUse = prodHnd;
DescriptionCalculator ifcRDC = currDesc.DescriptionCalculator;
if (ifcRDC != null)
{
IFCAnyHandle overrideHnd = ifcRDC.RedirectDescription(exporterIFC, elementToUse);
if (!IFCAnyHandleUtil.IsNullOrHasNoValue(overrideHnd))
prodHndToUse = overrideHnd;
}
HashSet<IFCAnyHandle> relatedObjects = null;
if (!relDefinesByPropertiesMap.TryGetValue(propertySet, out relatedObjects))
{
relatedObjects = new HashSet<IFCAnyHandle>();
relDefinesByPropertiesMap[propertySet] = relatedObjects;
}
relatedObjects.Add(prodHndToUse);
}
}
}
foreach (KeyValuePair<IFCAnyHandle, HashSet<IFCAnyHandle>> relDefinesByProperties in relDefinesByPropertiesMap)
{
IFCInstanceExporter.CreateRelDefinesByProperties(file, GUIDUtil.CreateGUID(), ownerHistory, null, null,
relDefinesByProperties.Value, relDefinesByProperties.Key);
//.........这里部分代码省略.........
示例3: ExportElementProperties
/// <summary>
/// Exports the element properties.
/// </summary>
/// <param name="exporterIFC">The IFC exporter object.</param>
/// <param name="element">The element whose properties are exported.</param>
/// <param name="productWrapper">The ProductWrapper object.</param>
public void ExportElementProperties(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<PropertySetDescription>> psetsToCreate = ExporterCacheManager.ParameterCache.PropertySets;
foreach (IFCAnyHandle prodHnd in productSet)
{
IList<PropertySetDescription> currPsetsToCreate = GetCurrPSetsToCreate(prodHnd, psetsToCreate);
if (currPsetsToCreate.Count == 0)
continue;
ElementId overrideElementId = ExporterCacheManager.HandleToElementCache.Find(prodHnd);
Element elementToUse = (overrideElementId == ElementId.InvalidElementId) ? element : doc.GetElement(overrideElementId);
ElementType elemTypeToUse = (overrideElementId == ElementId.InvalidElementId) ? elemType : doc.GetElement(elementToUse.GetTypeId()) as ElementType;
if (elemTypeToUse == null)
elemTypeToUse = elemType;
IFCExtrusionCreationData ifcParams = productWrapper.FindExtrusionCreationParameters(prodHnd);
foreach (PropertySetDescription currDesc in currPsetsToCreate)
{
HashSet<IFCAnyHandle> props = currDesc.ProcessEntries(file, exporterIFC, ifcParams, elementToUse, elemTypeToUse);
if (props.Count > 0)
{
int subElementIndex = CheckElementTypeValidityForSubIndex(currDesc, prodHnd, element);
string guid = null;
if (subElementIndex > 0)
{
guid = ExporterIFCUtils.CreateSubElementGUID(elementToUse, subElementIndex);
}
else
{
guid = ExporterIFCUtils.CreateGUID();
}
string paramSetName = currDesc.Name;
IFCAnyHandle propertySet = IFCInstanceExporter.CreatePropertySet(file, guid, ownerHistory, paramSetName, null, props);
IFCAnyHandle prodHndToUse = prodHnd;
DescriptionCalculator ifcRDC = currDesc.DescriptionCalculator;
if (ifcRDC != null)
{
IFCAnyHandle overrideHnd = ifcRDC.RedirectDescription(exporterIFC, elementToUse);
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();
}
if (exporterIFC.ExportAs2x2)
ExportPsetDraughtingFor2x2(exporterIFC, element, productWrapper);
}