[C# Connect U10 & U12] PartialDelete doesn't work

I'm trying to cut out a part from a line. For that i use LineElement.PartialDelete

I use the COM interop API for C# ,since the NET API way is orders of magnitude overcomplicated and no simple function like PartialDelete seems to exist. I have no interest in converting and trying to use the underlying CurveVector for a simple 2 point line, especially not without any useful info in the DgnPlatformNet.chm (i couldn't find any info how to cut one into pieces) nor any examples showing how to edit one.

In my test example i have a line (le1) from 0,0 to 12,0 and 2 points on 3,0 and 9,0. Two points that are clearly on the line! A third point is on 5,0 since the COM function doesn't allows null for the third point like the MDL function mdlElmdscr_partialDelete.

When I use le1.PartialDelete(out partial1, out partial2, ref p1, ref p2, ref pmid, 1); I get as result the entire line in partial2 and in partial1 a ComplexStringElement somewhere in nirvana at 9.223E+14m,9.223E+14m (see image)

 .

What i would expect are two LineElements, one from 0,0 to 3,0 and a second from 9,0 to 12,0.

I have the following super simple and dumbed down example code, which shows that PartialDelete isn't working correct.

BCOM.Matrix3d rotm = s_comApp.Matrix3dIdentity();
BCOM.Point3d[] lp1 = new BCOM.Point3d[2];
lp1[0] = new BCOM.Point3d() { X = 0, Y = 0, Z = 0 };
lp1[1] = new BCOM.Point3d() { X = 12, Y = 0, Z = 0 };

BCOM.LineElement le1 = s_comApp.CreateLineElement2(null, ref lp1[0], ref lp1[1]);
le1.Color = 0;
s_comApp.ActiveModelReference.AddElement(le1);

BCOM.Point3d p1 = new BCOM.Point3d() { X = 3, Y = 0, Z = 0 };
BCOM.Point3d p2 = new BCOM.Point3d() { X = 9, Y = 0, Z = 0 };
BCOM.Point3d pmid = new BCOM.Point3d() { X = 5, Y = 0, Z = 0 };

BCOM.Element partial1 = null;
BCOM.Element partial2 = null;
le1.PartialDelete(out partial1, out partial2, ref p1, ref p2, ref pmid, 1);

if (partial1 != null)
{
    partial1.Color = 4;
    s_comApp.ActiveModelReference.AddElement(partial1);
}
if (partial2 != null)
{
    partial2.Color = 5;
    s_comApp.ActiveModelReference.AddElement(partial2);
}

Any help to get PartialDelete to do what i want would be appreciated.

\edit

Update 12 has the same issue.

Parents Reply Children
No Data