VB.Net - AutoCAD 2008

I'd like to read data from a .dwg file into my vb.net 2005 application.

I'm not up to speed on how to use AutoCAD, but when I open the dwg file, there is a datagrid type of control  in the drawing file that contains 4 columns and many rows.  I need to read each row in the datagrid and have the ability to specify which column also.

If anyone has sample code that can read from the current .dwg file open in AutoCAD 2008, that would be very helpful.

I have referenced acdbmgd.dll and acmgd.dll in my project.  I've been reading about ObjectARX, but I'm not sure this is available for AutoCAD 2008.

If it's better I read from the AutoCAD file itself or their database, I'd be open to that option also.

the project requires me to read part numbers, descriptions, and quantities from AutoCAD.
JMO9966Asked:
Who is Participating?
 
victorusCommented:
Can you post the file for us to upload and examine?
0
 
JMO9966Author Commented:
Thanks,

I have written a program that communicates with the current drawing file open in SolidWorks by using these objects. I was thinking of doing similar with AutoCAD if they have standard objects to use.

Dim swApp As sldworks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swDraw As sldworks.DrawingDoc
Dim swView As SldWorks.view
Dim swTable As sldworks.TableAnnotation

I then read data from the data table within the drawing file:

 swDraw = swModel
        swView = swDraw.GetFirstView
        swTable = swView.GetFirstTableAnnotation
        'jbm
        initial_load = False
        Do While Not swTable Is Nothing
            ProcessTable(swApp, swModel, swTable)
            swTable = swTable.GetNext
        Loop

Is this possible with AutoCAD or would I be better off exploring a solution where I retreive data from their database instead ??

I have attached one AutoCAD drawing file.
0
 
JMO9966Author Commented:
Here the file is again if it didn't come through.

Come on guys, there has to be plenty of knowledge on how to read data from the drawing file or their db??
0
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

 
victorusCommented:
Hi JM,

I don't see the DWG file attachment as part of your message. I will try again from another computer tomorrow that is running MS Explorer (I am currently on my Linux box w/ Firefox).

I can get your data from AutoCAD in several different ways other than ObjectARX. I wanted to see the file because I wanted to see the item you refer to as a "data grid". It may be an AutoCAD table which should have its entities and their values available from the AutoCAD programming interface, specifically AutoLisp or VisualLisp.

Some AutoCAD entities have built in extraction capabilities that can be exported to CSV type data streams.

Why don't you send me the file to this email address:
bd125@assi-cad.com and I will take a look at it?
0
 
victorusCommented:
Hi JM,

Got your file. This is a piece of cake! Each record is an AutoCAD block (block name BOM in your sample drawing) with attributes. You can use the command ATE (stands for Attribute Edit) to edit each attribute. Here are a few ways that you can extract the data to a file:

1. You can use the command EATTEXT. This stands for Extended Attribute Extract. You will be stepped through a number of screens to identify what blocks you want to extract, if you want to save your extraction method to a template for future use, the file name of that template, what attributes of the blocks you want to extract, what fields you want to extract, what order you want, and finally a file name that you want to extract to.

2. You can use the regular command ATTEXT. This stands for Attribute Extract. With this method you must create a template file that will tell what attributes are to be extracted.

For both of the above methods go to HELP in AutoCAD and search for EATTEXT and ATTEXT.

3. It would be an easy programming task to create an AutoLISP program that would find the blocks, extract the attributes and write them to a text file.

If the case is that the same blocks are on different drawings with the same format (consistent) , I would choose option #3, save the output to the same file name every time. That way you can set your software to pick up the export file in the same place every time. Also the user could basically "press a button" and everything would be automated.

If you want to have a go at the programming your self here is a good start:
http://usa.autodesk.com/adsk/servlet/item?siteID=123112&id=3369513

0
 
JMO9966Author Commented:
Thanks!

I would be pursuing the AutoLISP option.  Would you say it's a fair assumption to expect that most AutoCAD users already have a data table like my example file in their drawing files or could easilly add on with the agreed upon block references?
0
 
darrenmcwiCommented:
Huh?
0
 
victorusCommented:
I would NOT say that it is a fair assumption that most AutoCAD users already have a table like this in their drawing files. AutoCAD out of the box has nothing like this "built in" to the base product.

This table was probably created from a third party software like Architectural Desktop or Inventor. I have seen a number of DOOR SCHEDULES that use this technique of stacked blocks, each one a single record with multiple attributes.

Yes, it would be easy to add the block references if the blocks were supplied. If you wanted to supply the block you could easily create a drawing file (DWG) and the user would INSERT the file into his / her drawing as a block upon they would be prompted to input the fields. You could easily include this as part of your LISP routine.

Do you plan to do the LISP programming yourself or farm that out?
0
 
JMO9966Author Commented:
I would like to attempt the LISP programming, but in reading that article, I was lost.

Thanks guys, I'll be closing this request soon.
0
 
victorusCommented:
This is a pretty easy LISP programming task so it would not cost you much to have it written for you. You would have to clearly define the parameters that you wanted included.

I would suggest that you supply the AutoCAD block that would be used for the data extraction so that you would have control over the number of attributes, their order, their names and tags, etc..

I could suggest a couple of sources to get a quote for the programming if you would like....
0
 
JMO9966Author Commented:
Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.