COM related question 
Author Message
 COM related question

Hi All,

While this isn't necessarily a Tcl-specific question, I'm guessing
someone may have some input...  ;^)

I've got a small Tcl app I've written using tcom.  Basically, it uses
AutoCAD (as a COM object) to convert DWG files to DXF format.  The
line of code that actually starts AutoCAD is as follows:

::tcom::ref createobject AutoCAD.Application

My question is this:

When the host system contains multiple installations of AutoCAD (say
2004 and 2006), how can I specify what version I'm actually using?
For instance, if I'm trying to convert ACAD 2006 DWG files to DXF, it
won't work if the above call happens to grab the 2004 version of ACAD.
Through experimentation, I've found that the version that's grabbed by
my program is the *last* version of ACAD that was used to
*interactively* convert a DWG file - which doesn't give me a warm and
fuzzy feeling.

So, does anyone know how I can *specify* what version I want to start?

Thanks,

Jeff



Mon, 01 Sep 2008 00:01:47 GMT  
 COM related question

Quote:

>::tcom::ref createobject AutoCAD.Application

>My question is this:

>When the host system contains multiple installations of AutoCAD (say
>2004 and 2006), how can I specify what version I'm actually using?
>For instance, if I'm trying to convert ACAD 2006 DWG files to DXF, it
>won't work if the above call happens to grab the 2004 version of ACAD.

[snip]

ProgIDs have versioned and unversioned versions. You may well find
that AutoCAD has also registered AutoCAD.Application.1 and
AutoCAD.Application.2 or some such numeric suffix

--
Pat Thoyts                            http://www.patthoyts.tk/
To reply, rot13 the return address or read the X-Address header.
PGP fingerprint 2C 6E 98 07 2C 59 C8 97  10 CE 11 E6 04 E0 B9 DD



Mon, 01 Sep 2008 19:58:49 GMT  
 COM related question

Quote:
> ::tcom::ref createobject AutoCAD.Application

> My question is this:

> When the host system contains multiple installations of AutoCAD (say
> 2004 and 2006), how can I specify what version I'm actually using? For
> instance, if I'm trying to convert ACAD 2006 DWG files to DXF, it won't
> work if the above call happens to grab the 2004 version of ACAD.
> Through experimentation, I've found that the version that's grabbed by
> my program is the *last* version of ACAD that was used to
> *interactively* convert a DWG file - which doesn't give me a warm and
> fuzzy feeling.

COM objects are versioned, if you search the registry, you'll find that
the entry for "AutoCAD.Application" contains a redirect to
"AutoCAD.Application.<Version>", you will also find several different
entries of the form "AutoCAD.Application.<Version>", likely one per
installation of AutoCAD on your system. In *theory* "<Version>" is
consistently assigned to a specific version of the underlying product,
such that for example "Foo.Bar.3" will always be associated with
version "5.6" of "Foo", in practise this is sometimes (albeit rarely)
untrue.

What follows is from memory, as my doze box is being recalcitrant. I
seem to remember that "<Version>" is usually (always?) of the form
"<Major>.<Minor>", and I think that requesting "Foo.Bar.<Major>" is
supposed to get you the latest (or perhaps most recently used)
"Foo.Bar.<Major>.<Minor>". I do know that it is usually considered bad
form to ask for a specific version of a com object because that
requires that that exact version be available, and that in general
enumerating the available versions of a com object involves some
registry walking.

Dan "More recalcitrant than usual that is" Smart



Mon, 01 Sep 2008 20:12:02 GMT  
 COM related question

Quote:
> So, does anyone know how I can *specify* what version I want to
> start?

Pat / Dan,

Thanks for the input.  You're exactly on track... I heard from Chin
Huang privately, and he set me straight.

Instead of specifying:

AutoCAD.Application

I needed to add a version specifier, like this:

AutoCAD.Application.16.2 (for ACAD 2006)
AutoCAD.Application.16.1 (for ACAD 2005)
AutoCAD.Application.16 (for ACAD 2004)
AutoCAD.Application.15 (for ACAD 2000, 2000i, and 2002)
AutoCAD.Application.14 (for ACAD 14)

Interestingly, I do seem to have a problem starting version 2004 as
stated above.  When I start 2004 using the ".16" version, it actually
starts the last version used.  This seems to follow exactly what Dan
mentioned in his reply.

Version 2004 actually returns "16.0" as it's version, but that version
stamp fails miserably to start anything (like it's not even a valid
version).

Anyway, I've solved my specific problem, but the above does leave the
question of how to start ACAD 2004, if both 2004 and 2006 are
installed?

Thanks,

Jeff



Tue, 02 Sep 2008 01:57:41 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. NT related question (not really Python related)

2. masm .com(PSP) related trouble

3. .com extension in COMMAND -- virus related ?

4. COM and COM and Python and COM - comtest.py [0/1]

5. a short cut related question in awk

6. few questions mac related

7. Help related question

8. CAD graphics / mouse event related question

9. SearchFlash Related File Question

10. RelationManager related question

11. RELATE Class Question

 

 
Powered by phpBB® Forum Software