Jump to content

Recommended Posts

Posted (edited)

Hi All,

 

Following an idea posed in this thread, I have created the following code to enable a user to automatically update titleblock attributes using data sourced from a CSV Drawing Register, a file which may be created using the DataExtraction command.

 

The code is designed to be as generic as possible to benefit the majority of users. The location of the CSV Drawing Register may be entered at the top of the code, or this may be left nil (current setting), in which case the user is prompted for selection of a CSV Drawing Register from which attribute data will be sourced.

 

The code also comes equipped with an optional block filter, located at the top of the code. If nil, the code will update all attributed blocks with attribute tags matching those listed in the headings of the CSV Drawing Register. The block filter may also use wildcards: e.g. "*BORDER".

 

An example of the expected format of the CSV Drawing Register is as follows:

 

+------------+-----------+----------+----------+-----+----------+
|    DWG     |  Layout*  |   TAG1   |   TAG2   | ... |   TAGN   |
+------------+-----------+----------+----------+-----+----------+
|  Drawing1  |  Layout1  |  Value1  |  Value2  | ... |  ValueN  |
+------------+-----------+----------+----------+-----+----------+
|  Drawing1  |  Layout2  |  Value1  |  Value2  | ... |  ValueN  |
+------------+-----------+----------+----------+-----+----------+
|  Drawing2  |  Layout1  |  Value1  |  Value2  | ... |  ValueN  |
+------------+-----------+----------+----------+-----+----------+
|    ...     |    ...    |    ...   |    ...   | ... |    ...   |
+------------+-----------+----------+----------+-----+----------+

*Layout column is optional.

 

Where the first column contains drawing filenames (with or without extension).

 

The second column is an optional 'Layout' column for drawings containing different titleblock information on different layouts. Change the setting at the top of the code if the CSV Drawing Register contains a Layout column next to the Drawing Filename Column.

 

The remaining columns contain the corresponding values of those attribute tags listed in the first row.

 

A Short Demonstration

 

UpdateTitleblock.gif

 

The code is currently geared to run upon being loaded to enable users to add the code to either the Startup Suite or ACADDOC.lsp (see here for information about doing so), and hence automatically update titleblock attribute information whenever a drawing file is opened. This 'autorun' functionality can easily be disabled as described in the code header.

 

Please read the code header for more information, and, if you have any questions about the code, please don't hesitate to ask.

 

Regards,

 

Lee

 

A full description of the program including example CSV Drawing Register demonstrating the correct format can be found here.

UpdateTitleblockV1-9.lsp

Edited by Lee Mac
Updated code.
Posted

Lee, could you add as an optional 2nd column the Layout tab? I.e. if the 2nd column of the CSV is headded by the word "Layout" you should use (410 . "LayoutName") in the ssget filter, and start reading the tag values from the 3rd column.

Posted
Lee, could you add as an optional 2nd column the Layout tab? I.e. if the 2nd column of the CSV is headded by the word "Layout" you should use (410 . "LayoutName") in the ssget filter, and start reading the tag values from the 3rd column.

 

That's a nice idea Irne - I might add that as another option at the top of the code :)

Posted

Cool and I too thought about the layout the problem I had with that idea was that it then had to go to every layout, and that took a lot of time, and I didn't really needed it.

Posted
Lee, could you add as an optional 2nd column the Layout tab?

 

Cool and I too thought about the layout the problem...

 

Code updated to allow for 'Layout' column next to the Drawing Filename Column - the setting for this is located at the top of the code.

 

Enjoy!

 

Lee

  • 4 months later...
  • 3 months later...
Posted

I have updated this program to Version 1.2. This version removes the case-sensitivity from the 'Drawing filename' column (first column) of the CSV Drawing Register. This was an oversight in previous versions, brought to light following reports from some users that drawings could not be found in the CSV Drawing Register.

 

I have also added a GIF animation to provide a short demonstration of how to use the program to link drawings to a CSV Drawing Register, synchronising the titleblock attributes.

 

A full description of the program can also be found on my site here, along with the latest version.

 

Lee

  • 1 year later...
Posted

I have updated this program to Version 1.5; the new version of the code revises the CSV file parser function to account for the use of alternative cell delimiter characters (such as a semi-colon) used by some systems.

 

The latest version can be found in the first post of this thread, or on my site here.

 

Lee

  • 8 months later...
Posted

Following a reported bug concerning parsing of CSV cell values containing a certain combination of commas & quotation marks, I have updated this program to Version 1.6; the latest version can be found in the first post of this thread, or on my site here.

 

Enjoy,

 

Lee

  • 1 year later...
Posted

Hey Lee,

 

I've been using this lisp a lot and saved me a lot of time, thank's for this.

 

