For the Zero-Touch node that I’m developing I need to offset some simple PolyCurves. However when I use the PolyCurve.Offset method the compiler apparently believes that I’m offsetting regular curves so I can’t pass a PolyCurve to a variable. It also won’t let me cast the offset output to a PolyCurve.
public static PolyCurve Offset ()
{
List<Point> ptList = new List<Point>();
ptList.Add(Point.ByCoordinates(5, -5));
ptList.Add(Point.ByCoordinates(0, -5));
ptList.Add(Point.ByCoordinates(-5, 0));
PolyCurve pc = PolyCurve.ByPoints(ptList);
//not only should this cast to polycurve be unnecessary,
//but it doesn't even work
PolyCurve pcOffset = (PolyCurve)pc.Offset(-1, false);
return pcOffset;
}
The error message I receive in Dynamo reads: “Warning: Class1.Offset operation failed.
Unable to cast object of type ‘Autodesk.DesignScript.Geometry.Curve’ to type ‘Autodesk.DesignScript.Geometry.PolyCurve’.”