本文整理汇总了C#中BIM.IFC.Utility.ProductWrapper.ToNative方法的典型用法代码示例。如果您正苦于以下问题:C# ProductWrapper.ToNative方法的具体用法?C# ProductWrapper.ToNative怎么用?C# ProductWrapper.ToNative使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BIM.IFC.Utility.ProductWrapper
的用法示例。
在下文中一共展示了ProductWrapper.ToNative方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExportFloor
//.........这里部分代码省略.........
BodyData bodyData;
IFCAnyHandle prodDefHnd = RepresentationUtil.CreateBRepProductDefinitionShape(floorElement.Document.Application, exporterIFC,
floorElement, catId, geometryElement, bodyExporterOptions, null, ecData, out bodyData);
if (IFCAnyHandleUtil.IsNullOrHasNoValue(prodDefHnd))
{
ecData.ClearOpenings();
return;
}
prodReps.Add(prodDefHnd);
repTypes.Add(bodyData.ShapeRepresentationType);
}
}
}
// Create the slab from either the extrusion or the BRep information.
string ifcGUID = GUIDUtil.CreateGUID(floorElement);
int numReps = exportParts ? 1 : prodReps.Count;
for (int ii = 0; ii < numReps; ii++)
{
string ifcName = NamingUtil.GetIFCNamePlusIndex(floorElement, ii == 0 ? -1 : ii + 1);
string ifcDescription = NamingUtil.GetDescriptionOverride(floorElement, null);
string ifcObjectType = NamingUtil.GetObjectTypeOverride(floorElement, exporterIFC.GetFamilyName());
string ifcElemId = NamingUtil.CreateIFCElementId(floorElement);
string currentGUID = (ii == 0) ? ifcGUID : GUIDUtil.CreateGUID();
IFCAnyHandle localPlacementHnd = exportedAsInternalExtrusion ? localPlacements[ii] : localPlacement;
IFCSlabType slabType = GetIFCSlabType(ifcEnumType);
IFCAnyHandle slabHnd = IFCInstanceExporter.CreateSlab(file, currentGUID, ownerHistory, ifcName,
ifcDescription, ifcObjectType, localPlacementHnd, exportParts ? null : prodReps[ii], ifcElemId, slabType);
if (IFCAnyHandleUtil.IsNullOrHasNoValue(slabHnd))
return;
if (exportParts)
{
PartExporter.ExportHostPart(exporterIFC, floorElement, slabHnd, productWrapper, placementSetter, localPlacementHnd, null);
}
slabHnds.Add(slabHnd);
if (!exportParts)
{
if (repTypes[ii] == ShapeRepresentationType.Brep)
brepSlabHnds.Add(slabHnd);
else
nonBrepSlabHnds.Add(slabHnd);
}
}
bool associateElementToLevel = LevelUtil.AssociateElementToLevel(floorElement);
for (int ii = 0; ii < numReps; ii++)
{
IFCExtrusionCreationData loopExtraParam = ii < loopExtraParams.Count ? loopExtraParams[ii] : null;
productWrapper.AddElement(slabHnds[ii], placementSetter, loopExtraParam, associateElementToLevel);
}
if (exportedAsInternalExtrusion)
ExporterIFCUtils.ExportExtrudedSlabOpenings(exporterIFC, floorElement, placementSetter,
localPlacements[0], slabHnds, extrusionLoops, floorPlane, productWrapper.ToNative());
PropertyUtil.CreateInternalRevitPropertySets(exporterIFC, floorElement, productWrapper);
}
if (!exportParts)
{
if (floorElement is HostObject && nonBrepSlabHnds.Count > 0)
{
HostObjectExporter.ExportHostObjectMaterials(exporterIFC, floorElement as HostObject, nonBrepSlabHnds,
geometryElement, productWrapper, ElementId.InvalidElementId, Toolkit.IFCLayerSetDirection.Axis3);
}
if (floorElement is HostObject && brepSlabHnds.Count > 0)
{
IList<ElementId> matIds = HostObjectExporter.GetMaterialIds(floorElement as HostObject);
Document doc = floorElement.Document;
foreach (IFCAnyHandle slabHnd in brepSlabHnds)
{
CategoryUtil.CreateMaterialAssociations(doc, exporterIFC, slabHnd, matIds);
}
}
if (floorElement is FamilyInstance && slabHnds.Count > 0)
{
ElementId matId = BodyExporter.GetBestMaterialIdFromGeometryOrParameter(geometryElement, exporterIFC, floorElement);
Document doc = floorElement.Document;
foreach (IFCAnyHandle slabHnd in slabHnds)
{
CategoryUtil.CreateMaterialAssociation(doc, exporterIFC, slabHnd, matId);
}
}
}
}
tr.Commit();
return;
}
}
示例2: ExportCovering
/// <summary>
/// Exports an element as IFC covering.
/// </summary>
/// <param name="exporterIFC">
/// The ExporterIFC object.
/// </param>
/// <param name="element">
/// The element to be exported.
/// </param>
/// <param name="geometryElement">
/// The geometry element.
/// </param>
/// <param name="productWrapper">
/// The ProductWrapper.
/// </param>
public static void ExportCovering(ExporterIFC exporterIFC, Element element, GeometryElement geomElem, string ifcEnumType, ProductWrapper productWrapper)
{
bool exportParts = PartExporter.CanExportParts(element);
if (exportParts && !PartExporter.CanExportElementInPartExport(element, element.Level.Id, false))
return;
ElementType elemType = element.Document.GetElement(element.GetTypeId()) as ElementType;
IFCFile file = exporterIFC.GetFile();
using (IFCTransaction transaction = new IFCTransaction(file))
{
using (IFCPlacementSetter setter = IFCPlacementSetter.Create(exporterIFC, element))
{
IFCAnyHandle prodRep = exportParts ? null : RepresentationUtil.CreateSurfaceProductDefinitionShape(exporterIFC,
element, geomElem, false, false);
string instanceGUID = GUIDUtil.CreateGUID(element);
string instanceName = NamingUtil.GetIFCName(element);
string instanceDescription = NamingUtil.GetDescriptionOverride(element, null);
string instanceObjectType = NamingUtil.GetObjectTypeOverride(element, exporterIFC.GetFamilyName());
string instanceElemId = NamingUtil.CreateIFCElementId(element);
Toolkit.IFCCoveringType coveringType = GetIFCCoveringType(element, ifcEnumType);
IFCAnyHandle covering = IFCInstanceExporter.CreateCovering(file, instanceGUID, exporterIFC.GetOwnerHistoryHandle(),
instanceName, instanceDescription, instanceObjectType, setter.GetPlacement(), prodRep, instanceElemId, coveringType);
if (exportParts)
{
PartExporter.ExportHostPart(exporterIFC, element, covering, productWrapper, setter, setter.GetPlacement(), null);
}
productWrapper.AddElement(covering, setter, null, LevelUtil.AssociateElementToLevel(element));
Ceiling ceiling = element as Ceiling;
if (ceiling != null && !exportParts)
{
HostObjectExporter.ExportHostObjectMaterials(exporterIFC, ceiling, covering,
geomElem, productWrapper, ElementId.InvalidElementId, Toolkit.IFCLayerSetDirection.Axis3);
}
if (ExporterCacheManager.ExportOptionsCache.PropertySetOptions.ExportIFCCommon)
ExporterIFCUtils.CreateCoveringPropertySet(exporterIFC, element, productWrapper.ToNative());
PropertyUtil.CreateInternalRevitPropertySets(exporterIFC, element, productWrapper);
}
transaction.Commit();
}
}
示例3: Export
/// <summary>
/// Exports a roof to IfcRoof.
/// </summary>
/// <param name="exporterIFC">The ExporterIFC object.</param>
/// <param name="roof">The roof element.</param>
/// <param name="geometryElement">The geometry element.</param>
/// <param name="productWrapper">The ProductWrapper.</param>
public static void Export(ExporterIFC exporterIFC, RoofBase roof, GeometryElement geometryElement, ProductWrapper productWrapper)
{
IFCFile file = exporterIFC.GetFile();
using (IFCTransaction tr = new IFCTransaction(file))
{
// export parts or not
bool exportParts = PartExporter.CanExportParts(roof);
bool exportAsCurtainRoof = CurtainSystemExporter.IsCurtainSystem(roof);
if (exportParts)
{
if (!PartExporter.CanExportElementInPartExport(roof, roof.Level.Id, false))
return;
ExportRoofAsParts(exporterIFC, roof, geometryElement, productWrapper); // Right now, only flat roof could have parts.
}
else if (exportAsCurtainRoof)
{
CurtainSystemExporter.ExportCurtainRoof(exporterIFC, roof, productWrapper);
}
else
{
string ifcEnumType = ExporterUtil.GetIFCTypeFromExportTable(exporterIFC, roof);
IFCAnyHandle roofHnd = ExporterIFCUtils.ExportRoofAsContainer(exporterIFC, ifcEnumType, roof,
geometryElement, productWrapper.ToNative());
if (IFCAnyHandleUtil.IsNullOrHasNoValue(roofHnd))
ExportRoof(exporterIFC, ifcEnumType, roof, geometryElement, productWrapper);
// call for host objects; curtain roofs excused from call (no material information)
HostObjectExporter.ExportHostObjectMaterials(exporterIFC, roof, productWrapper.GetAnElement(),
geometryElement, productWrapper, ElementId.InvalidElementId, IFCLayerSetDirection.Axis3, null);
}
tr.Commit();
}
}