コード例 #1
0
ファイル: Point.cs プロジェクト: radumg/DesignScriptStudio
        /// <summary>
        /// Constructors a point by projecting a point on a plane with given project direction.
        /// </summary>
        /// <param name="contextPlane">Plane of projection</param>
        /// <param name="direction">Projection direction</param>
        /// <returns>Point</returns>
        public DSPoint Project(DSPlane contextPlane, DSVector direction)
        {
            if (contextPlane == null)
            {
                throw new ArgumentNullException("contextPlane");
            }
            else if (direction == null)
            {
                throw new ArgumentNullException("direction");
            }
            else if (direction.IsZeroVector())
            {
                throw new ArgumentException(string.Format(Properties.Resources.IsZeroVector, "direction"));
            }
            else if (direction.IsPerpendicular(contextPlane.Normal))
            {
                throw new ArgumentException(string.Format(Properties.Resources.IsParallel, "contextPlane", "direction", "DSPoint.Project"));
            }

            var pt = contextPlane.Project(this, direction);

            pt.Context        = contextPlane;
            pt.ReferencePoint = this;
            pt.Direction      = direction;
            pt.Persist();
            return(pt);
        }
コード例 #2
0
ファイル: Point.cs プロジェクト: radumg/DesignScriptStudio
        internal override IGeometryEntity[] ProjectOn(DSGeometry other, DSVector direction)
        {
            IVector   dir  = direction.IVector;
            DSSurface surf = other as DSSurface;

            if (null != surf)
            {
                return(surf.SurfaceEntity.Project(PointEntity, dir));
            }

            DSCurve curve = other as DSCurve;

            if (null != curve)
            {
                IPointEntity pt = curve.CurveEntity.Project(PointEntity, dir);
                return(new IGeometryEntity[] { pt });
            }

            DSPlane plane = other as DSPlane;

            if (null != plane)
            {
                IPointEntity pt = plane.PlaneEntity.Project(PointEntity, dir);
                return(new IGeometryEntity[] { pt });
            }

            DSSolid solid = other as DSSolid;

            if (null != solid)
            {
                return(solid.SolidEntity.Project(PointEntity, dir));
            }

            return(base.ProjectOn(other, direction));
        }
コード例 #3
0
ファイル: Plane.cs プロジェクト: radumg/DesignScriptStudio
        private DSPlane Offset(DSVector offset)
        {
            IPointEntity origin    = Origin.PointEntity;
            IPointEntity newOrigin = origin.Add(offset);
            DSPlane      plane     = DSPlane.ByOriginNormal(newOrigin.ToPoint(false, null), Normal, Size);

            plane.Context = this;
            return(plane);
        }
コード例 #4
0
ファイル: Plane.cs プロジェクト: radumg/DesignScriptStudio
        /// <summary>
        /// Constructors a plane on a surface by given parameter. 
        /// </summary>
        /// <param name="contextSurface"></param>
        /// <param name="u"></param>
        /// <param name="v"></param>
        /// <returns></returns>
        public static DSPlane AtParameter(DSSurface contextSurface, double u, double v)
        {
            DSCoordinateSystem cs    = DSCoordinateSystem.AtParameterCore(contextSurface, u, v, false);
            DSPlane            plane = DSPlane.FromCoordinateSystem(cs);

            plane.Context = contextSurface;
            plane.U       = u;
            plane.V       = v;
            return(plane);
        }
コード例 #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="plane"></param>
        /// <param name="selectPoint"></param>
        /// <param name="autoExtend"></param>
        /// <returns></returns>
        public DSSurface Trim(DSPlane plane, DSPoint selectPoint, bool autoExtend)
        {
            if (null == plane)
            {
                throw new System.ArgumentNullException("plane");
            }

            DSPlane[] planes = { plane };
            return(Trim(null, planes, null, null, selectPoint, autoExtend));
        }
コード例 #6
0
        /// <summary>
        /// Split this surface using a plane as cutting tool.
        /// </summary>
        /// <param name="splittingPlane">Plane as cutting tool.</param>
        /// <returns>Array of surfaces.</returns>
        public DSSurface[] Split(DSPlane splittingPlane)
        {
            ISurfaceEntity[] splitSurfaces = SurfaceEntity.Split(splittingPlane.HostImpl as IPlaneEntity);

            if (null == splitSurfaces || splitSurfaces.Length < 1)
            {
                throw new System.InvalidOperationException(string.Format(Properties.Resources.OperationFailed, "DSSurface.Split"));
            }

            return(splitSurfaces.ConvertAll((ISurfaceEntity host) => host.ToSurf(true, this)));
        }
