Пример #1
0
        public static IIFCBooleanOperand ProcessIFCBooleanOperand(IFCAnyHandle ifcBooleanOperand)
        {
            if (IFCAnyHandleUtil.IsNullOrHasNoValue(ifcBooleanOperand))
            {
                //LOG: ERROR: IfcSolidModel is null or has no value
                return(null);
            }

            if (IFCAnyHandleUtil.IsValidSubTypeOf(ifcBooleanOperand, IFCEntityType.IfcBooleanResult))
            {
                return(IFCBooleanResult.ProcessIFCBooleanResult(ifcBooleanOperand));
            }
            else if (IFCAnyHandleUtil.IsValidSubTypeOf(ifcBooleanOperand, IFCEntityType.IfcHalfSpaceSolid))
            {
                return(IFCHalfSpaceSolid.ProcessIFCHalfSpaceSolid(ifcBooleanOperand));
            }
            else if (IFCAnyHandleUtil.IsValidSubTypeOf(ifcBooleanOperand, IFCEntityType.IfcSolidModel))
            {
                return(IFCSolidModel.ProcessIFCSolidModel(ifcBooleanOperand));
            }
            else if (IFCAnyHandleUtil.IsValidSubTypeOf(ifcBooleanOperand, IFCEntityType.IfcCsgPrimitive3D))
            {
                return(IFCCsgPrimitive3D.ProcessIFCCsgPrimitive3D(ifcBooleanOperand));
            }

            Importer.TheLog.LogUnhandledSubTypeError(ifcBooleanOperand, "IfcBooleanOperand", true);
            return(null);
        }
Пример #2
0
        /// <summary>
        /// Processes an IfcRepresentationItem entity handle.
        /// </summary>
        /// <param name="ifcRepresentationItem">The IfcRepresentationItem handle.</param>
        /// <returns>The IFCRepresentationItem object.</returns>
        public static IFCRepresentationItem ProcessIFCRepresentationItem(IFCAnyHandle ifcRepresentationItem)
        {
            if (IFCAnyHandleUtil.IsSubTypeOf(ifcRepresentationItem, IFCEntityType.IfcBooleanResult))
            {
                return(IFCBooleanResult.ProcessIFCBooleanResult(ifcRepresentationItem));
            }
            if (IFCAnyHandleUtil.IsSubTypeOf(ifcRepresentationItem, IFCEntityType.IfcCurve))
            {
                return(IFCCurve.ProcessIFCCurve(ifcRepresentationItem));
            }
            if (IFCAnyHandleUtil.IsSubTypeOf(ifcRepresentationItem, IFCEntityType.IfcFaceBasedSurfaceModel))
            {
                return(IFCFaceBasedSurfaceModel.ProcessIFCFaceBasedSurfaceModel(ifcRepresentationItem));
            }
            if (IFCAnyHandleUtil.IsSubTypeOf(ifcRepresentationItem, IFCEntityType.IfcGeometricSet))
            {
                return(IFCGeometricSet.ProcessIFCGeometricSet(ifcRepresentationItem));
            }
            if (IFCAnyHandleUtil.IsSubTypeOf(ifcRepresentationItem, IFCEntityType.IfcMappedItem))
            {
                return(IFCMappedItem.ProcessIFCMappedItem(ifcRepresentationItem));
            }
            if (IFCAnyHandleUtil.IsSubTypeOf(ifcRepresentationItem, IFCEntityType.IfcShellBasedSurfaceModel))
            {
                return(IFCShellBasedSurfaceModel.ProcessIFCShellBasedSurfaceModel(ifcRepresentationItem));
            }
            if (IFCAnyHandleUtil.IsSubTypeOf(ifcRepresentationItem, IFCEntityType.IfcSolidModel))
            {
                return(IFCSolidModel.ProcessIFCSolidModel(ifcRepresentationItem));
            }

            if (IFCImportFile.TheFile.SchemaVersion >= IFCSchemaVersion.IFC2x2 && IFCAnyHandleUtil.IsSubTypeOf(ifcRepresentationItem, IFCEntityType.IfcStyledItem))
            {
                return(IFCStyledItem.ProcessIFCStyledItem(ifcRepresentationItem));
            }

            if (IFCImportFile.TheFile.SchemaVersion >= IFCSchemaVersion.IFC4 && IFCAnyHandleUtil.IsSubTypeOf(ifcRepresentationItem, IFCEntityType.IfcTriangulatedFaceSet))
            {
                return(IFCTriangulatedFaceSet.ProcessIFCTriangulatedFaceSet(ifcRepresentationItem));
            }

            if (IFCImportFile.TheFile.SchemaVersion >= IFCSchemaVersion.IFC4Add2 && IFCAnyHandleUtil.IsSubTypeOf(ifcRepresentationItem, IFCEntityType.IfcPolygonalFaceSet))
            {
                return(IFCPolygonalFaceSet.ProcessIFCPolygonalFaceSet(ifcRepresentationItem));
            }

            if (IFCAnyHandleUtil.IsSubTypeOf(ifcRepresentationItem, IFCEntityType.IfcTopologicalRepresentationItem))
            {
                return(IFCTopologicalRepresentationItem.ProcessIFCTopologicalRepresentationItem(ifcRepresentationItem));
            }

            Importer.TheLog.LogUnhandledSubTypeError(ifcRepresentationItem, IFCEntityType.IfcRepresentationItem, true);
            return(null);
        }
