예제 #1
0
        /// <summary>
        /// Add a line segment to the end of the specified Robot polyline
        /// </summary>
        /// <param name="result"></param>
        /// <param name="v"></param>
        private static void AddPolylinePoint(RobotGeoPolyline result, Vertex v)
        {
            var segment = new RobotGeoSegmentLine();

            segment.P1 = Convert(v.Position);
            result.Add((RobotGeoSegment)segment); // Wow!  RobotOM has an F'd up inheritance structure!
        }
예제 #2
0
 private static void AddContourSegment(RobotGeoContour result, Curve crv)
 {
     if (crv.IsValid)
     {
         if (crv is Arc)
         {
             Arc arc     = (Arc)crv;
             var segment = new RobotGeoSegmentArc();
             segment.P1 = Convert(arc.Vertices[1].Position);
             segment.P2 = Convert(arc.EndPoint);
             result.Add((RobotGeoSegment)segment);
         }
         else if (crv is PolyLine)
         {
             foreach (Vertex v in crv.Vertices)
             {
                 var segment = new RobotGeoSegmentLine();
                 segment.P1 = Convert(v.Position);
                 result.Add((RobotGeoSegment)segment);
             }
         }
         else if (crv is PolyCurve)
         {
             foreach (Curve subCrv in ((PolyCurve)crv).SubCurves)
             {
                 AddContourSegment(result, subCrv);
             }
         }
         else // Everything else treated as a line
         {
             var segment = new RobotGeoSegmentLine();
             segment.P1 = Convert(crv.EndPoint);
             result.Add((RobotGeoSegment)segment);
         }
     }
 }