Jump to content

Global Attribute Editor & Extractor


Lee Mac

Recommended Posts

  • 5 months later...

hi Lee,

suggestion: MacAttV3-1.lsp

Selection by folders and subfolders is very good. But it will be much better if theres an option for selected files in a folder. Say i want only to change some of the attribute value in few drawings not all file in a folder.

regards,

Richard

Link to comment
Share on other sites

hi Lee,

suggestion: MacAttV3-1.lsp

Selection by folders and subfolders is very good. But it will be much better if theres an option for selected files in a folder. Say i want only to change some of the attribute value in few drawings not all file in a folder.

regards,

Richard

 

Hi Richard,

 

Visual LISP & DCL provides no standard functions to prompt the user for multiple file selection. One approach to provide such functionality is to interface with the Microsoft Common Dialog (ComDlg32), however this is not available on all systems since one must have a registered MS application to enable scripting access.

 

The solution would be to create a temporary folder and move those files to be processed to this folder, removing the folder after running the program.

 

Regards,

 

Lee

Link to comment
Share on other sites

  • 1 month later...

Lee

 

Superb lisp, just a quick question.

 

I want to use this on multiple drawings. After ive extracted all my attributes for multiple drawings into excel, is there anyway of updating the values in excel and re-importing them in AutoCAD? Allows for different values within each attribute tag for multiple drawings.

 

Hope that makes sense.

 

Cheers

Link to comment
Share on other sites

Hi,

 

I'm glad you like the program.

 

With the current program it is not possible to import values from Excel to update the previously extracted attributes.

 

Lee

Link to comment
Share on other sites

  • 4 months later...

Hi Lee,

I like Macatt, but can i suggest if you dont mind, would be much better if the macatt also takes the layout name and the filename into CSV so that we can use the extracted file to the other lisp you created Updatetitleblock.

 

regards,

kheajohn

Link to comment
Share on other sites

Hi kheajohn,

 

Many thanks for your suggestion - that is a nice idea to pair the two programs. I suppose the closest available format would be to use 'Drawing List Mode' - but unfortunately, this will still not extract Layout name.

 

To be honest, with the vast improvements that Autodesk has made to the DataExtraction command, I feel this program is becoming obsolete. In the meantime, perhaps DataExtraction will be able to extract the necessary information.

 

Lee

Link to comment
Share on other sites

  • 1 year later...

LeeMac,

 

I am not new to your LISP and/or skills (I reference your LISP page often), but you have outdone yourself with this one. I can't believe I didn't come across this one long ago. It is just perfect for my needs. Many thanks for making this available to the masses!

Link to comment
Share on other sites

You're very welcome nmulder, I'm glad you like the program!

With regard to the Attribute Editor option of this program, I have recently developed a far more extensive Batch Attribute Editor program which allows the user to modify multiple attributes within multiple blocks in a set of drawings, rather than being restricted to a single block.

Link to comment
Share on other sites

  • 1 month later...

Lee,

 

I tried your program with a directory, containing 162 dwgs with totalsize of 462 MB.

Choosen the "grp_block mode", searching for a certain block with 15 tags, it took only 2 minutes (!) to do the job.:D

 

Because all this dwgs offer a huge count of attributed blocks, it would have been a pain to do this with autodesk's data extraction dialog.

 

Unfortunately excel interpretes some data in the wrong way, e. g. "24.01" will recognized and displayed as a date, not as a number.

 

So I looked for a way to change the format data is passed to excel.

 

The easy way: place a " ' " at the start of the data, excel will recognize that a text follows, no matter what's behind that sign.

 

The only thing I had to change was line 2297:

 