Пример #3
0
        override protected void Process(IFCAnyHandle solid)
        {
            base.Process(solid);

            IFCAnyHandle treeRootExpression = IFCImportHandleUtil.GetRequiredInstanceAttribute(solid, "TreeRootExpression", false);
            if (!IFCAnyHandleUtil.IsNullOrHasNoValue(treeRootExpression))
            {
                if (IFCAnyHandleUtil.IsSubTypeOf(treeRootExpression, IFCEntityType.IfcBooleanResult))
                    BooleanResult = IFCBooleanResult.ProcessIFCBooleanResult(treeRootExpression);
                else
                    Importer.TheLog.LogUnhandledSubTypeError(treeRootExpression, "IfcCsgSelect", false);
            }
        }
Пример #4
0
        /// <summary>
        /// Create an IFCBooleanResult object from a handle of type IfcBooleanResult.
        /// </summary>
        /// <param name="ifcBooleanResult">The IFC handle.</param>
        /// <returns>The IFCBooleanResult object.</returns>
        public static IFCBooleanResult ProcessIFCBooleanResult(IFCAnyHandle ifcBooleanResult)
        {
            if (IFCAnyHandleUtil.IsNullOrHasNoValue(ifcBooleanResult))
            {
                Importer.TheLog.LogNullError(IFCEntityType.IfcBooleanResult);
                return(null);
            }

            IFCEntity booleanResult;

            if (!IFCImportFile.TheFile.EntityMap.TryGetValue(ifcBooleanResult.StepId, out booleanResult))
            {
                booleanResult = new IFCBooleanResult(ifcBooleanResult);
            }
            return(booleanResult as IFCBooleanResult);
        }
Пример #5
0
        override protected void Process(IFCAnyHandle solid)
        {
            base.Process(solid);

            IFCAnyHandle treeRootExpression = IFCImportHandleUtil.GetRequiredInstanceAttribute(solid, "TreeRootExpression", false);

            if (!IFCAnyHandleUtil.IsNullOrHasNoValue(treeRootExpression))
            {
                if (IFCAnyHandleUtil.IsSubTypeOf(treeRootExpression, IFCEntityType.IfcBooleanResult))
                {
                    BooleanResult = IFCBooleanResult.ProcessIFCBooleanResult(treeRootExpression);
                }
                else
                {
                    IFCImportFile.TheLog.LogUnhandledSubTypeError(treeRootExpression, "IfcCsgSelect", false);
                }
            }
        }
Пример #6
0
        /// <summary>
        /// Processes an IfcRepresentationItem entity handle.
        /// </summary>
        /// <param name="ifcRepresentationItem">The IfcRepresentationItem handle.</param>
        /// <returns>The IFCRepresentationItem object.</returns>
        public static IFCRepresentationItem ProcessIFCRepresentationItem(IFCAnyHandle ifcRepresentationItem)
        {
            if (IFCAnyHandleUtil.IsSubTypeOf(ifcRepresentationItem, IFCEntityType.IfcBooleanResult))
            {
                return(IFCBooleanResult.ProcessIFCBooleanResult(ifcRepresentationItem));
            }
            if (IFCAnyHandleUtil.IsSubTypeOf(ifcRepresentationItem, IFCEntityType.IfcConnectedFaceSet))
            {
                return(IFCConnectedFaceSet.ProcessIFCConnectedFaceSet(ifcRepresentationItem));
            }
            if (IFCAnyHandleUtil.IsSubTypeOf(ifcRepresentationItem, IFCEntityType.IfcCurve))
            {
                return(IFCCurve.ProcessIFCCurve(ifcRepresentationItem));
            }
            if (IFCAnyHandleUtil.IsSubTypeOf(ifcRepresentationItem, IFCEntityType.IfcFaceBasedSurfaceModel))
            {
                return(IFCFaceBasedSurfaceModel.ProcessIFCFaceBasedSurfaceModel(ifcRepresentationItem));
            }
            if (IFCAnyHandleUtil.IsSubTypeOf(ifcRepresentationItem, IFCEntityType.IfcGeometricSet))
            {
                return(IFCGeometricSet.ProcessIFCGeometricSet(ifcRepresentationItem));
            }
            if (IFCAnyHandleUtil.IsSubTypeOf(ifcRepresentationItem, IFCEntityType.IfcMappedItem))
            {
                return(IFCMappedItem.ProcessIFCMappedItem(ifcRepresentationItem));
            }
            if (IFCAnyHandleUtil.IsSubTypeOf(ifcRepresentationItem, IFCEntityType.IfcShellBasedSurfaceModel))
            {
                return(IFCShellBasedSurfaceModel.ProcessIFCShellBasedSurfaceModel(ifcRepresentationItem));
            }
            if (IFCAnyHandleUtil.IsSubTypeOf(ifcRepresentationItem, IFCEntityType.IfcSolidModel))
            {
                return(IFCSolidModel.ProcessIFCSolidModel(ifcRepresentationItem));
            }
            if (IFCAnyHandleUtil.IsSubTypeOf(ifcRepresentationItem, IFCEntityType.IfcStyledItem))
            {
                return(IFCStyledItem.ProcessIFCStyledItem(ifcRepresentationItem));
            }

            IFCImportFile.TheLog.LogUnhandledSubTypeError(ifcRepresentationItem, IFCEntityType.IfcRepresentationItem, true);
            return(null);
        }
Пример #7
0
        /// <summary>
        /// Create an IFCBooleanResult object from a handle of type IfcBooleanResult.
        /// </summary>
        /// <param name="ifcBooleanResult">The IFC handle.</param>
        /// <returns>The IFCBooleanResult object.</returns>
        public static IFCBooleanResult ProcessIFCBooleanResult(IFCAnyHandle ifcBooleanResult)
        {
            if (IFCAnyHandleUtil.IsNullOrHasNoValue(ifcBooleanResult))
            {
                IFCImportFile.TheLog.LogNullError(IFCEntityType.IfcBooleanResult);
                return null;
            }

            IFCEntity booleanResult;
            if (!IFCImportFile.TheFile.EntityMap.TryGetValue(ifcBooleanResult.StepId, out booleanResult))
                booleanResult = new IFCBooleanResult(ifcBooleanResult);
            return (booleanResult as IFCBooleanResult);
        }
