Update title block attributes by editing a excel document

Update title block attributes by editing a excel document

jason.bowman
Advocate Advocate
11,368 Views
14 Replies
Message 1 of 15

Update title block attributes by editing a excel document

jason.bowman
Advocate
Advocate

I want to be able to have an Excel spreadsheet which will also act as our document register and have cells in that document such as the drawing title to be linked with an block attribute in AutoCAD which will link them and update that attribute to what is entered in the Excel document.

 

Is this possible, if so... how?

0 Likes
Accepted solutions (1)
11,369 Views
14 Replies
Replies (14)
Message 2 of 15

chriscowgill7373
Advisor
Advisor

It is definitely possible, but would require some complex programming.  We use such a system here.  It converts the excel file to a txt format, then imports the txt file into the drawing properties.  then our title block uses fields that are linked to those drawing properties to update.

Check out this post over at AUGI for some assistance with getting info into the custom drawing properties:

http://forums.augi.com/showthread.php?29605-alternate-key-in-lisp-expression


Christopher T. Cowgill, P.E.

AutoCAD Certified Professional
Civil 3D Certified Professional
Civil 3D 2024 on Windows 10

Please select the Accept as Solution button if my post solves your issue or answers your question.

Message 3 of 15

jason.bowman
Advocate
Advocate

I've managed to do it to some extent.

 

We have 4 different blocks for each of our drawing sheets as they are different scales/set out but still have the same text entities and I have so far exported the attributes of the block from ONE sheet, linked to Excel and them imported it back into the drawing.

 

But I cannot figure a way to make it so that it updates the entities in all the blocks as each block has a unique handle ID, I've even tried exporting each black and importing the data into the same Excel document to no prevail?

 

Any idea on how to get it so it updates across different block IDs?

0 Likes
Message 4 of 15

chriscowgill7373
Advisor
Advisor

if you use custom drawing properties, you only need a field.  If you are trying to import the info directly into an attribute, in the coding we use, we specify the name of the block so it knows what to step through to get the proper attribute name. the selection set of blocks can be gathered using wild card characters, so if they are named similar, they can be grouped into the selection set.  I've never actually used the data extraction tools.


Christopher T. Cowgill, P.E.

AutoCAD Certified Professional
Civil 3D Certified Professional
Civil 3D 2024 on Windows 10

Please select the Accept as Solution button if my post solves your issue or answers your question.

Message 5 of 15

jason.bowman
Advocate
Advocate

Feel like I just fell of the side of the earth...

 

Have no clue what you're on about now 😞

0 Likes
Message 6 of 15

chriscowgill7373
Advisor
Advisor
Accepted solution

If you can use drawing properties for your title block information.  It doesnt matter what your title block is called, or what size it is.  as long as you have a predefined field within the attribute.

Command: DWGPROPS

image.png

within the attribute definition, in the default field

right click and select Insert Field

image.png

amongst the selection choices will be information from the dwgprops dialog above:

image.png

 


Christopher T. Cowgill, P.E.

AutoCAD Certified Professional
Civil 3D Certified Professional
Civil 3D 2024 on Windows 10

Please select the Accept as Solution button if my post solves your issue or answers your question.

Message 7 of 15

jason.bowman
Advocate
Advocate

Just had a tinker with that, will have to set them up and see if I can figure it out from there.

 

Will let you know how I get on

0 Likes
Message 8 of 15

jason.bowman
Advocate
Advocate

So, in theory if I have two different block layouts with the same fields and create the excel sheet with just the field entities, it will change it on both blocks?

0 Likes
Message 9 of 15

chriscowgill7373
Advisor
Advisor

Correct, we've got about a dozen or so title blocks that we use, and one excel file fits them all.


Christopher T. Cowgill, P.E.

AutoCAD Certified Professional
Civil 3D Certified Professional
Civil 3D 2024 on Windows 10

Please select the Accept as Solution button if my post solves your issue or answers your question.

