Jump to content

Lee-Mac Code for Updating Title Block Attributes


Recommended Posts

Posted

I have a title block block which has 13 attributes that I need to update using LISP. Here is the attribute layout:

image.png.cfa84ffc3d41855647eaf034a08601fb.png

 

I'm attempting to use Lee Mac's code UpdateTitleblockV1-9.lsp for this task. I edited and saved the Sample.csv file and made only a couple of changes to the main code. When I run it, the command window shows "All attributes are up to date." yet nothing gets changed in the block on Layout1 or Layout2.

 

The Sample.csv file looks like this:

Quote

Drawing1,Layout1,TitleBlock24x36,SOME ARCHITECT INC,SOME CONSTRUCTION CO,999-9999,PJ8765,CDF100,09/28/2021,1/8"=1'-0",Me1,JT,Me2

 

I have also attached a copy of the CAD file which contains the title block block I'm working with.

Drawing1.dwg

Posted (edited)

UPDATE: I got it working correctly. Turns out I wasn't formatting the csv file correctly. Still a little unclear on how it works, but I'll figure that out later.

 

I once had a similar LISP program which would automatically iterate through all the layouts and make these changes. It even kept a counter to number the sheets sequentially in a given format. That code got left behind several years ago so I'll have to rely on memory. And with all the pandemic stuff going on memory is something  I'm running short on. LOL!

Edited by Bill Tillman
Posted

One of the methods I use is taking advantage of just fill the attributes based on creation order, then its a global routine any block, you just have to make sure that you have a csv with every attribute even blank ones Bill,,Tilman is 3 attributes with say middle name blank, so no need for tag names, but csv must match creation order. ie your image. Happy to help more

 

Something like this obj is title block in a layout, lst is the line from a csv ("layoutname" "BILL" "" "Tillman") 
can do a check count of atts against the csv so dont get funny answers.
Note the + x 1 as this skips the layout name in the list

(setq x 0)
(foreach att (vlax-invoke (vlax-ename->vla-object obj 'getattributes)
(vla-put-textstring att (nth (+ x 1) lst))
(setq x (1+ x))
)

 

ps do you want read from excel ?

  • 2 years later...
Posted

Hi! Very late to the party lol but when you said you weren't "formatting the CSV file correctly", what did you do to fix it?

  • 2 months later...
Posted

I have the same issue. Would be really useful to know the correct formatting of the CSV file. If anyone has any ideas, it'd be much appreciated as I can't now get it read the CSV file after saving it within Excel, when it originally worked when first opened.  

Posted (edited)

I do custom read Excel but looking into all the help provided by Lee as per link by SLW210, this stood out for me.

 

"all attributed blocks containing attribute tags equal to the column headings in the CSV file will be updated"

 

This matches what I inferred early on about csv it may need to match say the number of block attributes.

 

Post your csv so we can look at it and a matching sample dwg.

Edited by BIGAL

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...