Пример #8
0
        /// <summary>
        /// Processes an IfcRepresentationItem entity handle.
        /// </summary>
        /// <param name="ifcRepresentationItem">The IfcRepresentationItem handle.</param>
        /// <returns>The IFCRepresentationItem object.</returns>
        public static IFCRepresentationItem ProcessIFCRepresentationItem(IFCAnyHandle ifcRepresentationItem)
        {
            if (IFCAnyHandleUtil.IsNullOrHasNoValue(ifcRepresentationItem))
            {
                Importer.TheLog.LogNullError(IFCEntityType.IfcRepresentationItem);
                return(null);
            }

            if (IFCAnyHandleUtil.IsValidSubTypeOf(ifcRepresentationItem, IFCEntityType.IfcBooleanResult))
            {
                return(IFCBooleanResult.ProcessIFCBooleanResult(ifcRepresentationItem));
            }
            if (IFCAnyHandleUtil.IsValidSubTypeOf(ifcRepresentationItem, IFCEntityType.IfcCurve))
            {
                return(IFCCurve.ProcessIFCCurve(ifcRepresentationItem));
            }
            if (IFCAnyHandleUtil.IsValidSubTypeOf(ifcRepresentationItem, IFCEntityType.IfcFaceBasedSurfaceModel))
            {
                return(IFCFaceBasedSurfaceModel.ProcessIFCFaceBasedSurfaceModel(ifcRepresentationItem));
            }
            if (IFCAnyHandleUtil.IsValidSubTypeOf(ifcRepresentationItem, IFCEntityType.IfcGeometricSet))
            {
                return(IFCGeometricSet.ProcessIFCGeometricSet(ifcRepresentationItem));
            }
            if (IFCAnyHandleUtil.IsValidSubTypeOf(ifcRepresentationItem, IFCEntityType.IfcMappedItem))
            {
                return(IFCMappedItem.ProcessIFCMappedItem(ifcRepresentationItem));
            }
            if (IFCAnyHandleUtil.IsValidSubTypeOf(ifcRepresentationItem, IFCEntityType.IfcShellBasedSurfaceModel))
            {
                return(IFCShellBasedSurfaceModel.ProcessIFCShellBasedSurfaceModel(ifcRepresentationItem));
            }
            if (IFCAnyHandleUtil.IsValidSubTypeOf(ifcRepresentationItem, IFCEntityType.IfcSolidModel))
            {
                return(IFCSolidModel.ProcessIFCSolidModel(ifcRepresentationItem));
            }

            if (IFCImportFile.TheFile.SchemaVersion >= IFCSchemaVersion.IFC2x2 && IFCAnyHandleUtil.IsSubTypeOf(ifcRepresentationItem, IFCEntityType.IfcStyledItem))
            {
                return(IFCStyledItem.ProcessIFCStyledItem(ifcRepresentationItem));
            }

            if (IFCImportFile.TheFile.SchemaVersion >= IFCSchemaVersion.IFC4 && IFCAnyHandleUtil.IsSubTypeOf(ifcRepresentationItem, IFCEntityType.IfcTriangulatedFaceSet))
            {
                return(IFCTriangulatedFaceSet.ProcessIFCTriangulatedFaceSet(ifcRepresentationItem));
            }

            // There is no way to actually determine an IFC4Add2 file vs. a "vanilla" IFC4 file, which is
            // obsolete.  The try/catch here allows us to read these obsolete files without crashing.
            try
            {
                if (IFCImportFile.TheFile.SchemaVersion >= IFCSchemaVersion.IFC4 && IFCAnyHandleUtil.IsSubTypeOf(ifcRepresentationItem, IFCEntityType.IfcPolygonalFaceSet))
                {
                    return(IFCPolygonalFaceSet.ProcessIFCPolygonalFaceSet(ifcRepresentationItem));
                }
            }
            catch
            {
            }

            if (IFCAnyHandleUtil.IsSubTypeOf(ifcRepresentationItem, IFCEntityType.IfcTopologicalRepresentationItem))
            {
                return(IFCTopologicalRepresentationItem.ProcessIFCTopologicalRepresentationItem(ifcRepresentationItem));
            }

            Importer.TheLog.LogUnhandledSubTypeError(ifcRepresentationItem, IFCEntityType.IfcRepresentationItem, true);
            return(null);
        }
