3
Reply

Problem with C# and AutoCAD

Nils Blums

Nils Blums

Nov 29 2008 5:09 PM
4.1k
Hello! I have a liitle problem with my programm. I need to create programm that is making a AutoCAD drawing from a windows form. I Alrady got the everything done, but have one small problem: I can send command to autocad only once per my programm is running, if i try to send two commands it crushes and give me error that Call was rejected by callee. I mange to find that it is becuse of the time the send command need to go to autocad. I also find this solution http://msdn.microsoft.com/en-us/library/ms228772(VS.80).aspx from the post here http://social.msdn.microsoft.com/Forums/en-US/vsx/thread/617a7fbf-2090-41e7-aca0-c14957d632c8/ I done the solution and it actualy work, but there is another problem now, actualy still same. The MessageFilter.Register(); works and its stops the crush and the error message are not showing, but nothing hapens, i mean the next send command aint working, it just stops working, i mean the command aint sending. Here is the piece of my code: public void RenameLayoutu() { MessageFilter.Register(); acadDoc.SendCommand("_layout r Layout1"); SendKeys.Send("{ENTER}"); acadDoc.SendCommand("mylayout"); SendKeys.Send("{ENTER}"); MessageFilter.Revoke(); } It is to rename one of the layouts in the document. First command working, then enter key sending, and after that nothing, there aint crush, programm is still runing and i can draw in autocad manualy everything is working exept sending of second command. Thank to anyone who will help. Best regards NILS.

Answers (3)