.NET
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Re: Question: Using AutoCAD 2012 through an external EXE
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Just curious if this is currently the only version of AutoCAD installed on this machine? If so has it ever had any other version installed on it?
Re: Question: Using AutoCAD 2012 through an external EXE
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi
No, this the only version that I have ever installed on this machine.
Re: Question: Using AutoCAD 2012 through an external EXE
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I'm not sure. Is it possible that the invisible AutoCAD session is trying to get user input, like asking the user to select the template file for the new drawing or something?
Would it be possible for you to attach the smallest version of your code that still has the error so that I can try it here?

Re: Question: Using AutoCAD 2012 through an external EXE
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi
Actually I don't think it does, anyway I attached the code you asked for, the exception occures at line 63.
Thanks
Re: Question: Using AutoCAD 2012 through an external EXE
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
It is working every time for me, the only thing that I did see that I would change is cleaning up after accessing the Acad Object. I added this to the end of what you have.
Finally
Try
acApp.Application.Quit()
System.Runtime.InteropServices.Marshal.ReleaseComO bject(acApp)
GC.Collect()
GC.WaitForPendingFinalizers()
Catch ex2 As Exception
MsgBox(ex2.Message)
End TryPlease note that if this was going to run several times a minute I would not call the garbage collector on it every time.
Re: Question: Using AutoCAD 2012 through an external EXE
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi
I don't know what to do. although the sleep function somehow solved this problem too, but I am convinced that this solution is not the best way handle this problem.
Thank you all for your support.
Re: Question: Using AutoCAD 2012 through an external EXE
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi
I want to provide some information about my system that my be useful.
I'm Running:
Windows 7 Home Premium (64-bit edition)
Microsoft Visual Studio 2010 Ultimate
AutoCAD 2012 Structural Detailing (64-bit version)
and I have AutoCAD VBA Enabler installed too
can these information help?
Re: Question: Using AutoCAD 2012 through an external EXE
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Well, I am able to run your code (with my message filter code) without incident.
I am developing on WinXP 32 bit, with AutoCAD 2012, Visual Studio 2010 Professional.
I also built the program (with "Any CPU" as the Target platform) and ran it on a Windows 7 Professional 64 bit, with AutoCAD 2012 64 bit.
Neither my dev machine nor the users machine has the VBA enabler installed, but I can't imagine that being the problem.
Might I suggest you try what I did and see what happens. To run your code, I had to create a form and stick a button on it, but then I added a ListBox control, and added a line to the ListBox in each of the message filter functions, and as status updates as the code went through your process. I have attached my modified version. Try adding a ListBox to your form and running this new code, to see if you get any messages in the ListBox.

Re: Question: Using AutoCAD 2012 through an external EXE
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi
Actually your code worked without any error, here is a summarized version of it's output (I replaced the listbox with a textbox in order to be able to copy from it):
Pending: (336 times)
AutoCAD Started:18.2s (LMS Tech)
Pending: (2 times)
Retry
Pending: (48 times)
Circle Drawn
Pending: (3 times)
Line Drawn
Pending: (2 times)
Doc Closed
Pending: (5 times)
Cad Closed
I tested it repeatedly and it worked every time, that is weird because your code is not different from my code.
I can't concentrate right now, I will test your code thoroughly tomorrow and I'll post any problem that might occur.
Thank you very much


