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

Path from VBA/VB 5 to VB 2005/.Net

6 REPLIES 6
Reply
Message 1 of 7
Anonymous
272 Views, 6 Replies

Path from VBA/VB 5 to VB 2005/.Net

Hi everyone,

I have done a lot of AutoCAD customization in VBA and VB 5, and now going to
VB 2005. I am still looking at VB 2005 and .Net in general, to find what is
the new "offer" and to determine which path I will follow to do the
transition. I came with these conclusions and would like to know if I am
right or wrong.

1. Using the Interop namespace, I can still use the old ActiveX (.COM)
interface I know so well, and benefit from the real OO language VB is now.
Advantages: I can come up to speed faster. Disadvantages: the .COM interface
may be removed, or may not updated in the future, forcing me to move to .Net
in some time.

2. Going straight to .Net. Advantages: access to a richer API.
Disadvantages: steeper learning curve.

Now a few questions

1. Using .Net for AutoCAD is in fact like using ObjectARX. Is this right ?

2. Using VBA, and to a certain point VB 5, the same code could be used with
more than one version of AutoCAD, for example 2002/2004/2005. Using .Net, is
the code tied to a single AutoCAD version ?

Thanks

Gilles Plante
6 REPLIES 6
Message 2 of 7
ChrisArps
in reply to: Anonymous

You can still use interop but it will be much slower than the dotnet interface. Each property or method must lock and unlock the document each time. The dotnet api with transactions is MUCH faster.

>>1. Using .Net for AutoCAD is in fact like using ObjectARX. Is >>this right ?
Dotnet is able to more directly wrap C++ objects versus ActiveX, so you get the power of ObjectARX without all the danger of C++.

>>2. Using VBA, and to a certain point VB 5, the same code >> Using .Net, is the code tied to a single AutoCAD version ?

If you stay away from COM, then you will not be tied to a specific version. Once com interop is used, you will have to generate a .dll for each Autocad release (yet another reason to get away from com).

Chris Arps
VisionREZ Team Lead
www.visionrez.com
Message 3 of 7
Anonymous
in reply to: Anonymous

Chris,

looks like there is something I misunderstand.

I thought that .Net was simply an indirect way of using ObjectARX (a wrapper
?). ObjectARX and .Net are different APIs that are developped separately,
and looks to be the prefered way to customize AutoCAD - at least it seems to
be the message from Autodesk - right ?

Thanks

Gilles Plante

a écrit dans le message de news: 5100179@discussion.autodesk.com...
You can still use interop but it will be much slower than the dotnet
interface. Each property or method must lock and unlock the document each
time. The dotnet api with transactions is MUCH faster.

>>1. Using .Net for AutoCAD is in fact like using ObjectARX. Is >>this right
>>?
Dotnet is able to more directly wrap C++ objects versus ActiveX, so you get
the power of ObjectARX without all the danger of C++.

>>2. Using VBA, and to a certain point VB 5, the same code >> Using .Net, is
>>the code tied to a single AutoCAD version ?

If you stay away from COM, then you will not be tied to a specific version.
Once com interop is used, you will have to generate a .dll for each Autocad
release (yet another reason to get away from com).

Chris Arps
VisionREZ Team Lead
www.visionrez.com
Message 4 of 7
Anonymous
in reply to: Anonymous

Hello Gilles,

