当前位置: 首页>>代码示例>>C#>>正文


C# ExporterIFC.GetFamilyNameFromExportState方法代码示例

本文整理汇总了C#中ExporterIFC.GetFamilyNameFromExportState方法的典型用法代码示例。如果您正苦于以下问题:C# ExporterIFC.GetFamilyNameFromExportState方法的具体用法?C# ExporterIFC.GetFamilyNameFromExportState怎么用?C# ExporterIFC.GetFamilyNameFromExportState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ExporterIFC的用法示例。


在下文中一共展示了ExporterIFC.GetFamilyNameFromExportState方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ExportFloor

        /// <summary>
        /// Exports a floor to IFC slab.
        /// </summary>
        /// <param name="exporterIFC">
        /// The ExporterIFC object.
        /// </param>
        /// <param name="floor">
        /// The floor element.
        /// </param>
        /// <param name="geometryElement">
        /// The geometry element.
        /// </param>
        /// <param name="ifcEnumType">
        /// The string value represents the IFC type.
        /// </param>
        /// <param name="productWrapper">
        /// The IFCProductWrapper.
        /// </param>
        /// <returns>
        /// True if the floor is exported successfully, false otherwise.
        /// </returns>
        public static void ExportFloor(ExporterIFC exporterIFC, Floor floor, GeometryElement geometryElement, IFCProductWrapper productWrapper)
        {
            if (geometryElement == null)
                return;

            IFCFile file = exporterIFC.GetFile();

            using (IFCTransaction tr = new IFCTransaction(file))
            {
                using (IFCTransformSetter transformSetter = IFCTransformSetter.Create())
                {
                    using (IFCPlacementSetter placementSetter = IFCPlacementSetter.Create(exporterIFC, floor))
                    {
                        IFCAnyHandle localPlacement = placementSetter.GetPlacement();
                        IFCAnyHandle ownerHistory = exporterIFC.GetOwnerHistoryHandle();

                        string ifcEnumType = CategoryUtil.GetIFCEnumTypeName(exporterIFC, floor);

                        double scale = exporterIFC.LinearScale;
                        ElementId catId = CategoryUtil.GetSafeCategoryId(floor);

                        IList<IFCAnyHandle> reps = new List<IFCAnyHandle>();
                        IList<IList<CurveLoop>> extrusionLoops = new List<IList<CurveLoop>>();
                        IList<IFCExtrusionCreationData> loopExtraParams = new List<IFCExtrusionCreationData>();
                        Plane floorPlane = GeometryUtil.CreateDefaultPlane();

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

                        bool exportedAsExtrusion = ExporterIFCUtils.ExportSlabAsExtrusion(exporterIFC, floor, geometryElement,
                              transformSetter, localPlacement, out localPlacements, out reps, out extrusionLoops, out loopExtraParams, floorPlane);
                        // We will use the ExtrusionAnalyzer when it is ready.
                        //            XYZ extrusionDirection = { 0, 0, -1 };
                        //            XYZ modelOrigin = { 0, 0, 0 };
                        //            XYZ floorOrigin = floor.GetVerticalProjectionPoint(modelOrigin, FloorFace.Top);
                        //            XYZ floorDir = floor.GetNormalAtVerticalProjectionPoint(floorOrigin, FloorFace.Top);
                        //            Plane floorPlane(floorDir, floorOrigin);          
                        //            ExtrusionAnalyzer floorExtrusion = 
                        //                ExtrusionAnalyzer.Create(geometryElement, floorPlane, extrusionDirection);

                        if (!exportedAsExtrusion)
                        {
                            IFCAnyHandle bodyRep = null;
                            IList<GeometryObject> geomObjects = new List<GeometryObject>();
                            geomObjects.Add(geometryElement);
                            bodyRep = BodyExporter.ExportBody(floor.Document.Application, exporterIFC, catId, geomObjects, true, null);
                            if (bodyRep == null || !bodyRep.HasValue)
                            {
                                tr.Commit();
                                return;
                            }

                            IFCAnyHandle prodDefHnd = file.CreateProductDefinitionShape(bodyRep);
                            if (!prodDefHnd.HasValue)
                                return;

                            reps.Add(prodDefHnd);
                        }

                        // Create the slab from either the extrusion or the BRep information.
                        IFCLabel ifcGUID = IFCLabel.CreateGUID(floor);

                        IList<IFCAnyHandle> slabHnds = new List<IFCAnyHandle>();
                        int numReps = reps.Count;
                        for (int ii = 0; ii < numReps; ii++)
                        {
                            IFCLabel ifcName = NamingUtil.GetNameOverride(floor, NamingUtil.CreateIFCName(exporterIFC, ii == 0 ? -1 : ii + 1));
                            IFCLabel ifcDescription = NamingUtil.GetDescriptionOverride(floor, IFCLabel.Create());
                            IFCLabel ifcObjectType = NamingUtil.GetObjectTypeOverride(floor, exporterIFC.GetFamilyNameFromExportState());
                            IFCLabel ifcElemId = NamingUtil.CreateIFCElementId(floor);

                            IFCLabel currentGUID = (ii == 0) ? ifcGUID : IFCLabel.CreateGUID();
                            IFCAnyHandle localPlacementHnd = exportedAsExtrusion ? localPlacements[ii] : localPlacement;

                            IFCAnyHandle slabHnd = file.CreateSlab(currentGUID,
                               ownerHistory,
                               ifcName,
                               ifcDescription,
                               ifcObjectType,
                               localPlacementHnd,
//.........这里部分代码省略.........
开发者ID:whztt07,项目名称:RevitCustomIFCexporter,代码行数:101,代码来源:FloorExporter.cs


注:本文中的ExporterIFC.GetFamilyNameFromExportState方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。