public static LinkedList <IRCommand> Generate(LinkedList <Trace> traces) { LinkedList <IRCommand> result = new LinkedList <IRCommand>(); Ent2IRCmd cvt = new Ent2IRCmd(); result = new LinkedList <IRCommand>(); Point2D from = new Point2D(); while (traces.Count != 0) { Trace trace = ClosestTraceChooser.ChooseTrace(from, traces); traces.Remove(trace); Point2D to = trace.CalcStartPoint(); result.AddLast(new IRLine(from, to, PassingType.FreePass)); foreach (Entity ent in trace.Entities) { ent.Accept(cvt); IRCommand cmd = cvt.Result; cmd.PassingType = PassingType.Mill; result.AddLast(cmd); } from = trace.CalcEndPoint(); } return(result); }
public void Visit(Arc arc) { IRArc newarc = new IRArc(); newarc.StartAngle = arc.StartAngle; newarc.SweepAngle = arc.SweepAngle; newarc.Radius = arc.Radius; Result = newarc; }
public void Visit(Line line) { Result = new IRLine(line.StartPoint, line.EndPoint); }