are you doing this inside a transaction? If so nothing will happen until the transaction is committed.... just a thought.
[CommandMethod("nn")]
public static void nn()
{
Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
for (int i = 0; i < 10000; i++)
{
ed.WriteMessage("\n{0}", i);
}
}
try putting a 'sleep' in the loop to slow it down, that loop would finish quickly and it would seem like it was waiting to finish, especially if you just loaded the dll there could even be a bit if JIT lag to make it seem like it's waiting.
[CommandMethod("nn")]
public static void nn()
{
Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
for (int i = 0; i < 10000; i++)
{
ed.WriteMessage("\n{0}", i);
Thread.Sleep(1000);
}
}
I just tested on 2016 and seems like it is doing the same thing.
Recompile and used recursion method,still can't work in AutoCAD2016.
But in AutoCAD2008,it works very well.
MickD,thank you for your help.
Sorry I was seeing same behavior as xys1995, it would print it at one time to the command line.I just tested on 2016 and seems like it is doing the same thing.
The same thing as .... ?
Recompile and used recursion method,still can't work in AutoCAD2016.
But in AutoCAD2008,it works very well.
MickD,thank you for your help.
Me thinks maybe AutoCAD is wrapping the Command in some kind of Transaction? Something to do with removing Fibres??? Only guessing now....
Remember your working on the UI thread when working with AutoCAD. So until there is a pause in your code, i.e. user input, DoEvents(). Your not going to see any command line updates. It looks like your trying to show the user some kind of update. Might I suggest ProgressMeter(). It's not perfect but AutoCAD does a decent job of updating it between operations.
[CommandMethod("nn")]
public static void nn()
{
Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
int totalTimes = 10;
ProgressMeter pm = new ProgressMeter();
pm.SetLimit(totalTimes);
pm.Start();
for (int i = 0; i < totalTimes; i++)
{
pm.MeterProgress();
Thread.Sleep(1000);
//ed.WriteMessage("\n{0}", i);
//System.Windows.Forms.Application.DoEvents();
}
pm.Stop();
}
For counter As Integer = 1 To 100
ed.WriteMessage("\n{0}", counter)
Next
For counter As Integer = 1 To 100
ed.WriteMessage(String.Format("{0}count is {1}", Environment.NewLine, counter))
Next
For counter As Integer = 1 To 100
ed.WriteMessage(String.Format("{0}count is {1}", vbCr, counter))
Next