Add references of several autocad versions

Add references of several autocad versions

renzonet
Contributor Contributor
3,150 Views
15 Replies
Message 1 of 16

Add references of several autocad versions

renzonet
Contributor
Contributor

Hi, I would like you to help me.
I'm programming in vba from visual studio, I have autocad 2018 but when I take my application to another pc that has autocad 2014 error.
How can I add more references, because when I want to load the references of autocad 2014 I get the idea that the reference already exists.
help me please

0 Likes
3,151 Views
15 Replies
Replies (15)
Message 2 of 16

imadHabash
Mentor
Mentor

Hi,

your issue need a specialists that can help you ... and you will find them here . >> Click <<

 

Regards,

Imad Habash

EESignature

0 Likes
Message 3 of 16

renzonet
Contributor
Contributor

Thank you

0 Likes
Message 4 of 16

Ed__Jobe
Mentor
Mentor

You can't do that with a vba dvb because the dvb isn't just the written code, it also includes compiled code. Also, when you load a dvb, the vba environment automatically binds to the version of type library that is currently running. If your dvb was compiled with code for 2014 and you open the dvb in 2018, the 2014 code gets deleted and the dvb project is then updated for the current tlb reference and then recompiled. If you then try to use the same dvb in 2014, you will get the error you described. You need to maintain a dvb for each version of acad you are running.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes
Message 5 of 16

renzonet
Contributor
Contributor

Thanks for your answer.
the problem is that I do not want to make a program for each version of autocad, because those who are going to use the program have different version of autocad.
I work with Visual Studio, apparently there is no other solution.
Thank you very much.

0 Likes
Message 6 of 16

norman.yuan
Mentor
Mentor

You may want to describe what you do clearer, since you mentioned both VBA and using Visual Studio - this 2 usually are not mix-used.

 

Are you doing AutoCAD VBA development? Why is Visual Studio used? Do you use Visual Studio (assuming with either C# or VB.NET) to generate a COM-able DLLs and use it in AutoCAD VBA? Or, in fact you are not doing AutoCAD VBA, but AutoCAD .NET (with VB.NET)?

 

Depending on what exactly you are doing, the answer to your question would be quite different.

Norman Yuan

Drive CAD With Code

EESignature

0 Likes
Message 7 of 16

renzonet
Contributor
Contributor

Hello, I use Visual Studio to work with Visual Basic. I do not do it from the autocad VBA. I want to send commands to autocad, but the problem is when they use different versions of autocad.

thank you very much.

0 Likes
Message 8 of 16

norman.yuan
Mentor
Mentor

Well, you still not make it clear enough: using VB.NET doing what: is it an stand-alone EXE app that automates AutoCAD (via AutoCAD COM API) or is it an AutoCAD .NET API add-in (DLL project)?

 

However, for both cases, in general you can set references to the oldest version of your AutoCAD target versions and expect your code would be work with newer versions of AutoCAD, as long as the "oldest" is not that too old. For example, if you develop against AutoCAD 2015, your code most likely work OK all the way up to AutoCAD 2019.

Norman Yuan

Drive CAD With Code

EESignature

0 Likes
Message 9 of 16

renzonet
Contributor
Contributor
The oldest machine has the 2014 version, do you think it works?
0 Likes
Message 10 of 16

norman.yuan
Mentor
Mentor

Again, you did not say what type of project you are doing (EXE or DLL add-in), the only thing I could say is, yes, if you program against AutoCAD2014, the code would very LIKELY work OK with later versions of AutoCAD, but not 100% guaranteed, you need to do thorough test on each target later version.

Norman Yuan

Drive CAD With Code

EESignature

0 Likes
Message 11 of 16

renzonet
Contributor
Contributor
Sorry, my program is an .exe out of autocad, try trying to add autoicad
references 2014.
Thank you
0 Likes
Message 12 of 16

Anonymous
Not applicable

Hi.  i want  Add references of several autocad versions in vba6

please help me!

0 Likes
Message 13 of 16

norman.yuan
Mentor
Mentor

VBA6? Which version of AutoCAD do you use? It has been VBA 7 since AutoCAD 2015. If you are really talking about AutoCAD VBA, which is built-in with AutoCAD (even it is a separate installation), it is tied to which ever the AutoCAD version is. You do not add references to AutoCAD's type library of different version.

 

Maybe you actually mean VB6 (a.k.a. classical Visual Basic)? and you want to build an EXE to automate AutoCAD? There is no way to add references of multiple AutoCAD versions at the same time.

 

You may want to explain what you want to do in detail and what you use (VBA in AUtoCAD, or VB classical or VB.NET)...

 

 

Norman Yuan

Drive CAD With Code

EESignature

0 Likes
Message 14 of 16

Anonymous
Not applicable

i have vba6 that i add autocad 2013  to reference in vba6.

that i want when a user have autocad 2018 then i want my app can  work with autocad 2018.

but i dont neet to several autocad in one computer but i want my app can work with any version of autocad in any computer.

sorry my english is not good.

0 Likes
Message 15 of 16

norman.yuan
Mentor
Mentor

If you are talking AutoCAD VBA, you DO NOT add reference to AutoCAD type library, AutoCAD VBA add it automatically and you CANNOT change it. See picture below: the red-circle reference is FIXED and cannot be changed:VBA Acad Type Library Reference.png

 

Again, you better explain what you want to do/achieve, rather than just saying something that you should not do (adding different version of Acad reference) in AutoCAD VBA. But let me guess: you write VBA code in AutoCAD 2013 (which has Acad2013 type library referenced, of course). Then you want to a user with AutoCAD 2018 64-bit to run your VBA project and the code does not run? 

 

If that is the case, as long as the said Acad2018 is 32-bit, your VBA project might run OK. However, who runs 32-bit AutoCAD of later versions these days? Almost no one! So, let me assume the user uses 64-bit AutoCAD (2018, or whatever). Thus, the code would most likely not work until you actually open the VBA project in AutoCAD and do some fixes, because VBA in 2013 is 32-bit. Note, depending on what the VBA project does, the required fixes vary. The point is, you need to open the VBA project in a 64-bit AutoCAD/VBA and open the "References" dialog box to fix any references flagged "Missing" and then save the VBA project. After that, the VBA project would likely work with mutiple version of AutoCAD of 64-bit without any change.

 

 

 

Norman Yuan

Drive CAD With Code

EESignature

0 Likes
Message 16 of 16

Sea-Haven
Mentor
Mentor

I can here the moaning but lisp can call a dvb and lisp can check what version of autocad your running, so woud load either the 2013.dvb or 2018.dvb and continue. Yes would need two versions but user would not see the choice.

 

0 Likes