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


C# ExporterIFC.GetDoorWindowOpeningHandle方法代码示例

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


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

示例1: Create

        /// <summary>
        /// Creates a creator from DoorWindowInfo.
        /// </summary>
        /// <param name="exporterIFC">The exporter.</param>
        /// <param name="doorWindowInfo">The DoorWindowInfo.</param>
        /// <param name="instanceHandle">The instance handle.</param>
        /// <param name="levelId">The level id.</param>
        /// <returns>The creator.</returns>
        public static DoorWindowDelayedOpeningCreator Create(ExporterIFC exporterIFC, DoorWindowInfo doorWindowInfo, IFCAnyHandle instanceHandle, ElementId levelId)
        {
            if (exporterIFC == null || doorWindowInfo == null)
                return null;

            DoorWindowDelayedOpeningCreator doorWindowDelayedOpeningCreator = null;

            if (doorWindowInfo.HasRealWallHost)
            {
                Document doc = doorWindowInfo.HostObject.Document;
                Wall wall = doorWindowInfo.HostObject as Wall;
                FamilyInstance famInst = doorWindowInfo.InsertInstance;
                ElementId hostId = wall != null ? wall.Id : ElementId.InvalidElementId;
                ElementId instId = famInst != null ? famInst.Id : ElementId.InvalidElementId;

                doorWindowDelayedOpeningCreator = new DoorWindowDelayedOpeningCreator();
                doorWindowDelayedOpeningCreator.HostId = hostId;
                doorWindowDelayedOpeningCreator.InsertId = instId;
                doorWindowDelayedOpeningCreator.PosHingeSide = doorWindowInfo.PosHingeSide;
                doorWindowDelayedOpeningCreator.DoorWindowHnd = instanceHandle;
                doorWindowDelayedOpeningCreator.LevelId = levelId;
                doorWindowDelayedOpeningCreator.CreatedFromDoorWindowInfo = true;

                WallType wallType = doc.GetElement(wall.GetTypeId()) as WallType;
                double unScaledWidth = ((wallType != null) && (wallType.Kind != WallKind.Curtain)) ? wallType.Width : 0.0;
                if (!MathUtil.IsAlmostZero(unScaledWidth))
                {
                    IFCAnyHandle openingHnd = exporterIFC.GetDoorWindowOpeningHandle(instId);
                    if (IFCAnyHandleUtil.IsNullOrHasNoValue(openingHnd))
                    {
                        XYZ cutDir = null;
                        CurveLoop cutLoop = null;
                        try
                        {
                            cutLoop = ExporterIFCUtils.GetInstanceCutoutFromWall(wall.Document, wall, famInst, out cutDir);
                        }
                        catch
                        {
                            cutLoop = null;
                            // Couldn't create opening for door in wall - report as error in log when we create log file.
                        }

                        if (cutLoop != null)
                        {
                            if (doorWindowDelayedOpeningCreator.ExtrusionData == null)
                                doorWindowDelayedOpeningCreator.ExtrusionData = new List<IFCExtrusionData>();

                            IFCExtrusionData extrusionData = new IFCExtrusionData();
                            extrusionData.ExtrusionDirection = cutDir;
                            extrusionData.ScaledExtrusionLength = UnitUtil.ScaleLength(unScaledWidth);
                            extrusionData.AddLoop(cutLoop);
                            doorWindowDelayedOpeningCreator.ScaledHostWidth = UnitUtil.ScaleLength(unScaledWidth);
                            doorWindowDelayedOpeningCreator.ExtrusionData.Add(extrusionData);
                            doorWindowDelayedOpeningCreator.HasValidGeometry = true;
                        }
                        else
                        {
                            // Couldn't create opening for door in wall - report as error in log when we create log file.
                        }
                    }
                }
            }

            return doorWindowDelayedOpeningCreator;
        }
开发者ID:whztt07,项目名称:RevitCustomIFCexporter,代码行数:73,代码来源:DoorWindowDelayedOpeningCreator.cs


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