Jump to content

Problem with C# and AutoCAD


eproo

Recommended Posts

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 solution 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.

Link to comment
Share on other sites

Have you tried through the objects in AutoCAD's object model rather than SendCommand. Timing becomes an issue with SendCommand since AutoCAD gives no actual feedback to the programming language you are using.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...