Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AutoCAD LT to Excel via VBA 1

Status
Not open for further replies.

UnsolvedCoding

Technical User
Jul 20, 2011
424
US
Does anyone know how, or can anyone point me in the direction of how, to link AutoCAD LT to Excel?

I would like to populate some templates with information and pull / put information from drawings.

So far all I find online is a hodge podge of various information non-relevant information about random AutoCAD versions.


It has taken me a while to make sense of what I hear at work involving computers. There is much talk of bugs and questions about Raid.
Therefore I have come to the logical conclusion that the only way to have a properly functioning computer is to regularly spray it with Raid bug killer.
 
Hi,

Does this version of AutoCAD have a VBA object library? Can you, from Excel VBA, Tools > References... scroll the list for any AutoCAD object library?

Skip,

[glasses]Just traded in my OLD subtlety...
for a NUance![tongue]
 
I have 4 different ones that show up as references.

AutoCAD 2016 Type Library
AutoCAD Focus Control for VBA Type Library
AutoCAD Map MPolygon Type Library
AutoCAD/ObjectDBX Common 20.0 Type Library


It has taken me a while to make sense of what I hear at work involving computers. There is much talk of bugs and questions about Raid.
Therefore I have come to the logical conclusion that the only way to have a properly functioning computer is to regularly spray it with Raid bug killer.
 
Do you have some understanding of the object model of AutoCAD?
So if you're interested in some text object in a drawing there must be some relationship that joins them together.

I might be looking for the database structure, especially looking for text associated with a drawing (a graphic representation of a physical object that is described textually: PartID, material, size, weight, etc.) Then a drawing just becomes a subset of the db structure. Hard to know what you envision to do with this.

Skip,

[glasses]Just traded in my OLD subtlety...
for a NUance![tongue]
 

Thanks for the link.

My goal is to pull text off the drawing when inside an outlined area or put the text into the drawing based on the symbols used by the engineers.

For example we use an outline of red dashed lines to identify what communication panel controls which section of the drawing. Each panel is placed within its own outline and all the communication and electrical components within the outline connect to the panel.

To be able to extract text from the panel outline and put it on Excel would save hours of work a day. Likewise being able to identify the symbols in the outline and place text next to it based on the panel number would save huge amounts of time.

It has taken me a while to make sense of what I hear at work involving computers. There is much talk of bugs and questions about Raid.
Therefore I have come to the logical conclusion that the only way to have a properly functioning computer is to regularly spray it with Raid bug killer.
 
Short of finding a member with VBA/AutoCAD experience, you might also Google 'AutoCAD VBA' which returned a wealth of possible links.

Seems you might have a learning curve to scale.

Faq707-4594
I have used this technique for exploring a new unfamiliar object model in my elementary VBA code and thereby discovering things that have shed light on my ignorance. It is especially helpful if you are referencing some KNOWN object and can then discover where, what you already know from observation can be found in the object. That alone can get you along the learning curve with dispatch.

OH, yes, you might want to CHECK those 4 references, at least the Type libraries, and also use the Object Browser in the VBA Editor window, to explore the objects, properties and methods & constants.

Skip,

[glasses]Just traded in my OLD subtlety...
for a NUance![tongue]
 
The AutoCAD object model is rather obtuse.
autocad-object-model.png


What you seem to want to do is non-trivial.

Your best chance of success would be to establish a very strict set of rules for the users to follow when preparing drawings. (Good luck with that.) Preferably using "Blocks" exclusively.

Figuring out what text is inside of a box should be relatively straight-forward. Not easy, but straight forward.

If your "symbols" are AutoCAD "Blocks", and pre-setup to have text associated with them then putting the text in via VBA is simple. However, to get the right text with the right symbol (you might use the same symbol multiple times on a drawing, right?) means that each instance needs to be uniquely identified. The user would need to do that at the time they insert it. So no time saved vs. just entering what you would enter by VBA I think.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top