Daniel,
Well I finally got around to playing with grread in C#. I needed to use the grclear() function to delete the tracking lines, which I P/invoked per some of your samples and it worked fine... well not really. It doesn't exactly work like lisp code.
Here is the code from your sample that I was just playing with..
[CommandMethod("doit")]
public static void test03()
{
var app = Application.AcadApplication as AcadApplication;
var doc = app.ActiveDocument;
double[] pt1 = new double[] { 0.0, 0.0, 0.0 };
double[] pt2 = new double[] { 0.0, 0.0, 0.0 };
try
{
bool doloop = true;
Point3d last = Point3d.kOrigin;
while (doloop)
{
GrReadResult res = GlobalFunctions.GrRead(1);
if (res.AnswerType == 5)
{
Point3d next = (Point3d)res.Buffer.Value;
GlobalFunctions.GrDraw(last, next, 6, 0);
}
if (res.AnswerType == 3)
{
PInvokeMethods.sds_grclear();
Point3d next = (Point3d)res.Buffer.Value;
pt1[0] = last.X; pt1[1] = last.Y; pt1[2] = last.Z;
pt2[0] = next.X; pt2[1] = next.Y; pt2[2] = next.Z;
doc.ModelSpace.AddLine(pt1, pt2);
last = next;
}
//doc.Utility.Prompt(String.Format("\n{0},{1}", res.AnswerType , res.Buffer));
if (res.Status == PromptStatus.Cancel)
doloop = false;
PInvokeMethods.sds_grclear();
}
}
catch (System.Exception ex)
{
doc.Utility.Prompt(String.Format("\n{0}", ex.Message));
}
}
and this is the method invoking call
[DllImport("Bricscad.exe", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
static internal extern int sds_grclear();
This works except none of the lines (cad segments) are visible during the grread loop. The temp line is created and erased as expected from similar lisp codings, but the drawing is not visible. Not sure how to overcome this situation. Wonder if you have any thoughts on the matter.
On another issue, how do you use 3dPoint.toArray ie, pt1 = last.toArray says NG need a delegate or something?
Anyway having fun playing in net and appreciate your schooling.
Jerry