.NET

Reply
Active Member
jrenatto
Posts: 8
Registered: ‎07-22-2013
Message 1 of 8 (339 Views)

Migration VBA to VBdotNet 2012 - Autocad 2013

339 Views, 7 Replies
07-22-2013 10:26 AM

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

*Expert Elite*
norman.yuan
Posts: 982
Registered: ‎04-27-2009
Message 2 of 8 (332 Views)

Re: Migration VBA to VBdotNet 2012 - Autocad 2013

07-22-2013 10:50 AM 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?).

Active Member
jrenatto
Posts: 8
Registered: ‎07-22-2013
Message 3 of 8 (328 Views)

Re: Migration VBA to VBdotNet 2012 - Autocad 2013

07-22-2013 11:27 AM 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: (
*Expert Elite*
norman.yuan
Posts: 982
Registered: ‎04-27-2009
Message 4 of 8 (318 Views)

Re: Migration VBA to VBdotNet 2012 - Autocad 2013

07-22-2013 11:40 AM in reply to: jrenatto

Document.GetAcadDocument()

 

No argument to be supplied.

Active Member
jrenatto
Posts: 8
Registered: ‎07-22-2013
Message 5 of 8 (319 Views)

Does not work I have the following error:     Error 1 'M...

07-22-2013 11:48 AM 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'.

*Expert Elite*
norman.yuan
Posts: 982
Registered: ‎04-27-2009
Message 6 of 8 (313 Views)

Re: Does not work I have the following error: Error 1 'M...

07-22-2013 11:55 AM 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.

 

 

Active Member
jrenatto
Posts: 8
Registered: ‎07-22-2013
Message 7 of 8 (305 Views)

Re: Migration VBA to VBdotNet 2012 - Autocad 2013

07-22-2013 12:45 PM 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.

Active Member
jrenatto
Posts: 8
Registered: ‎07-22-2013
Message 8 of 8 (222 Views)

Re: Migration VBA to VBdotNet 2012 - Autocad 2013

07-27-2013 05:17 AM in reply to: jrenatto

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

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.