Exemple #1
0
        /// <summary>
        /// Creates walk line representations from stair walk lines.
        /// </summary>
        /// <param name="exporterIFC">The exporter.</param>
        /// <param name="legacyStair">The stair.</param>
        /// <param name="legacyStairElem">The stair element.</param>
        /// <returns>The walk line representation handles.  Some of them may be null.</returns>
        static IList<IFCAnyHandle> CreateWalkLineReps(ExporterIFC exporterIFC, IFCLegacyStairOrRamp legacyStair, Element legacyStairElem)
        {
            IList<IFCAnyHandle> walkLineReps = new List<IFCAnyHandle>();
            IFCAnyHandle contextOfItemsWalkLine = exporterIFC.Get3DContextHandle("Axis");
            
            ElementId cateId = CategoryUtil.GetSafeCategoryId(legacyStairElem);
            Plane plane = new Plane(XYZ.BasisZ, XYZ.Zero);
            XYZ projDir = XYZ.BasisZ;

            IList<IList<Curve>> curvesArr = legacyStair.GetWalkLines();
            foreach (IList<Curve> curves in curvesArr)
            {
                IFCAnyHandle curve = GeometryUtil.CreateIFCCurveFromCurves(exporterIFC, curves, plane, projDir);
                if (!IFCAnyHandleUtil.IsNullOrHasNoValue(curve))
                {
                    HashSet<IFCAnyHandle> bodyItems = new HashSet<IFCAnyHandle>();
                    bodyItems.Add(curve);
                    walkLineReps.Add(RepresentationUtil.CreateShapeRepresentation(exporterIFC, legacyStairElem, cateId,
                        contextOfItemsWalkLine, "Axis", "Curve2D", bodyItems));
                }
                else
                    walkLineReps.Add(null);
            }
            return walkLineReps;
        }
Exemple #2
0
        /// <summary>
        /// Creates boundary line representations from stair boundary lines.
        /// </summary>
        /// <param name="exporterIFC">The exporter.</param>
        /// <param name="legacyStair">The stair.</param>
        /// <param name="legacyStairElem">The stair element.</param>
        /// <returns>Boundary line representations.</returns>
        static IList<IFCAnyHandle> CreateBoundaryLineReps(ExporterIFC exporterIFC, IFCLegacyStairOrRamp legacyStair, Element legacyStairElem)
        {
            IFCAnyHandle contextOfItemsBoundary = exporterIFC.Get3DContextHandle("FootPrint");

            IList<IFCAnyHandle> boundaryLineReps = new List<IFCAnyHandle>();

            IFCFile file = exporterIFC.GetFile();
            ElementId cateId = CategoryUtil.GetSafeCategoryId(legacyStairElem);

            HashSet<IFCAnyHandle> curveSet = new HashSet<IFCAnyHandle>();
            IList<CurveLoop> boundaryLines = legacyStair.GetBoundaryLines();
            foreach (CurveLoop curveLoop in boundaryLines)
            {
                Plane plane = new Plane(XYZ.BasisZ, XYZ.Zero);
                foreach (Curve curve in curveLoop)
                {
                    IFCGeometryInfo info = IFCGeometryInfo.CreateCurveGeometryInfo(exporterIFC, plane, XYZ.BasisZ, false);
                    ExporterIFCUtils.CollectGeometryInfo(exporterIFC, info, curve, XYZ.Zero, false);
                    IList<IFCAnyHandle> curves = info.GetCurves();
                    if (curves.Count == 1 && !IFCAnyHandleUtil.IsNullOrHasNoValue(curves[0]))
                    {
                        curveSet.Add(curves[0]);
                    }
                }
                IFCAnyHandle curveRepresentationItem = IFCInstanceExporter.CreateGeometricSet(file, curveSet);
                HashSet<IFCAnyHandle> bodyItems = new HashSet<IFCAnyHandle>();
                bodyItems.Add(curveRepresentationItem);
                IFCAnyHandle boundaryLineRep = RepresentationUtil.CreateGeometricSetRep(exporterIFC, legacyStairElem, cateId, "FootPrint",
                   contextOfItemsBoundary, bodyItems);
                boundaryLineReps.Add(boundaryLineRep);
            }
            return boundaryLineReps;
        }