Today i need to import russian and chinese text to my title block but it looks like it's not supporting it. I get only question marks imported. into the title block. In the CSV it's displayed correctly.

 

Is it possible to support this in your lisp?

 

Here is example of what i'd like to import: КЛЮЧЕВОЕ МЕХАНИЧЕСКОЕ ОБОРУДОВАНИЕ

 

Many thanks in advance for your help!

Posted

Hi Astro,

 

I'm pleased to hear that you find this program useful in your work!

 

Is it possible to support this in your lisp?

 

It is not possible using the standard AutoLISP functions for reading/writing text files (i.e. open/read-line/write-line/close), since these are designed to support only ASCII characters.

 

However, a client contacted me some time ago with the same request, and I was able to develop a version of the program which read the CSV file as a binary stream, before converting the stream to Unicode code points. However, this is a much slower method and also quite temperamental. Needless to say, this version of the code is not freeware.

 

Lee

Posted

Always neat to see the ideas you implement (first time seeing this).

 

Curious to know how this stacks up against Sheet Set Manager (SSM) propagation in your testing, in terms of performance?

 

Cheers

Posted

Thank's a lot for your reply, good to know that the standard Autolisp functions are only supporting ASCII

Posted
Always neat to see the ideas you implement (first time seeing this).

 

Thanks BlackBox :thumbsup:

 

Curious to know how this stacks up against Sheet Set Manager (SSM) propagation in your testing, in terms of performance?

 

The SSM is most probably a far more elegant & recommended solution for this task seeing as it makes use of OOTB functionality, though, unfortunately I really couldn't offer any comparison, as this is one of the few areas of AutoCAD to which I have not yet ventured. :oops:

Posted
Thank's a lot for your reply, good to know that the standard Autolisp functions are only supporting ASCII

 

You're welcome Astro!

  • 2 months later...
Posted

Hi Lee,

 

Great program, very helpful. I do have a problem where attributes in a dynamic block (visibility parameter only) are not updating. If I remove the visibility parameter, the attributes update just fine. Is there something I am doing wrong or does this program not work with dynamic blocks? I have checked everything I can think of (locked location, annotative scale, layers, etc.). I am not controlling the visibility of the attributes with the visibility parameter. I leave the attribute blank if I do not want it visible.

I would appreciate any help you can provide.

 

Thanks.

  • 2 weeks later...
Posted
Great program, very helpful. I do have a problem where attributes in a dynamic block (visibility parameter only) are not updating. If I remove the visibility parameter, the attributes update just fine. Is there something I am doing wrong or does this program not work with dynamic blocks? I have checked everything I can think of (locked location, annotative scale, layers, etc.). I am not controlling the visibility of the attributes with the visibility parameter. I leave the attribute blank if I do not want it visible.

I would appreciate any help you can provide.

 

Thank you, I'm pleased that you find the program useful.

 

The program should be compatible for use with dynamic blocks since the program updates the attribute values based on the attribute tag name and not the block name (which could potentially be anonymous where dynamic blocks are concerned).

 

Are you using the latest version of the program? (Version 1.7)

 

Have you changed the block filter parameter? (Line 103)

 

Lee

Posted

We had changed the block filter to "* Attributes" and it worked for all blocks ending in " Attributes" except for the dynamic block.

I changed the block filter to "nil" and it now works with the dynamic block also. I was using Version 1.6 and wanted to see if I could correct the problem before upgrading to Version 1.7.

 

Thanks for your help. I have learned a lot from your website.

 

Joel

Posted
We had changed the block filter to "* Attributes" and it worked for all blocks ending in " Attributes" except for the dynamic block.

I changed the block filter to "nil" and it now works with the dynamic block also. I was using Version 1.6 and wanted to see if I could correct the problem before upgrading to Version 1.7.

 

Thanks for your help. I have learned a lot from your website.

 

Joel

 

You're very welcome Joel, I'm pleased that you found my website useful.

 

Since dynamic block references assume an anonymous block name when the dynamic parameters are altered from that of the block definition, the block filter parameter in my program would need to be changed to: "`*U*,* Attributes" in order to include such dynamic block references.

 

Lee

  • 2 weeks later...
Posted

Hi

 

I’ve just started using this code today. Although I’m not sure how to get the code to run automatically when I open the DWG file. I’m using the sample DWG and Sample CSV files. I’ve loaded the UpdateTitleblockV1-7.lsp into my Startup Suite.

 

I open the Sample CSV file and make my changes to the Tag cells and save. When I open the DWG file nothing happens, I then have to run the UTB command and go and find the location of the Sample CSV file.

 

How can I get it to update the DWG just by typing UTB in the command line like the Demonstration video?

 

Thanks

 

Bob

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...