Author Topic: Sheet Set Manager, Convert Early Binding to Late Binding  (Read 4173 times)

0 Members and 1 Guest are viewing this topic.

Jeff_M

  • King Gator
  • Posts: 4098
  • C3D user & customizer
Sheet Set Manager, Convert Early Binding to Late Binding
« on: June 16, 2011, 07:59:56 PM »
Attached is a sample VS2008 C# project that uses early binding in AutoCAD 2012. It works fine. I need to be able to build this project for both 2010 & 2011, the SSM is only provided to us as a COM component the different versions are a problem. Autodesk didn't provide a DLL for the AcSmComponents18.tlb, so in order to build the earlier versions I must also build a version specific dll for this, then that dll must be distributed with the project.

In order to avoid the extra dll, I want to use late binding so no dll needed. Herein lies my problem...I've used early binding in VBA many times in the past, and have read up on using it in C#. But I'm failing miserably at getting this to work. In the attached project, Class1.cs has the working early binding code. Class2.cs has my attempts at the conversion. If anyone could chime in with something to make this work, it would be greatly appreciated.
« Last Edit: June 17, 2011, 01:55:25 AM by Jeff_M »

kaefer

  • Guest
Re: Sheet Set Manager, Convert Early Binding to Late Binding
« Reply #1 on: June 17, 2011, 07:03:51 AM »
Autodesk didn't provide a DLL for the AcSmComponents18.tlb, so in order to build the earlier versions I must also build a version specific dll for this, then that dll must be distributed with the project.

Here(R), at least, there's AcSmComponents18.dll in the shared folder, and there's a CLSID for AcSmSheetSetMgr.18.

Putting the pieces together with Type.GetTypeFromCLSID and Activator.CreateInstance, I get "COM target does not implement IDispatch."

Not helpful today, Thorsten


Jeff_M

  • King Gator
  • Posts: 4098
  • C3D user & customizer
Re: Sheet Set Manager, Convert Early Binding to Late Binding
« Reply #2 on: June 17, 2011, 09:24:52 AM »
Thanks for looking, Thorsten. That should have read "Autodesk didn't provide a DLL in the ObjectARX SDK for the AcSmComponents18.tlb, so.....". What happens is that if I reference the tlb in the ObjetARX folder for 2010, it wants to use the Autocad Interop registered in the GAC which is the most recent one (2012 in my case) and it fails to build.

And yes, that's the same error I was seeing. I think that means it doesn't allow late binding at all, but am hoping I'm wrong.

Jeff H

  • Needs a day job
  • Posts: 6150
Re: Sheet Set Manager, Convert Early Binding to Late Binding
« Reply #3 on: June 17, 2011, 03:07:45 PM »
Are you trying to avoid the Interop.ACSMCOMPONENTS18Lib from being built?
If not I removed all references and added ACSMCOMPONENTS18Lib from ObjectArx 2010 first then added other references from 2010 folder and I got a build to work with just 2011 and 2012 installed.

Jeff_M

  • King Gator
  • Posts: 4098
  • C3D user & customizer
Re: Sheet Set Manager, Convert Early Binding to Late Binding
« Reply #4 on: June 17, 2011, 05:40:59 PM »
Jeff, when you add the AcSmComponents18.TLB it auto-adds the AXDBLib. Which is the same as Interop.Autodesk.Common.dll, with the small exception that it is the most recent version installed to the computer. If you remove that reference and instead reference the Interop from the ObjectARX folder, it should refuse to build. I need to use the ObjectARX version or the rest of the program breaks.

ADN has verified this, and are the ones who pointed me down this Late Bind path. I've asked for some more help from them, but have not heard anything back.