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

Migration VBA to VBdotNet 2012 - Autocad 2013

7 REPLIES 7
Reply
Message 1 of 8
jrenatto
793 Views, 7 Replies

Migration VBA to VBdotNet 2012 - Autocad 2013

Regards,
Maybe someone can help me solve my problem.
I wonder why this code does not work when working with AutoCAD 2013:

VBNET2.png

 

I wonder if the way we work with INTEROP, and INTEROP.COMMON, has changed in AutoCAD 2013, and if so what would be the new way of working with these references.

 

When I run the plugin shows me the following error:

VBNET3.png

7 REPLIES 7
Message 2 of 8
norman.yuan
in reply to: jrenatto

There are some changes in AutoCAD .NET API since ACAD2013. In your case you call Document's extension method GetAcadDocument():

 

Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiDocument.GetAcadDocument()

 

FYI, migrating COM based VBA code into .NET API code and yet still using COM API doing the work is not a good choice. When start doing .NET programming withg AutoCAD, it would be better to forget all the COM stuff and try to learn and understand the .NET API, and only turn to COM when you really cannot find a way to do it with .NET API or you really have no time to learn .NET API (then why not stick with VBA?).

Message 3 of 8
jrenatto
in reply to: norman.yuan

Replacing the inserted code is this:

Thisdrawing = Autodesk.AutoCAD.ApplicationServices.DocumentExtension.GetAcadDocument(Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument)

But unfortunately I get the same error, maybe I'm using wrong: (
Message 4 of 8
norman.yuan
in reply to: jrenatto

Document.GetAcadDocument()

 

No argument to be supplied.

Message 5 of 8
jrenatto
in reply to: jrenatto

Does not work I have the following error:

 

vb5.png

 

Error 1 'MdiDocument' is not a member of 'Autodesk.AutoCAD.ApplicationServices.DocumentCollection'.

Message 6 of 8
norman.yuan
in reply to: jrenatto

Since Acad2013, you need add 3 managed references:

 

accordmgd.dll

acdbmgd.dll

acmgd.dll

 

It is likely that you missed setting reference to accoremgd.dll.

 

 

Message 7 of 8
jrenatto
in reply to: jrenatto

If I have added the three references, not what will be the problem, as you show me and should work but still the same.
Anyway thank you very much po devote their time to help me solve my problem.

Message 8 of 8
jrenatto
in reply to: jrenatto

Already achieved migrate vba to vb.net your help it was very useful, thank you very much.

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