Author Topic: AutoCAD 2015 Behaves Differently When Called From .NET  (Read 1863 times)

0 Members and 1 Guest are viewing this topic.

Bill Tillman

  • Guest
AutoCAD 2015 Behaves Differently When Called From .NET
« on: March 25, 2015, 11:19:43 AM »
I have a small VB.NET project which finds some drawing files on our LAN and lists them in a ListBox. The user can simply click on the item in the list box and it uses Process.Start to open it up in AutoCAD. In the past, this worked great and used an existing instance of AutoCAD automatically. That is if the user already has AutoCAD open and they click on the file in the ListBox, it just opens up a new drawing in that existing instance of AutoCAD. If not, it opens up a new instance of AutoCAD. My computer, however, opens up a new instance of AutoCAD each and every time I do this. So far, my computer is the only one in this department that's doing this.

Andrey Bushman

  • Swamp Rat
  • Posts: 864
Re: AutoCAD 2015 Behaves Differently When Called From .NET
« Reply #1 on: March 25, 2015, 12:30:47 PM »
Right click -> Open with. Look attachment. Also SDI set 0 (as I remember).


Bill Tillman

  • Guest
Re: AutoCAD 2015 Behaves Differently When Called From .NET
« Reply #2 on: March 25, 2015, 01:54:37 PM »
Thanks, but I've tried right+clicking on the file name -> Open with....but that did not correct the problem. I've also set the SDI variable to 1, then back to 0, then back to 1. Nothing works. And it's funny because this machine once had AutoCAD 2015 LT on it and when they uninstalled it, the file association problem first showed up. Been giving troubles on this machine every since. The IT guys are stumped and refuse to let me re-image the machine and start from scratch. So, you know the routine....60-90 day resolution window from those people.

n.yuan

  • Bull Frog
  • Posts: 348
Re: AutoCAD 2015 Behaves Differently When Called From .NET
« Reply #3 on: March 26, 2015, 09:22:34 AM »
You may want to show the code of the VB.NET app that starts an AutoCAD process. As far as I know, if you use Process.Start(), it ALWAYS starts a new process (meaning a new AutoCAD session). I cannot imagine Process.Start() would find an existing AutoCAD process and returns it to your code.

If you are sure the AutoCAD session is started with Process.Start(), I'd consider the "problematic" machine (your computer) is doing thing as expected and all other machines either were "problematic", or the app actually started AutoCAD in different way other than Process.Start() (it sounds like AutoCAD session is started with well known approach "GetObject()" with error trapping wrapped "CreateObject()").

Bill Tillman

  • Guest
Re: AutoCAD 2015 Behaves Differently When Called From .NET
« Reply #4 on: March 31, 2015, 09:22:12 AM »
The problem seems more deeply routed that I first thought. No matter what I do, no matter how I select a drawing file, AutoCAD 2015 continues to open up a new instance of AutoCAD. And as before, this is the only computer in the department where this is happening. It's also the only computer that once had AutoCAD 2015 LT on it and it's been passed around between no less than four different users finally ending up as my desktop.

n.yuan

  • Bull Frog
  • Posts: 348
Re: AutoCAD 2015 Behaves Differently When Called From .NET
« Reply #5 on: March 31, 2015, 09:37:37 AM »
Well, if you have access to the code of the said "small VB project", then the problem is rooted no deeper than just looking at the code to see how it starts/finds an AutoCAD process.

If it uses, as you said at beginning, Process.Start(), then it ALWAYS start a new AutoCAD session, so your computer just behaves as it should.

Kean

  • Newt
  • Posts: 48
Re: AutoCAD 2015 Behaves Differently When Called From .NET
« Reply #6 on: March 31, 2015, 09:42:39 AM »
I assume you're calling Process.Start() with the path to the DWG rather than to acad.exe, which I think can use an existing AutoCAD instance.

I'd start by repairing the AutoCAD installation: there could well be some Registry corruption at the root of this.

Kean