Man, this is trickier than I thought. I am making a simple function to offset a curve and place the offset object on the defpoints layer.
I've never thought how cad decides which side of arc gets offset by a picked point, but if it is between rays made by the start and end parameters and on the center side of the arc it will offset to the smaller side.
Here's a snip, I am hoping others do this a better way as I don't really like all the conversions to 2d
else if (curve is Arc)
{
Arc arc = (Arc)curve;
rad = arc.Radius;
dist = arc.Center.DistanceTo(p);
Point2d p1, p2, p3,p4;
p1 = arc.StartPoint.Convert2d(plane);
p2 = arc.EndPoint.Convert2d(plane);
p3 = p.Convert2d(plane);
p4 = arc.Center.Convert2d(plane);
double ang = arc.Center.GetVectorTo(p).AngleOnPlane(plane);
if (ang < arc.EndAngle && ang > arc.StartAngle)
{
if (dist < rad) offset = -offset;
}
else
{
double d90 = Math.PI * 0.5;
Vector2d v1 = (p1 - p4).RotateBy(d90).GetNormal();
Vector2d v2 = (p2 - p4).RotateBy(-d90).GetNormal();
double multiplier = (p1 - p2).Length / (v2 - v1).Length;
p4 = p1.Add(v1.MultiplyBy(multiplier));
ang = (p3 - p4).Angle;
if (ang > (p2 - p4).Angle && ang < (p1 - p4).Angle)
offset = -offset;
}
if (offset < 0)
{
if (arc.Radius < -offset)
{
MessageBox.Show("The offset can not be greater than the arc radius, exiting:");
return;
}
}
Arc newArc = new Arc(arc.Center, arc.Normal, arc.Radius + offset, arc.StartAngle, arc.EndAngle);
newArc.Layer = sLayer;
space.AppendEntity(newArc);
tr.AddNewlyCreatedDBObject(newArc, true);
}
tr.Commit();
The polyline and spline are going to get really difficult