コード例 #1
0
        /// <summary>
        /// Cuts an arc at a specified point
        /// </summary>
        /// <param name="pointAtWhichToCut">The point at which to cut the arc - this must lie on the arc</param>
        /// <returns>The cut piece of the original arc</returns>
        public PSEntity Cut(Point pointAtWhichToCut)
        {
            // Check that point lies on arc
            // TODO: Write this functionality

            // Carry out operation
            PSArc newArc = (PSArc)PSEntityCutter.CutEntity(this, pointAtWhichToCut);

            // Return arc
            return(newArc);
        }
コード例 #2
0
        /// <summary>
        /// Creates an Arc based on all parameters
        /// </summary>
        private PSArc(
            PSAutomation powerSHAPE,
            Point centre,
            Point startPoint,
            Point endPoint,
            MM radius,
            float span) : base(powerSHAPE)
        {
            //Clear the list of CreatedItems
            _powerSHAPE.ActiveModel.ClearCreatedItems();

            //Create the line
            _powerSHAPE.DoCommand("CREATE ARC SWEPT",
                                  centre.X.ToString() + " " + centre.Y.ToString() + " " + centre.Z.ToString(),
                                  "ABS " + startPoint.X.ToString() + " " + startPoint.Y.ToString() + " " +
                                  startPoint.Z.ToString(),
                                  "ABS " + endPoint.X.ToString() + " " + endPoint.Y.ToString() + " " + endPoint.Z.ToString(),
                                  "QUIT QUIT");

            // Get its id
            PSArc newArc = (PSArc)_powerSHAPE.ActiveModel.CreatedItems[0];

            _name = newArc.Name;
            _id   = newArc.Id;

            // Set the radius and span
            if (radius != null)
            {
                Radius = radius;
            }

            if (span != null)
            {
                Span = span;
            }
        }