本文整理汇总了C#中ExporterIFC.ClearFaceWithElementHandleMap方法的典型用法代码示例。如果您正苦于以下问题:C# ExporterIFC.ClearFaceWithElementHandleMap方法的具体用法?C# ExporterIFC.ClearFaceWithElementHandleMap怎么用?C# ExporterIFC.ClearFaceWithElementHandleMap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ExporterIFC
的用法示例。
在下文中一共展示了ExporterIFC.ClearFaceWithElementHandleMap方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExportRoofAsContainer
//.........这里部分代码省略.........
{
IList<GeometryObject> geometryList = new List<GeometryObject>();
geometryList.Add(geometry);
trfSetter.InitializeFromBoundingBox(exporterIFC, geometryList, extrusionCreationData);
IFCAnyHandle prodRepHnd = null;
string elementGUID = GUIDUtil.CreateGUID(element);
string elementName = NamingUtil.GetIFCName(element);
string elementDescription = NamingUtil.GetDescriptionOverride(element, null);
string elementObjectType = NamingUtil.GetObjectTypeOverride(element, exporterIFC.GetFamilyName());
string elementId = NamingUtil.CreateIFCElementId(element);
string roofType = IFCValidateEntry.GetValidIFCType(element, ifcEnumType);
IFCAnyHandle roofHandle = IFCInstanceExporter.CreateRoof(file, elementGUID, ownerHistory, elementName, elementDescription,
elementObjectType, localPlacement, prodRepHnd, elementId, roofType);
IList<IFCAnyHandle> elementHandles = new List<IFCAnyHandle>();
elementHandles.Add(roofHandle);
//only thing supported right now.
XYZ extrusionDir = new XYZ(0, 0, 1);
ElementId catId = CategoryUtil.GetSafeCategoryId(element);
IList<CurveLoop> roofCurveloops = roofComponents.GetCurveLoops();
IList<XYZ> planeDirs = roofComponents.GetPlaneDirections();
IList<XYZ> planeOrigins = roofComponents.GetPlaneOrigins();
IList<Face> loopFaces = roofComponents.GetLoopFaces();
double scaledDepth = roofComponents.ScaledDepth;
IList<double> areas = roofComponents.GetAreasOfCurveLoops();
IList<IFCAnyHandle> slabHandles = new List<IFCAnyHandle>();
using (IFCExtrusionCreationData slabExtrusionCreationData = new IFCExtrusionCreationData())
{
slabExtrusionCreationData.SetLocalPlacement(extrusionCreationData.GetLocalPlacement());
slabExtrusionCreationData.ReuseLocalPlacement = false;
slabExtrusionCreationData.ForceOffset = true;
for (int numLoop = 0; numLoop < roofCurveloops.Count; numLoop++)
{
trfSetter.InitializeFromBoundingBox(exporterIFC, geometryList, slabExtrusionCreationData);
Plane plane = new Plane(planeDirs[numLoop], planeOrigins[numLoop]);
IList<CurveLoop> curveLoops = new List<CurveLoop>();
curveLoops.Add(roofCurveloops[numLoop]);
double slope = Math.Abs(planeDirs[numLoop].Z);
double scaledExtrusionDepth = scaledDepth * slope;
IFCAnyHandle shapeRep = ExtrusionExporter.CreateExtrudedSolidFromCurveLoop(exporterIFC, null, curveLoops, plane, extrusionDir, scaledExtrusionDepth);
if (IFCAnyHandleUtil.IsNullOrHasNoValue(shapeRep))
return null;
ElementId matId = HostObjectExporter.GetFirstLayerMaterialId(element as HostObject);
BodyExporter.CreateSurfaceStyleForRepItem(exporterIFC, element.Document, shapeRep, matId);
HashSet<IFCAnyHandle> bodyItems = new HashSet<IFCAnyHandle>();
bodyItems.Add(shapeRep);
shapeRep = RepresentationUtil.CreateSweptSolidRep(exporterIFC, element, catId, exporterIFC.Get3DContextHandle("Body"), bodyItems, null);
IList<IFCAnyHandle> shapeReps = new List<IFCAnyHandle>();
shapeReps.Add(shapeRep);
IFCAnyHandle repHnd = IFCInstanceExporter.CreateProductDefinitionShape(file, null, null, shapeReps);
// Allow support for up to 256 named IfcSlab components, as defined in IFCSubElementEnums.cs.
string slabGUID = (numLoop <256) ? GUIDUtil.CreateSubElementGUID(element, (int)IFCRoofSubElements.RoofSlabStart + numLoop) : GUIDUtil.CreateGUID();
IFCAnyHandle slabPlacement = ExporterUtil.CreateLocalPlacement(file, slabExtrusionCreationData.GetLocalPlacement(), null);
IFCAnyHandle slabHnd = IFCInstanceExporter.CreateSlab(file, slabGUID, ownerHistory, elementName,
elementDescription, elementObjectType, slabPlacement, repHnd, elementId, "ROOF");
//slab quantities
slabExtrusionCreationData.ScaledLength = scaledExtrusionDepth;
slabExtrusionCreationData.ScaledArea = UnitUtil.ScaleArea(areas[numLoop]);
slabExtrusionCreationData.ScaledOuterPerimeter = UnitUtil.ScaleLength(curveLoops[0].GetExactLength());
slabExtrusionCreationData.Slope = UnitUtil.ScaleAngle(Math.Acos(Math.Abs(planeDirs[numLoop].Z)));
productWrapper.AddElement(null, slabHnd, setter, slabExtrusionCreationData, false);
elementHandles.Add(slabHnd);
slabHandles.Add(slabHnd);
}
}
productWrapper.AddElement(element, roofHandle, setter, extrusionCreationData, true);
ExporterUtil.RelateObjects(exporterIFC, null, roofHandle, slabHandles);
OpeningUtil.AddOpeningsToElement(exporterIFC, elementHandles, roofCurveloops, element, null, roofComponents.ScaledDepth,
null, setter, localPlacement, productWrapper);
transaction.Commit();
return roofHandle;
}
}
}
finally
{
exporterIFC.ClearFaceWithElementHandleMap();
}
}
}
}
示例2: ExportRoofOrFloorAsContainer
//.........这里部分代码省略.........
else
hostObjectHandle = IFCInstanceExporter.CreateSlab(file, elementGUID, ownerHistory, elementName, elementDescription,
elementObjectType, localPlacement, prodRepHnd, elementId, hostObjectType);
if (IFCAnyHandleUtil.IsNullOrHasNoValue(hostObjectHandle))
return null;
IList<IFCAnyHandle> elementHandles = new List<IFCAnyHandle>();
elementHandles.Add(hostObjectHandle);
// If element is floor, then the profile curve loop of hostObjectSubComponent is computed from the top face of the floor
// else if element is roof, then the profile curve loop is taken from the bottom face of the roof instead
XYZ extrusionDir = elementIsFloor ? new XYZ(0, 0, -1) : new XYZ(0, 0, 1);
ElementId catId = CategoryUtil.GetSafeCategoryId(element);
IList<IFCAnyHandle> slabHandles = new List<IFCAnyHandle>();
IList<CurveLoop> hostObjectOpeningLoops = new List<CurveLoop>();
double maximumScaledDepth = 0.0;
using (IFCExtrusionCreationData slabExtrusionCreationData = new IFCExtrusionCreationData())
{
slabExtrusionCreationData.SetLocalPlacement(extrusionCreationData.GetLocalPlacement());
slabExtrusionCreationData.ReuseLocalPlacement = false;
slabExtrusionCreationData.ForceOffset = true;
int loopNum = 0;
int subElementStart = elementIsRoof ? (int)IFCRoofSubElements.RoofSlabStart : (int)IFCSlabSubElements.SubSlabStart;
string subSlabType = elementIsRoof ? "ROOF" : hostObjectType;
foreach (HostObjectSubcomponentInfo hostObjectSubcomponent in hostObjectSubcomponents)
{
trfSetter.InitializeFromBoundingBox(exporterIFC, geometryList, slabExtrusionCreationData);
Plane plane = hostObjectSubcomponent.GetPlane();
IList<CurveLoop> curveLoops = new List<CurveLoop>();
CurveLoop slabCurveLoop = hostObjectSubcomponent.GetCurveLoop();
curveLoops.Add(slabCurveLoop);
double slope = Math.Abs(plane.Normal.Z);
double scaledDepth = UnitUtil.ScaleLength(hostObjectSubcomponent.Depth);
double scaledExtrusionDepth = scaledDepth * slope;
IFCAnyHandle shapeRep = ExtrusionExporter.CreateExtrudedSolidFromCurveLoop(exporterIFC, null, curveLoops, plane, extrusionDir, scaledExtrusionDepth);
if (IFCAnyHandleUtil.IsNullOrHasNoValue(shapeRep))
return null;
ElementId matId = HostObjectExporter.GetFirstLayerMaterialId(element as HostObject);
BodyExporter.CreateSurfaceStyleForRepItem(exporterIFC, element.Document, shapeRep, matId);
HashSet<IFCAnyHandle> bodyItems = new HashSet<IFCAnyHandle>();
bodyItems.Add(shapeRep);
shapeRep = RepresentationUtil.CreateSweptSolidRep(exporterIFC, element, catId, exporterIFC.Get3DContextHandle("Body"), bodyItems, null);
IList<IFCAnyHandle> shapeReps = new List<IFCAnyHandle>();
shapeReps.Add(shapeRep);
IFCAnyHandle repHnd = IFCInstanceExporter.CreateProductDefinitionShape(file, null, null, shapeReps);
// Allow support for up to 256 named IfcSlab components, as defined in IFCSubElementEnums.cs.
string slabGUID = (loopNum < 256) ? GUIDUtil.CreateSubElementGUID(element, subElementStart + loopNum) : GUIDUtil.CreateGUID();
IFCAnyHandle slabPlacement = ExporterUtil.CreateLocalPlacement(file, slabExtrusionCreationData.GetLocalPlacement(), null);
IFCAnyHandle slabHnd = IFCInstanceExporter.CreateSlab(file, slabGUID, ownerHistory, elementName,
elementDescription, elementObjectType, slabPlacement, repHnd, elementId, subSlabType);
//slab quantities
slabExtrusionCreationData.ScaledLength = scaledExtrusionDepth;
slabExtrusionCreationData.ScaledArea = UnitUtil.ScaleArea(UnitUtil.ScaleArea(hostObjectSubcomponent.AreaOfCurveLoop));
slabExtrusionCreationData.ScaledOuterPerimeter = UnitUtil.ScaleLength(curveLoops[0].GetExactLength());
slabExtrusionCreationData.Slope = UnitUtil.ScaleAngle(MathUtil.SafeAcos(Math.Abs(slope)));
productWrapper.AddElement(null, slabHnd, setter, slabExtrusionCreationData, false);
elementHandles.Add(slabHnd);
slabHandles.Add(slabHnd);
hostObjectOpeningLoops.Add(slabCurveLoop);
maximumScaledDepth = Math.Max(maximumScaledDepth, scaledDepth);
loopNum++;
}
}
productWrapper.AddElement(element, hostObjectHandle, setter, extrusionCreationData, true);
ExporterUtil.RelateObjects(exporterIFC, null, hostObjectHandle, slabHandles);
OpeningUtil.AddOpeningsToElement(exporterIFC, elementHandles, hostObjectOpeningLoops, element, null, maximumScaledDepth,
null, setter, localPlacement, productWrapper);
transaction.Commit();
return hostObjectHandle;
}
}
}
finally
{
exporterIFC.ClearFaceWithElementHandleMap();
}
}
}
}