コード例 #7
0
        public DSGeometry[] Intersect(DSGeometry other)
        {
            if (null == other)
            {
                throw new ArgumentNullException("other");
            }

            IGeometryEntity[] geoms = null;
            DSPlane           plane = other as DSPlane;

            if (plane != null)
            {
                geoms = IntersectWithPlane(plane);
            }
            else
            {
                DSSurface surf = other as DSSurface;
                if (surf != null)
                {
                    geoms = IntersectWithSurface(surf);
                }
                else
                {
                    DSSolid solid = other as DSSolid;
                    if (solid != null)
                    {
                        geoms = IntersectWithSolid(solid);
                    }
                    else
                    {
                        DSCurve curve = other as DSCurve;
                        if (curve != null)
                        {
                            geoms = IntersectWithCurve(curve);
                        }
                        else
                        {
                            DSPoint point = other as DSPoint;
                            if (null != point)
                            {
                                geoms = IntersectWithPoint(point);
                            }
                            else
                            {
                                throw new System.InvalidOperationException(string.Format(Properties.Resources.InvalidIntersect, GetType().Name, other.GetType().Name));
                            }
                        }
                    }
                }
            }

            return(geoms.ToArray <DSGeometry, IGeometryEntity>(true));
        }
コード例 #8
0
ファイル: Plane.cs プロジェクト: radumg/DesignScriptStudio
        internal override IGeometryEntity[] IntersectWithPlane(DSPlane plane)
        {
            ILineEntity line = PlaneEntity.IntersectWith(plane.PlaneEntity);

            if (null != line)
            {
                return new IGeometryEntity[] { line }
            }
            ;

            return(null);
        }
コード例 #9
0
ファイル: Point.cs プロジェクト: radumg/DesignScriptStudio
        /// <summary>
        /// Constructors a point by projecting a point on a plane. It is
        /// equivalent to finding the nearest point on the plane.
        /// </summary>
        /// <param name="contextPlane">Plane of projection</param>
        /// <returns>Point</returns>
        public DSPoint Project(DSPlane contextPlane)
        {
            if (contextPlane == null)
            {
                throw new ArgumentNullException("contextPlane");
            }

            var pt = contextPlane.Project(this);

            pt.Context        = contextPlane;
            pt.ReferencePoint = this;
            pt.Persist();
            return(pt);
        }
コード例 #10
0
ファイル: Plane.cs プロジェクト: radumg/DesignScriptStudio
        private static DSPlane FromCoordinateSystem(DSCoordinateSystem cs)
        {
            if (null == cs)
            {
                return(null);
            }

            DSPlane plane = DSPlane.ByOriginNormal(cs.Origin, cs.ZAxis);

            if (null == plane)
            {
                return(null);
            }

            plane.ContextCoordinateSystem = cs;
            return(plane);
        }
コード例 #11
0
ファイル: Plane.cs プロジェクト: radumg/DesignScriptStudio
        internal override DSGeometry TransformBy(ICoordinateSystemEntity csEntity)
        {
            //Let the default code handle orthogonal transform.
            if (csEntity.IsScaledOrtho())
            {
                return(base.TransformBy(csEntity));
            }

            using (IPointEntity origin = Origin.PointEntity.CopyAndTransform(DSCoordinateSystem.WCS.CSEntity, csEntity) as IPointEntity)
            {
                using (IPointEntity pt = Origin.PointEntity.CopyAndTranslate(Normal.IVector) as IPointEntity)
                {
                    using (IPointEntity transformPt = pt.CopyAndTransform(DSCoordinateSystem.WCS.CSEntity, csEntity) as IPointEntity)
                    {
                        DSVector normal = origin.GetVectorTo(transformPt).Normalize();
                        return(DSPlane.ByOriginNormal(origin.ToPoint(false, null), normal, Size));
                    }
                }
            }
        }
