How can i acess the autocad mechanical part list and bom list with vb.net??

How can i acess the autocad mechanical part list and bom list with vb.net??

Anonymous
Not applicable
2,647 Views
7 Replies
Message 1 of 8

How can i acess the autocad mechanical part list and bom list with vb.net??

Anonymous
Not applicable

Hi everyone!

 

How can i acess the part list and bom from a drawing in the autocad mechanical??

 

i  want to fill a listview in vb.net with the the items that come from the autocad mechanical part list.

 

can someone send me a sample code?

 

Thanks.

0 Likes
2,648 Views
7 Replies
Replies (7)
Message 2 of 8

Anonymous
Not applicable

Anyone can help me here???

0 Likes
Message 3 of 8

cadMeUp
Collaborator
Collaborator

During your AutoCAD mechanical installation (2010 or 2011?), if the samples were included as part of the installation, there might be some sample code within the 'Sample' folder that would/should be in your AutoCAD installation folder. There probably is a vb.net sample of what you are trying to do. I don't have mechanical on my machine otherwise I would try and find and grab a sample for you, I'm running MEP 2010 & 2011. You can also post this question in the Mechanical discussion group.

0 Likes
Message 4 of 8

Anonymous
Not applicable

Ok i found the sample folder, but there is only a folder for  VBA,  and i want to do this in Autocad.net.

 

So if someone know something about this please reply.

 

thanks.

0 Likes
Message 5 of 8

cadMeUp
Collaborator
Collaborator

You can translate VBA code into VB NET code, you just need to look over the VBA code and see what needs to be translated. It's going to be very similar to VBA coding if you do it VB NET. I have AutoCAD 2009 Mechanical, on my machine this is where I found the PartList.dvb VBA project:

 

E:\Programs\Autodesk\AutoCAD 2009 Mechanical\Sample\Mechanical\VBA\Symbol\PartList.dvb

 

See the attached zip file that includes the dvb project, the VBA project code in a txt file (in case you can't open the dvb project directly), plus a VB NET starter code for you. I compiled it using Visual Studio 2005 for AutoCAD Mechanical 2009. You just need to add the correct references for your version of AutoCAD Mechanical, study the VBA code and you can see that you can transate it over into VB NET. Hopefully it will be similar for 2010 & 2011. Study the VBA code and read the comments in there.

 

The only reference that I had to add other than the standard typical AutoCAD references was:

Autodesk SymBBAuto 2.0 Type Library

 

Which you can find in the COM tab of the Add Reference dialog, although your SymBBAuto may have a different version number.

 

Hope this helps!

0 Likes
Message 6 of 8

cadMeUp
Collaborator
Collaborator

Sorry, oops, forgot the attachment, here it is...

0 Likes
Message 7 of 8

Anonymous
Not applicable

Hi cadMeup!

 

Thanks a lot for your help, I'm going to try your samples.

 

So with autocad.net, i have the same objects, methods and properties like in vb?, i only have to add autocad references in visual studio? i 'm able to create add-ins, with autocad.net right?

 

Working with autocad.net  i have acess to Autocad and autocad mechanical objects?

 

 

0 Likes
Message 8 of 8

cadMeUp
Collaborator
Collaborator

Yeah, you'll find that VB NET and what and how you code within VBA are pretty similar. You may have to add other references to your project to access other Mechanical objects if needed. So, yes you most certainly can create your add-ins for AutoCAD as well as AutoCAD Mechanical using VB NET.  See the attached image, I highlighted some of the possible references that you may have to add for the AutoCAD Mechanical side. I suggest downloading the ObjectARX SDK from Autodesk's site. There are DOT NET samples within the samples\dotNet folder.

 

The references you need for AutoCAD alone are:

AcDbMgd.dll (or acdbmgd.dll) - found in AutoCAD's program folder
AcMgd.dll (or acmgd.dll) - found in AutoCAD's program folder

 

and possibly:

Autodesk.AutoCAD.Interop.Common.dll - found in the ObjectARX folder inc-win32 or inc-x64

Autodesk.AutoCAD.Interop.dll - found in the ObjectARX folder inc-win32 or inc-x64

 

Also, you might check out the acadmauto_13_0.chm (for AutoCAD Mechanical 2009) help file in your AutoCAD Mechanical program Help folder. It is the AutoCAD Mechanical Active X and VBA Reference. Should be very useful for you. I'm sure the file has a different name for a newer release.

0 Likes