(vlax-put-property xlCells 'Item row col [color=blue]val[/color])

change to:

(vlax-put-property xlCells 'Item row col [color=blue](strcat "'" val)[/color])

There may be better ways to do this, but for me it works perfect, because I only use the grp_block option.

 

Now excel recognizes all data as text.

 

All I have to do is save the file in .txt-format, close and open it again and tell excel which columns are intended as numbers.

 

Again, many thanks for this fantastic code.

 

regards

Wolfgang

Link to comment
Share on other sites

Many thanks Wolfgang!

 

The Excel sections of the program are relatively simplistic and could undoubtedly be vastly improved, but this program is now rather old and in desperate need of a complete overhaul to meet my current programming standards.

 

Nevertheless, I'm delighted that you find the program useful and I'm pleased with the reported program performance - 162 drawings in 2 minutes is fantastic!

 

Lee

Link to comment
Share on other sites

  • 3 years later...

Hello - Super old thread I know. But the info. provided as part of this thread is what I need. Is there a way to include the handle per block in the extraction process?

Link to comment
Share on other sites

  • 5 years later...
On 6/12/2009 at 1:03 AM, Lee Mac said:

This program will allow the user to extract all attributes from multiple blocks in multiple drawings, and will write all data to an Excel spreadsheet.

 

The user is prompted to create a list of block names from which attributes will be extracted.

 

The user is then prompted to select a directory of drawing files to process, and also provided with the option to process sub-directories of the selected directory.

 

Results will then be written to an Excel Spreadsheet, to be saved as the user wishes.

 

Among many other uses, this program may be used to create a Drawing List, by inputting the name of the titleblock, and the attributes that you want to extract from it, and setting the mode to 'Drawing List Mode' (within the 'Options' Dialog), so that the data is grouped in one list.

(See the Header for more info).

 

Your feedback, comments and suggestions are welcome :)

 

Lee

 

Preview:

 

Attribute Extractor:

 

http://www.theswamp.org/screens/leemac/MacAtt%20V2.6.png http://www.theswamp.org/screens/leemac/MacAttTagOrder.png

 

Options Dialog:

 

http://www.theswamp.org/screens/leemac/OptionsV2-8.png

 

 

Attribute Editor:

 

http://www.theswamp.org/screens/leemac/Prev.png

 

Function Syntax: MacAttEdit / MacAttExt / MacAtt

Code available here.

 

Hi Lee,

 

This is quite a powerful routine.

But when I used it on a Tag Name with a / symbol, it's saying "atttribute tag not valid" error.

 

Any fix would be highly appreciated.

 

image.png.b3e94949eea996dbff5fd6f06f647ccf.png


Thanks

Edited by nolex
Link to comment
Share on other sites

That tag name looks ganky. should it be TITLE3/4 ?   its not the / thats causing the error but the two " either side of it.

Link to comment
Share on other sites

3 hours ago, mhupp said:

That tag name looks ganky. should it be TITLE3/4 ?   its not the / thats causing the error but the two " either side of it.

oh yes you're right, it's TITLE3/4. Sorry

I tried to put some quote in there hoping it would work but didn't realise it was captured along.


did you have some fix for me though?

 

Link to comment
Share on other sites

4 hours ago, mhupp said:

That tag name looks ganky. should it be TITLE3/4 ?   its not the / thats causing the error but the two " either side of it.

actually the error is caused by the /.

The 2 quotes are me trying to figure out what works, just some trial and error I did but to no avail.

Link to comment
Share on other sites

On 4/28/2022 at 3:34 AM, nolex said:

This is quite a powerful routine.

But when I used it on a Tag Name with a / symbol, it's saying "atttribute tag not valid" error.

 

Any fix would be highly appreciated.

 

I'm pleased that you find this old application useful; though, you may find my more recently developed Batch Attribute Editor application a more powerful attribute editing utility, given that it offers the ability to edit attribute values across multiple blocks of varying block names.

 

You may argue that the use of a Script file to perform the attribute modification across multiple drawings is inherently less powerful than the ObjectDBX interface leveraged by this older program, however, ObjectDBX has too many bugs where attribute modification is concerned and so I have since abandoned it's use for this purpose.

 

Nevertheless, to allow the user to specify tags containing slashes (and other such characters), change the following lines:

 

Line 1265 from:

                       ( (or (not (snvalid str)) (vl-string-position 32 str))

To:

                       ( (vl-string-position 32 str)

 

Line 1457 from:

                       ( (or (not (snvalid str)) (vl-string-position 32 str))

To:

                       ( (vl-string-position 32 str)

 

Line 1579 from:

                       ( (or (not (snvalid new_tag)) (vl-string-position 32 new_tag))

To:

                       ( (vl-string-position 32 new_tag)

 

Line 2485 from:

                                (  (or (not (snvalid tag_str)) (vl-string-position 32 tag_str))

To:

                                (  (vl-string-position 32 tag_str)

 

  • Like 3
Link to comment
Share on other sites

  • 1 year later...

Hi, I had tried to use this routine a few times and it usually crashing my cad unless I select "current drawing" when I receive the following error: ** Error: Automation Error. Null object ID **

I took a look over the .cfg file and it seems to not have the BLK/ATT added into the dialog box but because this code is way about my grades you can take it as a total guess. 

Please fine below the .cfg:

 

"1"
nil
"C:\\Users\\xxx\\Desktop\\macatttest\\"
"0"
"grp_file"
"0"
"1"
nil
"C:\\Users\\xxx\\Desktop\\macatttest\\"
"0"
nil


Am I doing something wrong? I need a batch extractor which can give me a list of the tags values for certain blocks from multiple files so this routine would fit perfect on my needs.

Thank you for all the hard work to the developer and all the great people on this forum

Regards,
Mihail

Link to comment
Share on other sites

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