I'm currently using VS2005 Standard Edition and COM Interop. That is, I'm
translating automation servers I've written in Delphi and some lisp code as
well.
I've also been tinkering with the .NET api for a while.
As to the first: I've never worked more comfortably with COM before.
As to the second: the stuff is awfully underdocumented not to say
undocumented. The only companion you have seems to be the Visual Studio
object browser. Unless you have additional information (which I don't) you
're going to lose a lot of time just figuring out things. After a while, I
couldn't help feeling like some guinea pig.
I'm not quite unexperienced. I've been progragramming rather a lot since
1979.
Still, this is my own and personal opinion. May very well be I'm just too
plain stupid for the .NET api
Just play around with it for a while... The best way to find out.

Greetings.
Message 5 of 7
ChrisArps
in reply to: Anonymous

ObjectARX is the native C++ interface, this is what AutoCAD is written in and you still must use to do some things.

For example, custom entities are not possible in dotnet, you must use C++.

Most of the dotnet api is done by exposing the C++ classes to dotnet with a managed wrapper class. This handles the memory managment and translation of the data from C++ to dotnet data types.
The nice thing about this technique is that it takes almost no effort on the part of the programmer versus an ActiveX interface that can take 40+hours to implement.

C++ / ObjectARX -> Does everything but is fast and dangerous (memory leaks, crashing pointers, etc).

Dotnet -> slower due to translation of data, but much safer and cost effective to program in.

I personally am 5 times more productive in dotnet than C++.


Chris Arps
Message 6 of 7
Anonymous
in reply to: Anonymous

Nemorarius,

I remember when I started programming AutoCAD R14 in VBA. The documentation
was also horrible. Coding simple things turned into a nightmare. Even today,
some of the examples in the AutoCAD documentation are buggy, or absent.
Internet came to the rescue, and books became available.

Regarding .Net, are there any good books helping programming AutoCAD using
.Net (I know, it is the $ 50,000 question...) ?

Gilles

Looks like
"Nemorarius" a écrit dans le message de news:
5100957@discussion.autodesk.com...
Hello Gilles,

I'm currently using VS2005 Standard Edition and COM Interop. That is, I'm
translating automation servers I've written in Delphi and some lisp code as
well.
I've also been tinkering with the .NET api for a while.
As to the first: I've never worked more comfortably with COM before.
As to the second: the stuff is awfully underdocumented not to say
undocumented. The only companion you have seems to be the Visual Studio
object browser. Unless you have additional information (which I don't) you
're going to lose a lot of time just figuring out things. After a while, I
couldn't help feeling like some guinea pig.
I'm not quite unexperienced. I've been progragramming rather a lot since
1979.
Still, this is my own and personal opinion. May very well be I'm just too
plain stupid for the .NET api
Just play around with it for a while... The best way to find out.

Greetings.
Message 7 of 7
Anonymous
in reply to: Anonymous

Gilles,

As to the books on programming AutoCAD using the .NET api, I haven't seen
any.
Not in bookshops, that is.
I'm afraid the days when you could buy books on (serious) programming and
actually learn it in them are over.
A title such as "Programming AutoCAD using .Net" doesn't have much chance of
becoming a commercial succes.
So it's highly probable it will not materialize.

Greetings.

"Gilles Plante" wrote in message
news:5102199@discussion.autodesk.com...
Nemorarius,

I remember when I started programming AutoCAD R14 in VBA. The documentation
was also horrible. Coding simple things turned into a nightmare. Even today,
some of the examples in the AutoCAD documentation are buggy, or absent.
Internet came to the rescue, and books became available.

Regarding .Net, are there any good books helping programming AutoCAD using
.Net (I know, it is the $ 50,000 question...) ?

Gilles

Looks like
"Nemorarius" a écrit dans le message de news:
5100957@discussion.autodesk.com...
Hello Gilles,

I'm currently using VS2005 Standard Edition and COM Interop. That is, I'm
translating automation servers I've written in Delphi and some lisp code as
well.
I've also been tinkering with the .NET api for a while.
As to the first: I've never worked more comfortably with COM before.
As to the second: the stuff is awfully underdocumented not to say
undocumented. The only companion you have seems to be the Visual Studio
object browser. Unless you have additional information (which I don't) you
're going to lose a lot of time just figuring out things. After a while, I
couldn't help feeling like some guinea pig.
I'm not quite unexperienced. I've been progragramming rather a lot since
1979.
Still, this is my own and personal opinion. May very well be I'm just too
plain stupid for the .NET api
Just play around with it for a while... The best way to find out.

Greetings.

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