SnapPoints returning ArgumentException

Hi,

I am trying to create an automated dimensioning tool using C# for CorelDRAW X8, but I am having an issue with the SnapPoints.

The code is currently as below:

                corel.SnapPoint pt1 = new corel.SnapPoint();
                corel.SnapPoint pt2 = new corel.SnapPoint();

                pt1.SetPosition(0, 0);
                pt2.SetPosition(10, 0);

                corelApp.ActiveLayer.CreateLinearDimension(corel.cdrLinearDimensionType.cdrDimensionHorizontal, pt1, pt2);

When using this I get and ArgumentException saying that there is an invalid value being passed by Point1 (pt1).

I tried different approaches to solve this, but nothing is working. The idea is to later change the SnapPoint for an ActiveSelection snap point, but this is also giving me an error of Interop.COMExecption type.

Anyone having similar issues?

Thanks!