コード例 #12
0
ファイル: Solid.cs プロジェクト: seasailor/designscript
        public DSSolid[] Slice(DSPlane plane, bool isRegular)
        {
            if (null == plane)
            {
                throw new ArgumentNullException("plane");
            }

            IGeometryEntity[] solids = null;
            if (isRegular)
            {
                solids = SolidEntity.SliceWithPlane(plane.PlaneEntity);
            }
            else
            {
                solids = new IGeometryEntity[] { SolidEntity.NonRegularSliceWithPlane(plane.PlaneEntity) }
            };
            if (solids == null || solids.Length == 0)
            {
                throw new System.Exception(string.Format(Properties.Resources.OperationFailed, "DSSolid.Slice"));
            }
            return(solids.ToArray <DSSolid, IGeometryEntity>(true));
        }
コード例 #13
0
ファイル: Surface.cs プロジェクト: samuto/designscript
 internal override IGeometryEntity[] IntersectWithPlane(DSPlane plane)
 {
     return SurfaceEntity.IntersectWith(plane.PlaneEntity);
 }
コード例 #14
0
ファイル: Curve.cs プロジェクト: samuto/designscript
        /// <summary>
        /// Returns the projection of the curve on the plane with given direction
        /// Argument Requirement:
        /// direction.Length > 0
        /// </summary>
        /// <param name="contextPlane">Projection plane</param>
        /// <param name="direction">Projection direction</param>
        /// <returns>Projected curve on the context plane</returns>
        public DSCurve Project(DSPlane contextPlane, DSVector direction)
        {
            string kMethodName = "DSCurve.Project";
            if (null == contextPlane)
                throw new System.ArgumentNullException("contextPlane");
            else if (null == direction)
                throw new System.ArgumentNullException("direction");
            if (direction.Length.EqualsTo(0.0))
                throw new System.ArgumentException(string.Format(Properties.Resources.IsZero, "length of the direction vector"), "direction");
            if (direction.IsPerpendicular(contextPlane.Normal))
                return null;

            ICurveEntity entity = CurveEntity.ProjectOn(contextPlane.PlaneEntity, direction.IVector);
            if (null == entity)
                throw new System.InvalidOperationException(string.Format(Properties.Resources.OperationFailed, kMethodName));

            return entity.ToCurve(true, this);
        }
コード例 #15
0
ファイル: Solid.cs プロジェクト: seasailor/designscript
        ///// <summary>
        /////
        ///// </summary>
        ///// <returns></returns>
        //public Solid Regularise()
        //{
        //    ISolidEntity host = SolidEntity.Regularise();
        //    if (host == null)
        //        throw new System.Exception(string.Format(Properties.Resources.OperationFailed, "Solid.Regularise"));
        //    return host.ToSolid(true, this);
        //}

        /// <summary>
        /// Returns an array of solids (manifold or non-manifold) by slicing
        /// a Solid (manifold or non-manifold) with a Plane
        /// </summary>
        /// <param name="plane">The slicing Plane</param>
        /// <returns>Returns an array of Solids (manifold or non-manifold)</returns>
        public DSSolid[] Slice(DSPlane plane)
        {
            return(Slice(plane, true));
        }
コード例 #16
0
ファイル: Curve.cs プロジェクト: samuto/designscript
        /// <summary><para>
        /// Returns an array of planes located on the curve with equal distance. 
        /// The tangents at the points are the normals of the planes. </para>
        /// <para> Argument Requirement:
        ///             numberOfPoints > 0
        /// </para>
        /// </summary>
        /// <param name="numberOfPlanes"></param>
        /// <returns></returns>
        public DSPlane[] PlanesAtEqualArcLength(int numberOfPlanes)
        {
            if (numberOfPlanes < 1)
                throw new System.ArgumentException(string.Format(Properties.Resources.LessThan, "number of planes", "one"), "numberOfPlanes");

            IPointEntity[] pts = PointsAtEqualArcLengthCore(numberOfPlanes);
            if (null == pts)
                throw new System.ArgumentException(string.Format(Properties.Resources.InvalidArguments, "number of planes"), "numberOfPlanes");

            DSPlane[] plns = new DSPlane[pts.Length];
            int i = 0;
            foreach (var p in pts)
            {
                double param = CurveEntity.ParameterAtPoint(p);
                try
                {
                    plns[i++] = PlaneAtParameter(param);
                }
                catch
                {
                    //Proceed with next iteration.
                }
                p.Dispose();
            }

            return plns;
        }
