.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ObjectDBX reference

10 REPLIES 10
Reply
Message 1 of 11
TickleMeElmo
1697 Views, 10 Replies

ObjectDBX reference

Hi, I'm just starting to play with ObjectDBX.  I've had joy in VBA, but I would much prefer to develop in VS for various reasons.  Problem is that when I add the project reference to C:\Program Files\Common Files\Autodesk Shared\axdb17enu.tlb the path shows  as "<The system cannot find the reference specified>".  (That was adding reference from the COM tab, I get the same if I browse to it.

 

Do I need to register the .tlb or something?

10 REPLIES 10
Message 2 of 11

You should use the .NET Interop assemblies provided. You can reference them from the ObjectARX SDK, or the versions installed to the GAC.

Cheers,

Stephen Preston
Autodesk Developer Network
Message 3 of 11

Thanks Stephen,

 

I'm pretty ignorant on GAC.  As far as I can tell its somewhere under C:\WINDOWS\Microsoft.NET\assembly\?

 

I took a look in there (windows explorer) but can see anything vaguely Autodesky.....I'm guessing it's far more tricky than just copying in axdb17enu.tlb

Message 4 of 11
norman.yuan
in reply to: TickleMeElmo

What do you really want to do with ObjectDBX? If you want to use it in the way of VBA age, e.g. using AxDbDocuemt to access data in a drawing without opening it in the editor, then since you are using .NET (C# or VB.NET) there is not point to do that: Acad .NET API allows you to read an drawing into a Database object without opening it in editor. Well, uless you are doing external stand-alone app to automate AutoCAD.

Message 5 of 11
dgorsman
in reply to: norman.yuan

... or doing an intermediate transition from VBA to VB.NET.  I agree that going the full .NET route is better long term.  However going the ObjectDBX route can leverage a lot of previously done VBA work and cut down migration time, which can be important if the tool needs to be working *now*.  Not exactly optimal but tight schedules don't always allow for that.

----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.


Message 6 of 11
TickleMeElmo
in reply to: dgorsman

So I'm back at this in a roundabout way but am hitting a wall.

 

I don't even care anymore if I'm accessing a drawing db directly - if I have to open and process each drawing fine but there's some fundamental (likely) basic step I must be missing.  Using:

 

  • VS2010 express
  • C#.net
  • Acad2008 (oh the shame)
  • Windows XP 32 bit

 

I have code like:

AcadApplication mAcadApp = (AcadApplication) Marshal.GetActiveObject("AutoCAD.Application");

 

...and it happily links to AcadApp, opens+saves+closes documents.  As soon as I try doing anything useful though (even as simple as getting a modelspace.count) it spits the dummy:

'Unable to cast COM object of type 'System.__ComObject' to interface type 'Autodesk.AutoCAD.Interop.Common.IAcadModelSpace'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{C60BC8AF-58DA-4866-859D-22A7F61411DE}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).'

 

Why does mAcadApp think its a type System.__ComObject? 

 

Stephen Preston suggested: "You should use the .NET Interop assemblies provided" - provided with what?  I downloaded ObjectARX2008 and my project happily sets a reference to Autodesk.AutoCAD.interop and ....Common.

 

Is this the part where I need to pay Autodesk vast amounts of money?

 

I don't want to create a dll or .netload anything into acad - just trying to get an external app (ours) to play with Acad.

 

Help a brother out?

I feel the need to annul my overtones of frustration with a Cat Indifferent

 

 

Message 7 of 11
Ed.Jobe
in reply to: TickleMeElmo

The interop dll's Stephen referred to are in the dir where acad.exe is. You just need to reference them in your project. They describe the interfaces that the error mentioned. You may aslo need to include some 'using' statements, depending on the objects you are referencing.

 

In VBA terms, this is equivalent toTools>References and selecting a *.tlb. In your code, you could use CreateObject() and it would work, but without the tlb to tell the how the Object is formed, the compiler can't figure out what to do with it.

Ed

EESignature

Message 8 of 11
TickleMeElmo
in reply to: Ed.Jobe

Cheers for the reply mate, but I get the same problem.  I've got to abandon this approach; I need to deliver product and I've wasted over a day.  My problem basically boils down to declaring a var of one type, but it thinks it's another:

 

acaddoc.png

Message 9 of 11
Ed.Jobe
in reply to: TickleMeElmo

Is this an out-of-process app? If so, you may want to have a look at the code here. Look at the the notes on registering for COM.

Ed

EESignature

Message 10 of 11
TickleMeElmo
in reply to: Ed.Jobe

I found that yesterday.  Kean is a god amongst men.

 

In desperation I randomly tried switching to different versions of the DLLs in the GAC - victory!!!!

woohoo.png

 

"i've paid my dues....time after time....I've done my sentance....but committed no crime"  etc etc.

 

Very.  Happy.  Camper.

 

Thanks for everyone's help.

 

Message 11 of 11
Ed.Jobe
in reply to: TickleMeElmo

I suppose having the right interops would help. Smiley Happy

Ed

EESignature

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost