本文整理汇总了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);
}
示例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;
}