Example #1
0
        /// <summary>
        /// Return geometry for a particular representation item.
        /// </summary>
        /// <param name="shapeEditScope">The shape edit scope.</param>
        /// <param name="lcs">Local coordinate system for the geometry, without scale.</param>
        /// <param name="scaledLcs">Local coordinate system for the geometry, including scale, potentially non-uniform.</param>
        /// <param name="guid">The guid of an element for which represntation is being created.</param>
        /// <returns>The created geometry.</returns>
        protected override IList <GeometryObject> CreateGeometryInternal(
            IFCImportShapeEditScope shapeEditScope, Transform lcs, Transform scaledLcs, string guid)
        {
            // since IFCAdvancedBrep must contain a closed shell, we set the BuildPreferenceType to be solid for now
            for (int pass = 0; pass < 2; pass++)
            {
                using (BuilderScope bs = shapeEditScope.InitializeBuilder(IFCShapeBuilderType.BrepBuilder))
                {
                    BrepBuilderScope brepBuilderScope = bs as BrepBuilderScope;

                    BRepType brepType = (pass == 0) ? BRepType.Solid : BRepType.OpenShell;
                    brepBuilderScope.StartCollectingFaceSet(brepType);

                    Outer.AllowInvalidFace = (pass == 0);
                    Outer.CreateShape(shapeEditScope, lcs, scaledLcs, guid);

                    IList <GeometryObject> geomObjs = null;
                    geomObjs = brepBuilderScope.CreateGeometry();

                    // We'll return only if we have geometry; otherwise we'll try again with looser validation, if we can.
                    if (geomObjs != null)
                    {
                        if (pass == 1)
                        {
                            Importer.TheLog.LogError(Id, "Some faces are missing from this Solid; reading in as an Open Shell instead.", false);
                        }
                        return(geomObjs);
                    }
                }
            }

            return(null);
        }
Example #2
0
        /// <summary>
        /// Return geometry for a particular representation item.
        /// </summary>
        /// <param name="shapeEditScope">The shape edit scope.</param>
        /// <param name="lcs">Local coordinate system for the geometry, without scale.</param>
        /// <param name="scaledLcs">Local coordinate system for the geometry, including scale, potentially non-uniform.</param>
        /// <param name="guid">The guid of an element for which represntation is being created.</param>
        /// <returns>The created geometry.</returns>
        protected override IList <GeometryObject> CreateGeometryInternal(
            IFCImportShapeEditScope shapeEditScope, Transform lcs, Transform scaledLcs, string guid)
        {
            shapeEditScope.StartCollectingFaceSet();
            Outer.CreateShape(shapeEditScope, lcs, scaledLcs, guid);

            IList <GeometryObject> geomObjs = shapeEditScope.CreateGeometry(guid);

            if (geomObjs == null || geomObjs.Count == 0)
            {
                return(null);
            }

            return(geomObjs);
        }