コード例 #17
0
ファイル: Curve.cs プロジェクト: samuto/designscript
        /// <summary>
        /// Returns the projection of this curve on a given plane with plane 
        /// normal as direction
        /// </summary>
        /// <param name="contextPlane">Projection plane</param>
        /// <returns>Projected curve on the context plane</returns>
        public DSCurve Project(DSPlane contextPlane)
        {
            string kMethodName = "DSCurve.Project";
            if (null == contextPlane)
                throw new System.ArgumentNullException("contextPlane");

            ICurveEntity entity = CurveEntity.ProjectOn(contextPlane.PlaneEntity, contextPlane.Normal.IVector);
            if (entity == null)
                throw new System.InvalidOperationException(string.Format(Properties.Resources.OperationFailed, kMethodName));

            return entity.ToCurve(true, this);
        }
コード例 #18
0
ファイル: Polygon.cs プロジェクト: samuto/designscript
        /// <summary>
        /// Returns trimmed polygon after trimming this polygon using the 
        /// given array of planes as half spaces.
        /// </summary>
        /// <param name="halfSpaces">Trimming planes.</param>
        /// <returns>Trimmed Polygon</returns>
        public DSPolygon Trim(DSPlane[] halfSpaces)
        {
            IPlaneEntity[] hosts = halfSpaces.ConvertAll(DSGeometryExtension.ToEntity<DSPlane, IPlaneEntity>);
            IPolygonEntity entity = PolygonEntity.Trim(hosts);
            if (null == entity)
                return null;

            Hide(this);
            Hide(halfSpaces);

            return new DSPolygon(entity, true);
        }
コード例 #19
0
ファイル: Plane.cs プロジェクト: samuto/designscript
        internal override IGeometryEntity[] IntersectWithPlane(DSPlane plane)
        {
            ILineEntity line = PlaneEntity.IntersectWith(plane.PlaneEntity);
            if (null != line)
                return new IGeometryEntity[] { line };

            return null;
        }
コード例 #20
0
ファイル: Solid.cs プロジェクト: seasailor/designscript
 /// <summary>
 ///
 /// </summary>
 /// <param name="plane"></param>
 /// <param name="selectPoint"></param>
 /// <returns></returns>
 public DSSolid Trim(DSPlane plane, DSPoint selectPoint)
 {
     DSPlane[] planes = { plane };
     return(Trim(planes, null, null, selectPoint));
 }
コード例 #21
0
ファイル: Surface.cs プロジェクト: samuto/designscript
        /// <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);
        }
コード例 #22
0
ファイル: Solid.cs プロジェクト: samuto/designscript
 public DSSolid[] Slice(DSPlane[] planes, bool isRegular)
 {
     return SliceWithPlanes(planes, isRegular);
 }
コード例 #23
0
ファイル: Solid.cs プロジェクト: samuto/designscript
 /// <summary>
 /// Returns an array of solids (manifold or non-manifold) by slicing 
 /// a Solid (manifold or non-manifold) with an array of Planes
 /// </summary>
 /// <param name="planes">Array of slicing Planes</param>
 /// <returns>Returns an array of Solids (manifold or non-manifold)</returns>
 public DSSolid[] Slice(DSPlane[] planes)
 {
     return SliceWithPlanes(planes, true);
 }
コード例 #24
0
ファイル: Solid.cs プロジェクト: samuto/designscript
        public DSSolid[] Slice(DSPlane plane, bool isRegular)
        {
            if (null == plane)
                throw new ArgumentNullException("plane");

            IGeometryEntity[] solids = null;
            if (isRegular)
                solids = SolidEntity.SliceWithPlane(plane.PlaneEntity);
            else
                solids = new IGeometryEntity[] { SolidEntity.NonRegularSliceWithPlane(plane.PlaneEntity) };
            if (solids == null || solids.Length == 0)
                throw new System.Exception(string.Format(Properties.Resources.OperationFailed, "DSSolid.Slice"));
            return solids.ToArray<DSSolid, IGeometryEntity>(true);
        }
