Concatenations in Title Block Update - AutoCAD Electrical

  • Concatenations in Title Block Update - AutoCAD Electrical
    May 2, 2008, 08:31 AM Nate Holt

    Going beyond simple one-for-one text value insertions into a title block... this customer issue came up a couple days ago. AutoCAD Electrical's project-wide title-block update tool defaults to simple mapping of discrete drawing or project setting values to individual attributes in the title block. But this customer needed to format several of these drawing-specific values into one concatenated text string value and push it out to a single attribute on each drawing's title block.

    Let's say that the user's title block carries attribute "TB-DNAM" that is to carry a value that is a combination of the following project and drawing-specific values: Project "LINE3" value, then a dash character, then the project's "LINE14" value, then a colon, and finally the drawing's SHEET number assignment.

    Normally, this would have to be all done by hand. But with a little customization, we can trigger AutoCAD Electrical's title block update command to do this attribute value format automatically. Let's write a little AutoLISP function that we'll call "tb_concatenate.lsp", and it will concatenate values and return a single text string.

    And then, in our title block update ".wdt" file (or on the title block's invisible WD_TB attribute), we'll include the "TB-DNAM" attribute annotation to reference this AutoLISP function like this:

    TB-DNAM = (tb_concatenate (list 3 "-" 14 ":" "SHEET"))

    The key is that our function will accept a list of parameters to concatenate. So, it is "general purpose" !

    Here is the tb_concatenate utility and a brief summary of how it works.

    Above and toward the end, the function first reads in data from the active project's ".wdp" file. This will carry two lists of data that may be needed. First, there is the list of all project "description" lines, the LINE1 through LINEx values defined for the overall project. And second, there is a list of drawing-specific Section, Subsection, and drawing description lines. Each entry in this list is for a drawing in the project. Each entry is a "sublist" containing a list of the drawing's values.

    Now, below, the function begins to process the list of parameters passed in the call. The parameters are in "linelst" and processed one at a time, the "foreach" call. Each is checked to see if it is an integer number or a text string. If integer number, then it looks into the project description list pulled in above. If not integer, then it compares the passed text string parameter against a set of specific flags like "SHEET", "IEC_L", and "DD2".

    If no match as integer numer or on any of the specific text flags, it finally (near the bottom below) assumes that the parameter is just a text string to insert directly into the output.

    And that's it. When finished processing all of the passed parameters, the full concatenated string is returned by this AutoLISP expression. The AutoCAD Electrical Title Block update command pushes this concatenated value out to the target attribute on the title block ( ! ).

    Download utility here:

    files/21401_21500/21413/file_21413.lsp - download and rename tb_concatenate.lsp

    To use, you MUST first APPLOAD this utility before launching the title block update command. If you are running in multi-document mode (the AutoCAD default), then you'll need to use a method to make sure this utility loads with each drawing as it opens. Otherwise it will work on the first drawing and then fail from that point forward.

     

     

    0 Comment | Add Comment >

Comments



You must be logged in to post a comment.

Subscribe to Blog

Want to keep up with the latest? Subscribe to the RSS feed today.

RSS

Login

Register now to access tips, discussions and more.
Forgot your password ?

Tags

You must be logged in to add a tag.

Send to a Peer

You must login to share pages.

Feedback

Tell us what you think of the site.

Send Feedback