コード例 #1
0
ファイル: BeamExporter.cs プロジェクト: bimone/IFC-for-Revit
        /// <summary>
        /// Creates a new IfcBeamType and relates it to the current element.
        /// </summary>
        /// <param name="exporterIFC">The exporter.</param>
        /// <param name="wrapper">The ProductWrapper class.</param>
        /// <param name="elementHandle">The element handle.</param>
        /// <param name="element">The element.</param>
        /// <param name="overrideMaterialId">The material id used for the element type.</param>
        public static void ExportBeamType(ExporterIFC exporterIFC, ProductWrapper wrapper, IFCAnyHandle elementHandle, Element element, string predefinedType)
        {
            if (elementHandle == null || element == null)
            {
                return;
            }

            Document  doc         = element.Document;
            ElementId typeElemId  = element.GetTypeId();
            Element   elementType = doc.GetElement(typeElemId);

            if (elementType == null)
            {
                return;
            }

            IFCAnyHandle beamType = ExporterCacheManager.ElementToHandleCache.Find(typeElemId);

            if (!IFCAnyHandleUtil.IsNullOrHasNoValue(beamType))
            {
                ExporterCacheManager.TypeRelationsCache.Add(beamType, elementHandle);
                return;
            }

            // Property sets will be set later.
            beamType = IFCInstanceExporter.CreateBeamType(exporterIFC.GetFile(), elementType, null, null, predefinedType);

            wrapper.RegisterHandleWithElementType(elementType as ElementType, beamType, null);

            ExporterCacheManager.TypeRelationsCache.Add(beamType, elementHandle);
        }
コード例 #2
0
        /// <summary>
        /// Creates a new IfcBeamType and relates it to the current element.
        /// </summary>
        /// <param name="exporterIFC">The exporter.</param>
        /// <param name="wrapper">The ProductWrapper class.</param>
        /// <param name="elementHandle">The element handle.</param>
        /// <param name="element">The element.</param>
        /// <param name="overrideMaterialId">The material id used for the element type.</param>
        public static void ExportBeamType(ExporterIFC exporterIFC, ProductWrapper wrapper, IFCAnyHandle elementHandle, Element element, string predefinedType)
        {
            if (elementHandle == null || element == null)
            {
                return;
            }

            Document  doc         = element.Document;
            ElementId typeElemId  = element.GetTypeId();
            Element   elementType = doc.GetElement(typeElemId);

            if (elementType == null)
            {
                return;
            }

            IFCAnyHandle beamType = ExporterCacheManager.ElementToHandleCache.Find(typeElemId);

            if (!IFCAnyHandleUtil.IsNullOrHasNoValue(beamType))
            {
                ExporterCacheManager.TypeRelationsCache.Add(beamType, elementHandle);
                return;
            }

            string elemGUID = GUIDUtil.CreateGUID(elementType);
            string elemName = NamingUtil.GetNameOverride(elementType, NamingUtil.GetIFCName(elementType));
            string elemDesc = NamingUtil.GetDescriptionOverride(elementType, null);
            string elemTag  = NamingUtil.GetTagOverride(elementType, NamingUtil.CreateIFCElementId(elementType));
            string elemApplicableOccurence = NamingUtil.GetOverrideStringValue(elementType, "IfcApplicableOccurence", null);
            string elemElementType         = NamingUtil.GetOverrideStringValue(elementType, "IfcElementType", null);

            // Property sets will be set later.
            beamType = IFCInstanceExporter.CreateBeamType(exporterIFC.GetFile(), elemGUID, ExporterCacheManager.OwnerHistoryHandle,
                                                          elemName, elemDesc, elemApplicableOccurence, null, null, elemTag, elemElementType, GetBeamType(elementType, predefinedType));

            wrapper.RegisterHandleWithElementType(elementType as ElementType, beamType, null);

            ExporterCacheManager.TypeRelationsCache.Add(beamType, elementHandle);
            ExporterCacheManager.ElementToHandleCache.Register(typeElemId, beamType);
        }
コード例 #3
0
ファイル: BeamExporter.cs プロジェクト: zfcJerry/revit-ifc
        /// <summary>
        /// Creates a new IfcBeamType and relates it to the current element.
        /// </summary>
        /// <param name="exporterIFC">The exporter.</param>
        /// <param name="wrapper">The ProductWrapper class.</param>
        /// <param name="elementHandle">The element handle.</param>
        /// <param name="element">The element.</param>
        /// <param name="overrideMaterialId">The material id used for the element type.</param>
        public static void ExportBeamType(ExporterIFC exporterIFC, ProductWrapper wrapper, IFCAnyHandle elementHandle, Element element, string predefinedType)
        {
            if (elementHandle == null || element == null)
            {
                return;
            }

            Document    doc         = element.Document;
            ElementId   typeElemId  = element.GetTypeId();
            ElementType elementType = doc.GetElement(typeElemId) as ElementType;

            if (elementType == null)
            {
                return;
            }

            string preDefinedTypeSearch = predefinedType;

            if (string.IsNullOrEmpty(preDefinedTypeSearch))
            {
                preDefinedTypeSearch = "NULL";
            }
            IFCExportInfoPair exportType = new IFCExportInfoPair();

            exportType.SetValueWithPair(IFCEntityType.IfcBeamType, preDefinedTypeSearch);
            IFCAnyHandle beamType = ExporterCacheManager.ElementTypeToHandleCache.Find(elementType, exportType);

            if (!IFCAnyHandleUtil.IsNullOrHasNoValue(beamType))
            {
                ExporterCacheManager.TypeRelationsCache.Add(beamType, elementHandle);
                return;
            }

            // Property sets will be set later.
            beamType = IFCInstanceExporter.CreateBeamType(exporterIFC.GetFile(), elementType, null, null, predefinedType);

            wrapper.RegisterHandleWithElementType(elementType, exportType, beamType, null);

            ExporterCacheManager.TypeRelationsCache.Add(beamType, elementHandle);
        }