コード例 #25
0
ファイル: Solid.cs プロジェクト: samuto/designscript
 ///// <summary>
 ///// 
 ///// </summary>
 ///// <returns></returns>
 //public Solid Regularise()
 //{
 //    ISolidEntity host = SolidEntity.Regularise();
 //    if (host == null)
 //        throw new System.Exception(string.Format(Properties.Resources.OperationFailed, "Solid.Regularise"));
 //    return host.ToSolid(true, this);
 //}
 /// <summary>
 /// Returns an array of solids (manifold or non-manifold) by slicing 
 /// a Solid (manifold or non-manifold) with a Plane 
 /// </summary>
 /// <param name="plane">The slicing Plane</param>
 /// <returns>Returns an array of Solids (manifold or non-manifold)</returns>
 public DSSolid[] Slice(DSPlane plane)
 {
     return Slice(plane, true);
 }
コード例 #26
0
ファイル: Solid.cs プロジェクト: samuto/designscript
 private DSSolid[] SliceWithPlanes(DSPlane[] planes, bool isRegular)
 {
     IPlaneEntity[] planeHosts = planes.ConvertAll(DSGeometryExtension.ToEntity<DSPlane, IPlaneEntity>);
     if (null == planeHosts || planeHosts.Length == 0)
         throw new System.ArgumentException(string.Format(Properties.Resources.InvalidInput, "planes", "DSSolid.SliceWithPlanes"), "planes");
     IGeometryEntity[] solids = null;
     if (isRegular)
         solids = SolidEntity.SliceWithPlanes(planeHosts);
     else
         solids = new IGeometryEntity[] { SolidEntity.NonRegularSliceWithPlanes(planeHosts) };
     if (solids == null || solids.Length == 0)
         throw new System.Exception(string.Format(Properties.Resources.OperationFailed, "DSSolid.SliceWithPlanes"));
     return solids.ToArray<DSSolid, IGeometryEntity>(true);
 }
コード例 #27
0
ファイル: Surface.cs プロジェクト: samuto/designscript
        /// <summary>
        /// Split this surface using a plane as cutting tool.
        /// </summary>
        /// <param name="splittingPlane">Plane as cutting tool.</param>
        /// <returns>Array of surfaces.</returns>
        public DSSurface[] Split(DSPlane splittingPlane)
        {
            ISurfaceEntity[] splitSurfaces = SurfaceEntity.Split(splittingPlane.HostImpl as IPlaneEntity);

            if (null == splitSurfaces || splitSurfaces.Length < 1)
            {
                throw new System.InvalidOperationException(string.Format(Properties.Resources.OperationFailed, "DSSurface.Split"));
            }

            return splitSurfaces.ConvertAll((ISurfaceEntity host) => host.ToSurf(true, this));
        }
コード例 #28
0
ファイル: Point.cs プロジェクト: samuto/designscript
        /// <summary>
        /// Constructors a point by projecting a point on a plane. It is 
        /// equivalent to finding the nearest point on the plane.
        /// </summary>
        /// <param name="contextPlane">Plane of projection</param>
        /// <returns>Point</returns>
        public DSPoint Project(DSPlane contextPlane)
        {
            if (contextPlane == null)
            {
                throw new ArgumentNullException("contextPlane");
            }

            var pt = contextPlane.Project(this);
            pt.Context = contextPlane;
            pt.ReferencePoint = this;
            pt.Persist();
            return pt;
        }
コード例 #29
0
ファイル: Surface.cs プロジェクト: samuto/designscript
        /// <summary>
        /// 
        /// </summary>
        /// <param name="planes"></param>
        /// <param name="selectPoint"></param>
        /// <param name="autoExtend"></param>
        /// <returns></returns>
        public DSSurface Trim(DSPlane[] planes, DSPoint selectPoint, bool autoExtend)
        {
            if(null == planes)
                throw new System.ArgumentNullException("planes");

            return Trim(null, planes, null, null, selectPoint, autoExtend);
        }
コード例 #30
0
ファイル: Point.cs プロジェクト: samuto/designscript
        /// <summary>
        /// Constructors a point by projecting a point on a plane with given project direction.
        /// </summary>
        /// <param name="contextPlane">Plane of projection</param>
        /// <param name="direction">Projection direction</param>
        /// <returns>Point</returns>
        public DSPoint Project(DSPlane contextPlane, DSVector direction)
        {
            if (contextPlane == null)
            {
                throw new ArgumentNullException("contextPlane");
            }
            else if (direction == null)
            {
                throw new ArgumentNullException("direction");
            }
            else if (direction.IsZeroVector())
            {
                throw new ArgumentException(string.Format(Properties.Resources.IsZeroVector, "direction"));
            }
            else if (direction.IsPerpendicular(contextPlane.Normal))
            {
                throw new ArgumentException(string.Format(Properties.Resources.IsParallel, "contextPlane", "direction", "DSPoint.Project"));
            }

            var pt = contextPlane.Project(this, direction);
            pt.Context = contextPlane;
            pt.ReferencePoint = this;
            pt.Direction = direction;
            pt.Persist();
            return pt;
        }