Message 10 of 15

jason.bowman
Advocate
Advocate

I've created fields for the text entities and added them to each block specific in all 4 different blocks.

 

Do I now export the attributes of any of the 4 blocks and insert the data into Excel as I normally would? I want to try and avoid any coding if possible.

 

I have tried it but it says that the blocks weren't found when imported back into AutoCAD and it asked if I wanted to find the blocks manually?

0 Likes
Message 11 of 15

chriscowgill7373
Advisor
Advisor

I've not used the data extraction tool, I'd have to look and see how it works.  I'm not sure of a way to import information into the drawing properties short of at least using some coding.


Christopher T. Cowgill, P.E.

AutoCAD Certified Professional
Civil 3D Certified Professional
Civil 3D 2024 on Windows 10

Please select the Accept as Solution button if my post solves your issue or answers your question.

Message 12 of 15

chriscowgill7373
Advisor
Advisor

could this help:

https://knowledge.autodesk.com/support/autocad/learn-explore/caas/sfdcarticles/sfdcarticles/How-to-c...

It doesnt utilize an excel file though.


Christopher T. Cowgill, P.E.

AutoCAD Certified Professional
Civil 3D Certified Professional
Civil 3D 2024 on Windows 10

Please select the Accept as Solution button if my post solves your issue or answers your question.

0 Likes
Message 13 of 15

david.manningXME8A
Advocate
Advocate

I just wanted to post a possible alternate solution that I have been using. Many years later. 
I too would like to avoid programming to ensure ease of transfer and longevity. 

I have a spreadsheet that my drafters enter all title block details, that they can update the DWG by running a LISP. Its that simple to use. It can also be set-up to run automatically when a DWG is opened. 

The back end though is a little more complicated. 
The data entry spreadsheet needs a small VBA code imbedded that triggers when ever the file is saved and it exports the specified to a CSV file. 
This is the source that is used by the LISP to update the DWG title block fields. The LISP is a free one from Lee Mac (www.lee-mac.com

LISP source reference: https://www.lee-mac.com/updatetitleblock.html

VBA Code: 
I have attached a text copy of the VBA code. TO make it work for you you only need to edit the text highlighted below to specify which spreadsheet tab is to be exported and where to put the file (and the files name). 
The tab I am using is "2D Drawings" and the path goes to C:\temp\. . . 
The value of this is that you can have different spreadsheets for different projects that create different CSVs for each project. 

davidmanningXME8A_0-1715150471727.png

I'm happy to help anyone that wants to know more about this workflow. 
I ended up hear looking into skipping the CSV step. I know it will be possible, I just need to figure that out. 

0 Likes
Message 14 of 15

faisalWJ8Y9
Enthusiast
Enthusiast

Hey Chris,

 

Hopefully you are still around on here. I have a similar workflow to you in how the titleblock information is updated, the only difference is that, I am using attributes as opposed to fields. My problem however is, with excel I can update all the attributes and then export a csv which CAD reads and updates the titleblock information through a script.

 

But the thing is I have to open the drawing for the information to update. I want the information to update automatically, without the need to open the drawing, similiar to how sheetset works. 

 

Because I have a pdf script that runs through core console, bypassing the need to open each drawing like the publish command does, saving a lot of time, but the problem is that the attributes are not updated, unless i manually open each drawing first.

 

Do you have any ideas?

0 Likes
Message 15 of 15

chriscowgill7373
Advisor
Advisor

I am still around, there are a ton of new features and software improvements that have taken place in the 7 years since this post was last replied to.  Is there a way to do what you are asking, Im sure that you can look at objectarx or objectdbx to do it, but how to do it, that, I dont know.  I know that others use it to run tasks on multiple drawings without opening them.


Christopher T. Cowgill, P.E.

AutoCAD Certified Professional
Civil 3D Certified Professional
Civil 3D 2024 on Windows 10

Please select the Accept as Solution button if my post solves your issue or answers your question.

0 Likes