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


C# Solid.ConvertAll方法代码示例

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


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

示例1: Trim

        /// <summary>
        /// 
        /// </summary>
        /// <param name="curves"></param>
        /// <param name="planes"></param>
        /// <param name="surfaces"></param>
        /// <param name="solids"></param>
        /// <param name="selectPoint"></param>
        /// <param name="autoExtend"></param>
        /// <returns></returns>
        public Surface Trim(Curve[] curves, Plane[] planes, Surface[] surfaces, Solid[] solids, Point selectPoint, bool autoExtend)
        {
            if (null == selectPoint)
                throw new System.ArgumentNullException("selectPoint");

            ICurveEntity[] hostCurves = curves.ConvertAll(GeometryExtension.ToEntity<Curve, ICurveEntity>);
            IPlaneEntity[] hostPlanes = planes.ConvertAll(GeometryExtension.ToEntity<Plane, IPlaneEntity>);
            ISurfaceEntity[] hostSurfaces = surfaces.ConvertAll(GeometryExtension.ToEntity<Surface, ISurfaceEntity>);
            ISolidEntity[] hostSolids = solids.ConvertAll(GeometryExtension.ToEntity<Solid, ISolidEntity>);

            IPointEntity hostPoint = selectPoint.PointEntity;

            if (hostCurves == null && hostPlanes == null && hostSurfaces == null && hostSolids == null)
                throw new System.ArgumentException(string.Format(Properties.Resources.InvalidInput, "Geometry", "Surface.Trim"));

            ISurfaceEntity trimSurface = SurfaceEntity.Trim(hostCurves, hostPlanes, hostSurfaces, hostSolids, hostPoint, autoExtend);

            //For trim operation, if the return value is not null, hide the original tools and surfaces.
            if (null != trimSurface)
            {
                Hide(curves);
                Hide(planes);
                Hide(surfaces);
                Hide(solids);
                SetVisibility(false);
            }

            return trimSurface.ToSurf(true, this);
        }
开发者ID:samuto,项目名称:designscript,代码行数:39,代码来源:Surface.cs

示例2: SelectTrim

        public static Surface[] SelectTrim(Surface[] surfaces, Solid[] trimmingSolids, bool keepInside)
        {
            string kMethodName = "Surface.SelectTrim";
            ISurfaceEntity[] surfacehosts = surfaces.ConvertAll(GeometryExtension.ToEntity<Surface, ISurfaceEntity>);
            if (surfacehosts == null || surfacehosts.Length == 0)
                throw new System.ArgumentException(string.Format(Properties.Resources.InvalidInput, "surfaces", kMethodName), "surfaces");

            ISolidEntity[] solidhosts = trimmingSolids.ConvertAll(GeometryExtension.ToEntity<Solid, ISolidEntity>);
            if (null == solidhosts || solidhosts.Length == 0)
                throw new System.ArgumentException(string.Format(Properties.Resources.InvalidInput, "trimmingSolids", kMethodName), "trimmingSolids");

            Surface[] result = null;
            if (solidhosts.Length == 1)
            {
                result = SelectTrimCore(surfacehosts, solidhosts[0], keepInside);
            }
            else
            {
                Solid unionSolid = Solid.UnionCore(solidhosts[0], solidhosts, false);
                if (null == unionSolid)
                    throw new System.InvalidOperationException(string.Format(Properties.Resources.OperationFailed, kMethodName));

                result = SelectTrimCore(surfacehosts, unionSolid.SolidEntity, keepInside);
            }

            if (null != result)
            {
                Hide(surfaces);
                Hide(trimmingSolids);
            }

            return result;
        }
开发者ID:samuto,项目名称:designscript,代码行数:33,代码来源:Surface.cs


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