I am having a very interesting problem with my code. When I run my code the first time CommandMethod works and executes without any problems, When I try to run it again I get : Unknown command. I have to reopen AutoCAD in order to run the command again.
Has anyone experience this problem before.
I just ran some test and I got strange but consistent results. When I run the code on AutoCAD 2008 the command run only once, but when I run it on AutoCAD 2010 it works without any problems.
It is really strange that the same code runs in 2010 without any problems and in 2008 it is only willing to run once.
Hi everyone, I was able to narrow the problem to ‘System.IO.StreamReader’
At the start of my code I read a large data file (9000 lines) in with this code:
Public Class Test <CommandMethod("ttt", CommandFlags.Modal)> _ Public Sub Test() Dim objReader As New System.IO.StreamReader("C:\Test.txt") Do sLine = objReader.ReadLine() If Not sLine Is Nothing Then Debug.Print(sLine) End If Loop Until sLine Is Nothing objReader.Close() End Sub End Class
After reading in the file in, when I try to read the file again I get an ‘Unknown command’. I wonder if the problem is with the buffer . . . . . .
Or perhaps there is a workaround this issue.
Thank you,
-J