AutoCAD Visual LISP / AutoLISP :: Extracting Attribute Values From Multiple Dwg Files To An Excel File
May 11, 2013
how to extract the attribute value of a particular block in multiple drawings to an excel file.
Eg... there are nearly 800 drawings where I need to list down the description and Drawing number which is mentioned in the title block name "Title". The Drawing Number and the description is done in same attribute block. extract the data into an excel file or txt file. All the drawings are saved in one location.
View 7 Replies
ADVERTISEMENT
May 27, 2013
How can specific attribute values be extracted from a drawing and assigned to a variable in lisp.
The existing title block is having attributes : Area, Sub area, Description, Drawing type. I want to extract this values and assign it to some variable which I have already listed and then it shall be assigned to some other attributes in the same drawing with Area1, Subarea1, Description1, Drawing type1... and so on.. Both the attributes shall be in the same drawing file.
View 3 Replies
View Related
Mar 21, 2013
This time I'm wrestling with getting the values from multiple blocks. The blocks all have the same name but at least the attributes have names this time. Each block have exactly 4 attributes, like: att1 (a number representing chronological order), att2 (some data), att3 (the actual date as a string of when the data was added), att4 (some more data)
I need to get and store the attribute's values. I was hoping to make a selectionset of the blocks and step through using the chronological order number.
At this point I have tried several combinations of foreach and ssget "x" (list (cons 2 MYBLOCK)), but I keep getting errors that I'm sure are telling me that I'm not passing the correct information to the function for iterating through. I'm banging my head.
(DEFUN c:GFOR (/ ATTLST REVBLK CNT CNT1 BLK RBLK ATTVAL ATT REV#)
(SETQATTLST(LIST "R#" "INIT" "DATE" "DESC")REVBLK(ssget "x" (list (cons 0 "INSERT") (cons 2 "REVISION")))CNT0CNT10 )
(vlax-ldata-put "dict" "RevTotal" (BLKCNT "REVISIONS")) (FOREACH BLK REVBLK (SETQ RBLK (ssname BLK CNT1)) (setq ATTVAL (mapcar '(lambda (x) (vla-get-TextString x)) (vlax-invoke (vlax-ename->vla-object RBLK) 'GetAttributes))) (foreach ATT ATTLST (SETQ REV# (STRCAT "REVISION" (1+ CNT)))
(vlax-ldata-put "dict" REV# (member ATTVAL)) (setq CNT (1+ CNT)) ) (SETQ CNT1 (1+ CNT1)) ) (PRINC))
View 9 Replies
View Related
Jun 12, 2013
We have a custom LISP program (Written, upadated in 2003) that takes a keyed in item number, opens and searches a .txt file with four coulmns, for the keyed in item number (column 1) and returns a part number (column 2), description (column 3) and any information in column 4.
Here is the Part of the cod in question:
(setq recx (open "H:/ACAD2012/alcocustm/LISP/hardware.txt" "r"))
(setq d "?")
(setq rec (read-line recx))
[Code]....
A quetsion was asked if the data in the .txt file could be put in an Excel file. I tried looking at other post, but I can't seem to find a clear cut way to open and extract the data. Or this old dog overlooked a boand. Is there a easy way to do this, similar to the above?
View 8 Replies
View Related
Feb 25, 2013
I have several title blocks each in their own paperspace pages. Could have the attribute filled in, but more than likely only one page will have values filled in the attributes. I am looking for a VL method for finding which pages title block is filled in so that I can get those values and fill in the equivalent attributes for all of the other pages. Currently I am using a long set of :
(IF (setvar "ctab" "8.5x11") (IF(TBLSEARCH "BLOCK" "TB-8.5x11") (IF (/= "" (get-att "OWNER" "TB-8.5x11")) ; Function to read a named attribute(editblk "TB-8.5x11") ; Function to pull up the attdia(IF (setvar "ctab" "11x17") (IF (TBLSEARCH "BLOCK" "TB-11x17") (IF(/= "" (get-att "CUSTNMFIRST" "TB-11x17")) (progn ; At the last page ditch the [Code]..........
The example is just a very simplified version of what I'm doing. I just need to find the information, if it exists in any page and store it for later. Afterward, I'll fill in each page's Title Block with the stored information.
I know that this can be done much more efficiently. As I am currently flipping through the pages too much action is occurring on the screen and it makes some people nervous. With VL I should be able to run the search quietly, but I would still like to (setvar "ctab" "to the page with the filled attribute value") after the LISP is finished storing values.
View 7 Replies
View Related
Mar 6, 2013
I got a new work and get it done in the next 2 days, but first I need to do this... from a text file (or excel file, I got both) I got 3 columns, 1 one for node number, and 2 other for X and Y coordinates for each node.
So from that file I need to insert into autocad the node numbers as text (using the current style and height) at the point specified by the other two columns, that are the X,Y coordinates which will be the insertion point of text..
View 5 Replies
View Related
Jul 18, 2013
I have an attribute blocks and this att block has two tag values , is there a simple code for to change 1st tag values automaticly according to 2nd values ?
for example :
1st tag (50x50) - 2nd tag ( 100 ) ==> 50x50-100
if i enter 201 valuse to 2nd tag then 1 st tag has to change as 100x100
if i enter 501 valuse to 2nd tag then 1 st tag has to change as 150x510
I attached a jpg file for explain much better
View 9 Replies
View Related
Feb 12, 2012
I need to match few attribute values from one block to different block. I download a lisp file called; ca.lsp which can match the single attribute value. I modified it for more than one attribute value matching. It is ok but still wish to overcome two issues for batch prcess
1. picking up the blocks by selection
2. click the alternative block numbers of times to match the numbers of attribute values I needed.
How to modify this lisp I can run it by block name selections instead of picking selection which enable me to run batch process for numbers of drawing? That will be good...
Lisp & Demo file attached (Match attribute value, A, B & C to Attribute 1, 2 & 3).
View 3 Replies
View Related
Jul 5, 2012
i am wondering if it is possible to alter a specific attribute in cca 250 files? I have this template which has like 50-70 attributes,but not all of them are used. I have to change only one attribute in all of the files. For instance, i have an attribute with a specisfic tag, but the content of it is ie MARK, i want to change MARK to PETER, without having to open,click,retype,save,close every file. Is it possible to automatize it somehow? maybe lisp, batch or even VB?
View 2 Replies
View Related
Jul 3, 2012
I wanna transfer my attribute block values to another attribute text blocks , is there any lisp for that?
Is there a possibility for sum tag values of choice attribute blocks to inside of another attribute text block ?
View 2 Replies
View Related
Jul 29, 2005
Say I have a block that contains two attributes, one contains a value that is a number and another contains a value that is letters. I have many of these blocks placed in a drawing, could you create a lisp that would return the sum of the number value and return it to the command line along with the letter value. Something like this:
Sum--------Item
128 RP
389 TD1
2389 SP4
View 9 Replies
View Related
Jul 17, 2013
Lisp or lisp code for sum attribute tag values and paste result to an another attribute block tag?
i attached jpg for explain to what i want to do .
View 4 Replies
View Related
Oct 26, 2012
Any routine where I could keep picking on my exit arrow blocks (showing how many persons exiting from each space) one-by-one and the program would add up the numbers. For example I pick on blocks with numbers of 2, 4 & 3 and I would get 9.
View 3 Replies
View Related
Aug 24, 2011
Here's my situation:
I have a block named "WIDGET-A". And in that block are (4) attribute tags whose names are:
"ID"
"TAG01"
"TAG02"
"TAG03"
The user will be prompted to pick the value displayed at any of the "TAG##" attributes - they will select the attribute tag they want (we don't know which one it is, we just want to assign that value of the attribute tag they clicked on to a variable called "VAR2".
Now, what we also want AutoCAD to evaluate, behind the scenes, is the value of the attribute tag named "ID" which we know always exists in the block and then assign that value to a variable called "VAR1".
Is there a way for AutoCAD to do this all from only a single user pick on top of an attribute value, in a block whose name isn't always going to be 'WIDGET-A' either.... But the block, whatever it's name, will always have the attribute tag "ID" with a value in it, and we always want to capture the value of whatever attribute tag within the block that the user clicked on.
View 2 Replies
View Related
Jun 17, 2013
I need a lisp sub-function that can empty all attributes of a specified dynamic block. The idea being that the specified block contains data that changes often and in order to repopulate the block's attributes with new data to replace the old I wish to just blank out the old data first, because it's possible that the new data may not utilize as many attributes and all of the old data must be removed.
The thing is the block I'm after is on several layouts, CTABs and they all need to be wiped clean.
View 9 Replies
View Related
Jan 18, 2012
How to connect to MySQL database and insert data from a set of blocks containing attributes?
Something like:
block 1:
- x coordinate;
- y coordinate;
- handle;
block 2:
- x coordinate;
- y coordinate;
- handle;
block 3:
- x coordinate;
- y coordinate;
- handle;
I've just got the second part (retrieving info from the blocks), but when it comes to connect to the DB I'm completely lost.
For the DB I'm using XAMP for Windows, thus using localhost, user ('user123'), pass ('pass123') and table ('table123'). The table has ID (PriKey and AutoInc), px, py and hdl fields.
View 9 Replies
View Related
Apr 24, 2012
There is a BLOCKA that I'd like to extract its attributes - Tag and Color - into an external format (excel). There after, I'd like to import it into the drawing and based on its color attribute value, change the value to that color in the drawing.
View 7 Replies
View Related
Jul 19, 2013
I can run the ACC fine on multiple DWG files with a basic set of commands in the script file. But, when I try to load an AutoLISP/Visual LISP file and run it from inside the script file, it doesn't work. How to run a LISP file using the ACC?
View 1 Replies
View Related
Nov 11, 2011
Lisp program, by selecting on screen multiple block attribute and to change those selected (by picking) attributes to colour 252.
At the moment, I'm using a custom macro : ^C^C-ATTEDIT C;252;;
But if I've got a lot of attributes to change, it takes awhile to complete.
I know about BATTMAN but I do not want to change the block entities in that way. The reason I want to change the attributes to colour 252 is because here at this company we do existing drawing in colour 252 and any new equipment on its proper layer colours.
View 1 Replies
View Related
Sep 16, 2012
I need to be able to batch process a bunch of title block attributes automatically.
Block Name: Title Block
Tag Name: SH
Currently they come out with just the number 1, 2 , 3 etc I need to add a leading zero ie 01, 02, 03 etc
All the scripts I have will just replace the number with another
I just want to append the zero infront of the existing number
ie the code will need to read the existing number and decide if its less than 10. if it is less than 10, then the code just needs to append the leading 0. if its 10 or over, then do nothing.
View 4 Replies
View Related
Feb 6, 2012
We have a few hundred drawings that we need to change certain block attributes. We need to change the valve of the text in that attribute from whatever it is (doesn't matter what it is) to a specific text string.
For example: If the attribute is called "name" and has the text string of ALAN in it in some drawing or BRUCE in other drawings, we want to chaneg all drawings to TOM.
View 4 Replies
View Related
Apr 12, 2012
Is there a way to change a specific attribute in a block found over x-amount of papers pace tabs?
At current I can only change one tab at a time.
View 7 Replies
View Related
Dec 4, 2012
I am trying to export each sheet in an Excel file to an separateTXT files.
I currently have code to read each cell in a sheet, but unfortunately some of the Excel sheets have in excess of 5000 cells and it is taking too long to read. So I am switching to another method.
The program will check dates of TXT files and XLS file to make sure TXT files are current (if not, open and recreate TXT files).Then read the TXT files (much faster).
Where I am getting stuck is 2 places -
Get the names of each sheet in the excel file (not always a known name)
Save each sheet as separate TXT file.
Here is condensed code so far without error checking, etc -
(defun E2TXT (FileName /)
(if (and (setq XLfile (findfile FileName)) (vl-file-systime XLfile) (setq XLapp (vlax-get-or-create-object "Excel.Application")))
(progn
[Code]....
View 4 Replies
View Related
Jan 23, 2012
I would like to :
-select an attribute block in my layout viewports
- select a directory where the PDF will be saved
- select the printer
and zoo.
All my layouts will be printed. The files will be created. The filename will be the attribute name (different in each layout viexports).
[ACAD2011 CIVIL3d]
View 9 Replies
View Related
Oct 7, 2011
I would like to be able to retreive data from a sepcified cell, in a specified worksheet, from an excel file.
I don't have any clue how to connect to an excel file and read the data. Most seems to think you already had an understanding but I'm starting from the beginning.
View 5 Replies
View Related
Dec 8, 2011
Background: Someone exploded an attribute block and copied it hundreds of times throughout a project, each time changing the Attribute Tag to match the Value they expected to appear in their drawing. The drawing must be xrefed, so the attribute definitions do not appear.
(There is only 1 attribute in the block.)
Proposed Solutions:
1:AutoLISP routine which copies Tag data from Attribute Definition into Value of Attribute Block:
Prompt-Select Attribute Definition
Copy Tag data
Prompt-Select Attribute Block
Paste data into Value
(Allow repeat to speed workflow)(*PREFERRED*)
2:AutoLISP routine which copies Tag data from Attribute Definition into Default Value and creates a new Block:
Prompt-Select Attribute Definition
Copy Tag data
Paste data into Default Value
Create New Block
(Select Multiple Objects)(Creates tons of new blocks which are messy)
View 3 Replies
View Related
Feb 7, 2012
I have a lisp routine that gathers all xrefs from the current drawing and creates a script that opens each xref, runs specific commands then saves/closes each drawing. Once all commands have been ran in each xref I would like the script to reload all xrefs in the original drawing that the script was called from. I have a reload-all lisp that is already loaded in all of my drawings but for some reason when this command is called at the end of the script it will not run.
Is there a way to have the script continue to run in the original drawing that it was called from? Or maybe even pass control back to the lisp that created/called the script? Its seems to me that the easiest thing would be to have the script continue to run after it has gone through all of the specified drawings but this is not working.
View 9 Replies
View Related
Sep 13, 2012
Is it possible to loop through multiple files in a directory?
Like this: (setq file (open "..\TOPO QUADS\*.jgw" "r"))
Windows 7 x 64 Professional
Nvidia Quadro 4000
8 GB Ram
i5 2500 @ 3.30 GHz
Civil 3D 2012 SP 2
Civil 3D 2013 SP 1
View 9 Replies
View Related
Dec 22, 2011
I am trying to make a script file to open a drawing and run a lisp routine. They both work independently just fine, the script file will open the all of the files fine... and the lisp is in the startup suite and works in all the files. But when I tell the script file to open the first drawing then run the lisp it hangs trying to open the next file after running the lisp. I have Filedia set to 0, but the message I get when it goes to open the next is "No canvas exists. click New Canvas." (And on top of that... Filedia even set back to 1 still does not display the Dialog box anymore, I have to shut down AutoCAD 2012 and start again then it works.) I Have tried several ways, Opening one at a time then run lisp, and open all files first and then try to run lisp (that closes the file after running) and try and run it again in the next... It will only run the lisp one time and then locks up from there.
View 7 Replies
View Related
Aug 9, 2013
Is there a way to have a Lisp Routine open multiple script files?
I have 10 types of scripts, that are specific to the type of file they open (as shown below). which simply open a file, purge/audit, save and close.
open "Q:PROJECTS321700Field ManagementCoordinationElectricalSleeving613321700_ES-613-Lev01.dwg"audit y-purge all * n-purge R * naudit yqsavecloseopen "Q:PROJECTS321700Field ManagementCoordinationElectricalSleeving613321700_ES-613-Lev02.dwg"audit y-purge all * n-purge R * naudit yqsaveclose The file above was named ES-613.
I would like to create a Lisp Routine that opens this script, *Some how closes the file*, and then opens another script.
For example:(defun c:Audit-Purge ()(command ".SCRIPT" "O:/Users/Kurt N/Script/Novartis/NovartisPURGE/ES-615.scr")(PROMPT "ES-615 Done.")(princ)(command ".SCRIPT" "O:/Users/Kurt N/Script/Novartis/NovartisPURGE/ES-613.scr")(PROMPT "ES-613 Done.")(princ)ECT>>....)
View 4 Replies
View Related
Apr 20, 2013
I just want to extract the coordinates and number of survey locations that are represented by point blocks from a drawing.
My template is on the desktop and is named
TAYLOR EXTRACT.txt
BL:NAME C008000
BL:COMMENT C008000
BL:NORTHING N0010003
BL:EASTING N0010003
I get the attribute extraction menu
select some points, verify that points have been selected
specify the above template
Specify the export file name
select ok
returns 0 records
View 9 Replies
View Related