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

How to update drawing from data in Excel

1 REPLY 1
Reply
Message 1 of 2
edweberg
279 Views, 1 Reply

How to update drawing from data in Excel

Greetings,

I've written some applications in VB.NET for AutoCAD, but I've never gone outside of ACAD in my code and I'm not sure how to go about this.  Please consider the following:

 

A drawing with many blocks.  Each block has an ENTITY_ID (tag and prompt) attribute which uniquely identifies the block in the drawing.  

 

An Excel spreadsheet has a list of ENTITY_ID values and the layer that corresponding blocks are to be assigned.  

 

From AutoCAD I need to be able to automate the following process:

For each block, go out to the Excel spreadsheet, do a vlookup on the ENTITY_ID value, retrieve the layer, come back to ACAD.  If that layer exists, assign that current block to that layer.  If the layer doesn't exist, create it and assign the current block to that layer.  Go on to the next block until all blocks are done.  

 

The part that has me stumped is the part about going out to Excel and performing Excel functions (vlookup, primarilly) and retrieving what is discovered back into ACAD and continue using that data in the code in ACAD.  

 

BTW, the spreadsheeet is HUGE.  Not sure it is best to import the spreadsheet into ACAD and use it in there.  Probably best to keep Excel separate from AutoCAD and just bop between the two.  If that is possible.  Which is part of which I'm asking; whether it is possible and then how to do it.

 

Thank you for any helpful replies.

 

Erik

1 REPLY 1
Message 2 of 2
dgorsman
in reply to: edweberg

Excel is great for humans, not so much for computers which can use better options ie. you might want to consider using a database as they are faster to do lookup/search operations with large amounts of information.  In any event, there are some highly useful items in the dotNET framework for connecting to external data sources.  I'd recommend building a compact interface that is opaque from any calling code so that if you need to change it to work with an XML file(s), Access database, SQL Server database, or other format in the future you only need to twiddle a couple of pieces of code inside that interface and not the entire program.

 

Might also want to investigate handles in AutoCAD as a unquie object ID system.

----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.


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