Rename CircularMove to ArcMove
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,18 +1,18 @@
|
|||||||
|
|
||||||
namespace OpenNest.CNC
|
namespace OpenNest.CNC
|
||||||
{
|
{
|
||||||
public class CircularMove : Motion
|
public class ArcMove : Motion
|
||||||
{
|
{
|
||||||
public CircularMove()
|
public ArcMove()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public CircularMove(double x, double y, double i, double j, RotationType rotation = RotationType.CCW)
|
public ArcMove(double x, double y, double i, double j, RotationType rotation = RotationType.CCW)
|
||||||
: this(new Vector(x, y), new Vector(i, j), rotation)
|
: this(new Vector(x, y), new Vector(i, j), rotation)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public CircularMove(Vector endPoint, Vector centerPoint, RotationType rotation = RotationType.CCW)
|
public ArcMove(Vector endPoint, Vector centerPoint, RotationType rotation = RotationType.CCW)
|
||||||
{
|
{
|
||||||
EndPoint = endPoint;
|
EndPoint = endPoint;
|
||||||
CenterPoint = centerPoint;
|
CenterPoint = centerPoint;
|
||||||
@@ -57,12 +57,12 @@ namespace OpenNest.CNC
|
|||||||
|
|
||||||
public override CodeType Type
|
public override CodeType Type
|
||||||
{
|
{
|
||||||
get { return CodeType.CircularMove; }
|
get { return CodeType.ArcMove; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override ICode Clone()
|
public override ICode Clone()
|
||||||
{
|
{
|
||||||
return new CircularMove(EndPoint, CenterPoint, Rotation)
|
return new ArcMove(EndPoint, CenterPoint, Rotation)
|
||||||
{
|
{
|
||||||
Layer = Layer
|
Layer = Layer
|
||||||
};
|
};
|
||||||
@@ -3,7 +3,7 @@ namespace OpenNest.CNC
|
|||||||
{
|
{
|
||||||
public enum CodeType
|
public enum CodeType
|
||||||
{
|
{
|
||||||
CircularMove,
|
ArcMove,
|
||||||
Comment,
|
Comment,
|
||||||
LinearMove,
|
LinearMove,
|
||||||
RapidMove,
|
RapidMove,
|
||||||
|
|||||||
@@ -180,12 +180,12 @@ namespace OpenNest.CNC
|
|||||||
|
|
||||||
public void ArcTo(double x, double y, double i, double j, RotationType rotation)
|
public void ArcTo(double x, double y, double i, double j, RotationType rotation)
|
||||||
{
|
{
|
||||||
Codes.Add(new CircularMove(x, y, i, j, rotation));
|
Codes.Add(new ArcMove(x, y, i, j, rotation));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ArcTo(Vector endpt, Vector center, RotationType rotation)
|
public void ArcTo(Vector endpt, Vector center, RotationType rotation)
|
||||||
{
|
{
|
||||||
Codes.Add(new CircularMove(endpt, center, rotation));
|
Codes.Add(new ArcMove(endpt, center, rotation));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddSubProgram(Program program)
|
public void AddSubProgram(Program program)
|
||||||
@@ -339,9 +339,9 @@ namespace OpenNest.CNC
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case CodeType.CircularMove:
|
case CodeType.ArcMove:
|
||||||
{
|
{
|
||||||
var arc = (CircularMove)code;
|
var arc = (ArcMove)code;
|
||||||
var radius = arc.CenterPoint.DistanceTo(arc.EndPoint);
|
var radius = arc.CenterPoint.DistanceTo(arc.EndPoint);
|
||||||
|
|
||||||
Vector endpt;
|
Vector endpt;
|
||||||
|
|||||||
@@ -28,8 +28,8 @@ namespace OpenNest
|
|||||||
|
|
||||||
switch (code.Type)
|
switch (code.Type)
|
||||||
{
|
{
|
||||||
case CodeType.CircularMove:
|
case CodeType.ArcMove:
|
||||||
AddCircularMove((CircularMove)code, ref mode, ref curpos, ref geometry);
|
AddArcMove((ArcMove)code, ref mode, ref curpos, ref geometry);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CodeType.LinearMove:
|
case CodeType.LinearMove:
|
||||||
@@ -82,10 +82,10 @@ namespace OpenNest
|
|||||||
curpos = pt;
|
curpos = pt;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void AddCircularMove(CircularMove circularMove, ref Mode mode, ref Vector curpos, ref List<Entity> geometry)
|
private static void AddArcMove(ArcMove arcMove, ref Mode mode, ref Vector curpos, ref List<Entity> geometry)
|
||||||
{
|
{
|
||||||
var center = circularMove.CenterPoint;
|
var center = arcMove.CenterPoint;
|
||||||
var endpt = circularMove.EndPoint;
|
var endpt = arcMove.EndPoint;
|
||||||
|
|
||||||
if (mode == Mode.Incremental)
|
if (mode == Mode.Incremental)
|
||||||
{
|
{
|
||||||
@@ -100,12 +100,12 @@ namespace OpenNest
|
|||||||
var dy = endpt.Y - center.Y;
|
var dy = endpt.Y - center.Y;
|
||||||
|
|
||||||
var radius = Math.Sqrt(dx * dx + dy * dy);
|
var radius = Math.Sqrt(dx * dx + dy * dy);
|
||||||
var layer = ConvertLayer(circularMove.Layer);
|
var layer = ConvertLayer(arcMove.Layer);
|
||||||
|
|
||||||
if (startAngle.IsEqualTo(endAngle))
|
if (startAngle.IsEqualTo(endAngle))
|
||||||
geometry.Add(new Circle(center, radius) { Layer = layer });
|
geometry.Add(new Circle(center, radius) { Layer = layer });
|
||||||
else
|
else
|
||||||
geometry.Add(new Arc(center, radius, startAngle, endAngle, circularMove.Rotation == RotationType.CW) { Layer = layer });
|
geometry.Add(new Arc(center, radius, startAngle, endAngle, arcMove.Rotation == RotationType.CW) { Layer = layer });
|
||||||
|
|
||||||
curpos = endpt;
|
curpos = endpt;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,7 +49,7 @@
|
|||||||
<Compile Include="Collections\DrawingCollection.cs" />
|
<Compile Include="Collections\DrawingCollection.cs" />
|
||||||
<Compile Include="EvenOdd.cs" />
|
<Compile Include="EvenOdd.cs" />
|
||||||
<Compile Include="ConvertGeometry.cs" />
|
<Compile Include="ConvertGeometry.cs" />
|
||||||
<Compile Include="CNC\CircularMove.cs" />
|
<Compile Include="CNC\ArcMove.cs" />
|
||||||
<Compile Include="CNC\Comment.cs" />
|
<Compile Include="CNC\Comment.cs" />
|
||||||
<Compile Include="CNC\ICode.cs" />
|
<Compile Include="CNC\ICode.cs" />
|
||||||
<Compile Include="CNC\LinearMove.cs" />
|
<Compile Include="CNC\LinearMove.cs" />
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ namespace OpenNest
|
|||||||
return img;
|
return img;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void AddArc(GraphicsPath path, CircularMove arc, Mode mode, ref Vector curpos)
|
private static void AddArc(GraphicsPath path, ArcMove arc, Mode mode, ref Vector curpos)
|
||||||
{
|
{
|
||||||
var endpt = arc.EndPoint;
|
var endpt = arc.EndPoint;
|
||||||
var center = arc.CenterPoint;
|
var center = arc.CenterPoint;
|
||||||
@@ -186,8 +186,8 @@ namespace OpenNest
|
|||||||
|
|
||||||
switch (code.Type)
|
switch (code.Type)
|
||||||
{
|
{
|
||||||
case CodeType.CircularMove:
|
case CodeType.ArcMove:
|
||||||
AddArc(path, (CircularMove)code, mode, ref curpos);
|
AddArc(path, (ArcMove)code, mode, ref curpos);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CodeType.LinearMove:
|
case CodeType.LinearMove:
|
||||||
|
|||||||
@@ -184,9 +184,9 @@ namespace OpenNest.IO
|
|||||||
|
|
||||||
switch (code.Type)
|
switch (code.Type)
|
||||||
{
|
{
|
||||||
case CodeType.CircularMove:
|
case CodeType.ArcMove:
|
||||||
var arc = (CircularMove)code;
|
var arc = (ArcMove)code;
|
||||||
AddCircularMove(arc);
|
AddArcMove(arc);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CodeType.LinearMove:
|
case CodeType.LinearMove:
|
||||||
@@ -235,7 +235,7 @@ namespace OpenNest.IO
|
|||||||
curpos = pt;
|
curpos = pt;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AddCircularMove(CircularMove arc)
|
private void AddArcMove(ArcMove arc)
|
||||||
{
|
{
|
||||||
var center = arc.CenterPoint.ToNetDxf();
|
var center = arc.CenterPoint.ToNetDxf();
|
||||||
var endpt = arc.EndPoint.ToNetDxf();
|
var endpt = arc.EndPoint.ToNetDxf();
|
||||||
|
|||||||
+13
-13
@@ -311,30 +311,30 @@ namespace OpenNest.IO
|
|||||||
{
|
{
|
||||||
switch (code.Type)
|
switch (code.Type)
|
||||||
{
|
{
|
||||||
case CodeType.CircularMove:
|
case CodeType.ArcMove:
|
||||||
{
|
{
|
||||||
var sb = new StringBuilder();
|
var sb = new StringBuilder();
|
||||||
var circularMove = (CircularMove)code;
|
var arcMove = (ArcMove)code;
|
||||||
|
|
||||||
if (circularMove.Rotation == RotationType.CW)
|
if (arcMove.Rotation == RotationType.CW)
|
||||||
{
|
{
|
||||||
sb.Append(string.Format("G02X{0}Y{1}I{2}J{3}",
|
sb.Append(string.Format("G02X{0}Y{1}I{2}J{3}",
|
||||||
Math.Round(circularMove.EndPoint.X, OutputPrecision),
|
Math.Round(arcMove.EndPoint.X, OutputPrecision),
|
||||||
Math.Round(circularMove.EndPoint.Y, OutputPrecision),
|
Math.Round(arcMove.EndPoint.Y, OutputPrecision),
|
||||||
Math.Round(circularMove.CenterPoint.X, OutputPrecision),
|
Math.Round(arcMove.CenterPoint.X, OutputPrecision),
|
||||||
Math.Round(circularMove.CenterPoint.Y, OutputPrecision)));
|
Math.Round(arcMove.CenterPoint.Y, OutputPrecision)));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sb.Append(string.Format("G03X{0}Y{1}I{2}J{3}",
|
sb.Append(string.Format("G03X{0}Y{1}I{2}J{3}",
|
||||||
Math.Round(circularMove.EndPoint.X, OutputPrecision),
|
Math.Round(arcMove.EndPoint.X, OutputPrecision),
|
||||||
Math.Round(circularMove.EndPoint.Y, OutputPrecision),
|
Math.Round(arcMove.EndPoint.Y, OutputPrecision),
|
||||||
Math.Round(circularMove.CenterPoint.X, OutputPrecision),
|
Math.Round(arcMove.CenterPoint.X, OutputPrecision),
|
||||||
Math.Round(circularMove.CenterPoint.Y, OutputPrecision)));
|
Math.Round(arcMove.CenterPoint.Y, OutputPrecision)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (circularMove.Layer != LayerType.Cut)
|
if (arcMove.Layer != LayerType.Cut)
|
||||||
sb.Append(GetLayerString(circularMove.Layer));
|
sb.Append(GetLayerString(arcMove.Layer));
|
||||||
|
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -263,7 +263,7 @@ namespace OpenNest.IO
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
program.Codes.Add(new CircularMove()
|
program.Codes.Add(new ArcMove()
|
||||||
{
|
{
|
||||||
EndPoint = new Vector(x, y),
|
EndPoint = new Vector(x, y),
|
||||||
CenterPoint = new Vector(i, j),
|
CenterPoint = new Vector(i, j),
|
||||||
|
|||||||
Reference in New Issue
Block a user