Пример #9
0
        /// <summary>
        /// Processes an IfcRepresentationItem entity handle.
        /// </summary>
        /// <param name="ifcRepresentationItem">The IfcRepresentationItem handle.</param>
        /// <returns>The IFCRepresentationItem object.</returns>
        public static IFCRepresentationItem ProcessIFCRepresentationItem(IFCAnyHandle ifcRepresentationItem)
        {
            if (IFCAnyHandleUtil.IsNullOrHasNoValue(ifcRepresentationItem))
            {
                Importer.TheLog.LogNullError(IFCEntityType.IfcRepresentationItem);
                return(null);
            }

            if (IFCAnyHandleUtil.IsValidSubTypeOf(ifcRepresentationItem, IFCEntityType.IfcMappedItem))
            {
                return(IFCMappedItem.ProcessIFCMappedItem(ifcRepresentationItem));
            }
            if (IFCImportFile.TheFile.SchemaVersionAtLeast(IFCSchemaVersion.IFC2x2) && IFCAnyHandleUtil.IsSubTypeOf(ifcRepresentationItem, IFCEntityType.IfcStyledItem))
            {
                return(IFCStyledItem.ProcessIFCStyledItem(ifcRepresentationItem));
            }
            if (IFCAnyHandleUtil.IsSubTypeOf(ifcRepresentationItem, IFCEntityType.IfcTopologicalRepresentationItem))
            {
                return(IFCTopologicalRepresentationItem.ProcessIFCTopologicalRepresentationItem(ifcRepresentationItem));
            }

            // TODO: Move everything below to IFCGeometricRepresentationItem, once it is created.
            if (IFCAnyHandleUtil.IsValidSubTypeOf(ifcRepresentationItem, IFCEntityType.IfcBooleanResult))
            {
                return(IFCBooleanResult.ProcessIFCBooleanResult(ifcRepresentationItem));
            }
            if (IFCAnyHandleUtil.IsValidSubTypeOf(ifcRepresentationItem, IFCEntityType.IfcCurve))
            {
                return(IFCCurve.ProcessIFCCurve(ifcRepresentationItem));
            }
            if (IFCAnyHandleUtil.IsValidSubTypeOf(ifcRepresentationItem, IFCEntityType.IfcFaceBasedSurfaceModel))
            {
                return(IFCFaceBasedSurfaceModel.ProcessIFCFaceBasedSurfaceModel(ifcRepresentationItem));
            }
            if (IFCAnyHandleUtil.IsValidSubTypeOf(ifcRepresentationItem, IFCEntityType.IfcGeometricSet))
            {
                return(IFCGeometricSet.ProcessIFCGeometricSet(ifcRepresentationItem));
            }
            if (IFCAnyHandleUtil.IsValidSubTypeOf(ifcRepresentationItem, IFCEntityType.IfcPoint))
            {
                return(IFCPoint.ProcessIFCPoint(ifcRepresentationItem));
            }
            if (IFCAnyHandleUtil.IsValidSubTypeOf(ifcRepresentationItem, IFCEntityType.IfcShellBasedSurfaceModel))
            {
                return(IFCShellBasedSurfaceModel.ProcessIFCShellBasedSurfaceModel(ifcRepresentationItem));
            }
            if (IFCAnyHandleUtil.IsValidSubTypeOf(ifcRepresentationItem, IFCEntityType.IfcSolidModel))
            {
                return(IFCSolidModel.ProcessIFCSolidModel(ifcRepresentationItem));
            }

            // TODO: Move the items below to IFCGeometricRepresentationItem->IFCTessellatedItem->IfcTessellatedFaceSet.
            if (IFCImportFile.TheFile.SchemaVersionAtLeast(IFCSchemaVersion.IFC4Obsolete) && IFCAnyHandleUtil.IsSubTypeOf(ifcRepresentationItem, IFCEntityType.IfcTriangulatedFaceSet))
            {
                return(IFCTriangulatedFaceSet.ProcessIFCTriangulatedFaceSet(ifcRepresentationItem));
            }
            // There is no way to actually determine an IFC4Add2 file vs. a "vanilla" IFC4 file, which is
            // obsolete.  The try/catch here allows us to read these obsolete files without crashing.
            try
            {
                if (IFCImportFile.TheFile.SchemaVersionAtLeast(IFCSchemaVersion.IFC4) && IFCAnyHandleUtil.IsSubTypeOf(ifcRepresentationItem, IFCEntityType.IfcPolygonalFaceSet))
                {
                    return(IFCPolygonalFaceSet.ProcessIFCPolygonalFaceSet(ifcRepresentationItem));
                }
            }
            catch (Exception ex)
            {
                // Once we fail once, downgrade the schema so we don't try again.
                if (IFCImportFile.HasUndefinedAttribute(ex))
                {
                    IFCImportFile.TheFile.DowngradeIFC4SchemaTo(IFCSchemaVersion.IFC4Add1Obsolete);
                }
                else
                {
                    throw ex;
                }
            }

            Importer.TheLog.LogUnhandledSubTypeError(ifcRepresentationItem, IFCEntityType.IfcRepresentationItem, true);
            return(null);
        }