/// <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 DSSurface Trim(DSCurve[] curves, DSPlane[] planes, DSSurface[] surfaces, DSSolid[] solids, DSPoint selectPoint, bool autoExtend) { if (null == selectPoint) throw new System.ArgumentNullException("selectPoint"); ICurveEntity[] hostCurves = curves.ConvertAll(DSGeometryExtension.ToEntity<DSCurve, ICurveEntity>); IPlaneEntity[] hostPlanes = planes.ConvertAll(DSGeometryExtension.ToEntity<DSPlane, IPlaneEntity>); ISurfaceEntity[] hostSurfaces = surfaces.ConvertAll(DSGeometryExtension.ToEntity<DSSurface, ISurfaceEntity>); ISolidEntity[] hostSolids = solids.ConvertAll(DSGeometryExtension.ToEntity<DSSolid, ISolidEntity>); IPointEntity hostPoint = selectPoint.PointEntity; if (hostCurves == null && hostPlanes == null && hostSurfaces == null && hostSolids == null) throw new System.ArgumentException(string.Format(Properties.Resources.InvalidInput, "DSGeometry", "DSSurface.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); }
private static ISolidEntity LoftFromCrossSectionsPathCore(DSCurve[] crossSections, DSCurve path) { //Get all closed host xsections. ICurveEntity[] xsections = crossSections.ConvertAll((DSCurve c) => DSGeometryExtension.GetCurveEntity(c, true)); if (xsections == null || xsections.Length < 2) throw new System.ArgumentException(string.Format(Properties.Resources.InvalidArguments, "cross sections"), "crossSections"); if (path == null) throw new ArgumentNullException("path"); ISolidEntity entity = HostFactory.Factory.SolidByLoftCrossSectionsPath(xsections, path.CurveEntity); if (entity == null) throw new InvalidOperationException(string.Format(Properties.Resources.OperationFailed, "DSSolid.LoftFromCrossSectionsPath")); return entity; }