| | |
Problem with C# and AutoCAD
Please support our C# advertiser: $4.95 a Month - ASP.NET Web Hosting – Click Here!
![]() |
•
•
Join Date: Nov 2008
Posts: 1
Reputation:
Solved Threads: 0
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/libr...72(VS.80).aspx from the post here http://social.msdn.microsoft.com/For...-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.
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/libr...72(VS.80).aspx from the post here http://social.msdn.microsoft.com/For...-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.
•
•
Join Date: May 2008
Posts: 538
Reputation:
Solved Threads: 86
I don't know what your problem is in particular, but it may be that you need to allow autocad some time to process the first command before it is ready to accept the second command.
Alternatively if you are using OLE or COM to interface with AutoCAD, you need to follow their conventions. Do you need to request status or completion status after you send the command before you can send another command?
It appears that you are using a keystroke driven interface for at least part of your control. I can't tell if SendCommand is a keystroke interface or an OLE interface, but I know SendKeys is a keystroke interface.
If SendCommand is not a keystroke interface, it would probably be in your best interest to pick a SINGLE method of interaction with AutoCAD and not try to mix metaphors.
If you are using a keystroke interface, I recall that some applications like to 'clear the keyboard buffer' prior to prompting for a new command. If AutoCAD is written this way, you will need to make sure you are not sending keystrokes to AutoCAD until it has re-prompted for a command or they will be discarded.
See if any of the above gives you a new way to look at your problem.
Alternatively if you are using OLE or COM to interface with AutoCAD, you need to follow their conventions. Do you need to request status or completion status after you send the command before you can send another command?
It appears that you are using a keystroke driven interface for at least part of your control. I can't tell if SendCommand is a keystroke interface or an OLE interface, but I know SendKeys is a keystroke interface.
If SendCommand is not a keystroke interface, it would probably be in your best interest to pick a SINGLE method of interaction with AutoCAD and not try to mix metaphors.
If you are using a keystroke interface, I recall that some applications like to 'clear the keyboard buffer' prior to prompting for a new command. If AutoCAD is written this way, you will need to make sure you are not sending keystrokes to AutoCAD until it has re-prompted for a command or they will be discarded.
See if any of the above gives you a new way to look at your problem.
•
•
Join Date: Nov 2007
Posts: 3
Reputation:
Solved Threads: 0
In this file I will give you an alternative. These are some COMS. You can send command this way. Here ENTER is /n.
If you have further questions feel free to ask.
Look at http://through-the-interface.typepad.com/. You will find a lot there.
If you have further questions feel free to ask.
Look at http://through-the-interface.typepad.com/. You will find a lot there.
![]() |
Similar Threads
- AutoCad & MicroStation (Graphics and Multimedia)
- AutoCAD External DB linking (Oracle)
- Autocad R10 (Windows Software)
- warms and proccess problems (Viruses, Spyware and other Nasties)
- IE browser redirect to perfectnav.com (Viruses, Spyware and other Nasties)
- Cannot Find Server or DNS Error (Viruses, Spyware and other Nasties)
- I'm freezing on XP! (Windows NT / 2000 / XP)
- Ok, Crunchie, one more bridge.dll problem (Viruses, Spyware and other Nasties)
Other Threads in the C# Forum
- Previous Thread: How to Create a menu addIn for word in .Net
- Next Thread: Remove a TabPage
| Thread Tools | Search this Thread |
.net access algorithm animation array bitmap box c# check checkbox client combobox control conversion csharp customactiondata database datagrid datagridview dataset datastructure date/time datetime datetimepicker degrees directrobot dll draganddrop drawing encryption enum excel file filename files form format formbox forms function gdi+ gis gtk hash image input install java label list mandelbrot math mouseclick mp3 mysql native operator outlook2003 packaging path photoshop picturebox pixelinversion pixelminversion post print process programming radians regex remoting richtextbox safari server sleep snooze socket sql statistics string table tables tcp text textbox thread time timer update usercontrol usercontrols validation visualstudio webbrowser webcam wfa wia winforms wpf xml