コード例 #31
0
 internal virtual IGeometryEntity[] IntersectWithPlane(DSPlane plane)
 {
     throw new System.InvalidOperationException(string.Format(Properties.Resources.InvalidIntersect, GetType().Name, "DSPlane"));
 }
コード例 #32
0
ファイル: Solid.cs プロジェクト: samuto/designscript
 /// <summary>
 /// 
 /// </summary>
 /// <param name="planes"></param>
 /// <param name="selectPoint"></param>
 /// <returns></returns>
 public DSSolid Trim(DSPlane[] planes, DSPoint selectPoint)
 {
     return Trim(planes, null, null, selectPoint);
 }
コード例 #33
0
ファイル: Solid.cs プロジェクト: samuto/designscript
        // TODO: To be fixed - pratapa
        /// <summary>
        /// 
        /// </summary>
        /// <param name="planes"></param>
        /// <param name="surfaces"></param>
        /// <param name="solids"></param>
        /// <param name="selectPoint"></param>
        /// <returns></returns>
        public DSSolid Trim(DSPlane[] planes, DSSurface[] surfaces, DSSolid[] solids, DSPoint selectPoint)
        {
            IPlaneEntity[] hostPlanes = planes.ConvertAll(DSGeometryExtension.ToEntity<DSPlane, IPlaneEntity>);
            ISurfaceEntity[] hostSurfaces = surfaces.ConvertAll(DSGeometryExtension.ToEntity<DSSurface, ISurfaceEntity>);
            ISolidEntity[] hostSolids = solids.ConvertAll(DSGeometryExtension.ToEntity<DSSolid, ISolidEntity>);
            if (selectPoint == null)
                throw new System.ArgumentNullException("selectPoint");
            IPointEntity hostPoint = selectPoint.PointEntity;
            if (hostPlanes == null && hostSurfaces == null && hostSolids == null)
                throw new System.ArgumentException(string.Format(Properties.Resources.InvalidInput, "DSGeometry", "DSSolid.Trim"));

            ISolidEntity trimSolid = SolidEntity.Trim(hostPlanes, hostSurfaces, hostSolids, hostPoint);
            if (null == trimSolid)
                throw new System.Exception(string.Format(Properties.Resources.OperationFailed, "DSSolid.Trim"));

            Hide(planes);
            Hide(surfaces);
            Hide(solids);
            SetVisibility(false);

            return new DSSolid(trimSolid, true);
        }
コード例 #34
0
ファイル: Curve.cs プロジェクト: samuto/designscript
 /// <summary>
 /// Returns a plane at a point on the curve by given paramater and use 
 /// the tangent at the point as Normal of the plane. This method can 
 /// specify the size of the plane.
 /// Argument Requirement:
 ///     planeSize >= 1
 /// </summary>
 /// <param name="param"></param>
 /// <param name="planeSize"></param>
 /// <returns></returns>
 public DSPlane PlaneAtParameter(double param, double planeSize)
 {
     var origin = CurveEntity.PointAtParameter(param).ToPoint(false, null);
     var tangent = TangentAtParameter(param);
     DSPlane result = new DSPlane(origin, tangent, planeSize, true, this);
     result.T = param;
     result.Distance = CurveEntity.DistanceAtParameter(param);
     return result;
 }
コード例 #35
0
 internal override IGeometryEntity[] IntersectWithPlane(DSPlane plane)
 {
     return(SurfaceEntity.IntersectWith(plane.PlaneEntity));
 }
コード例 #36
0
ファイル: Solid.cs プロジェクト: samuto/designscript
 /// <summary>
 /// 
 /// </summary>
 /// <param name="plane"></param>
 /// <param name="selectPoint"></param>
 /// <returns></returns>
 public DSSolid Trim(DSPlane plane, DSPoint selectPoint)
 {
     DSPlane[] planes = { plane };
     return Trim(planes, null, null, selectPoint);
 }