shamsam1 Posted May 14, 2008 Posted May 14, 2008 i want to extract all dimesions values from dwg to excel.do help me with vb or vba .i have vb.6 code to extract block attributes.i want code to extrat only dimensions:shifty: Quote
Cad64 Posted May 15, 2008 Posted May 15, 2008 I have moved your question to the "Autolisp, VBA Customization" section. Quote
filan1a Posted May 15, 2008 Posted May 15, 2008 Why do you need that?? if you want do sum all the dimesions, i have a lisp for that. tell me if you need that code. i want to extract all dimesions values from dwg to excel.do help me with vb or vba .i have vb.6 code to extract block attributes.i want code to extrat only dimensions:shifty: Quote
shamsam1 Posted May 15, 2008 Author Posted May 15, 2008 i have around 3000 dwg drawing.so we want to extract all dimensin value in excel so thatwill be help ful for us to dispay drawing (dwg )accornding to dimensions.i dton want to extact blcok attributes. wel my knowledge with lisp is nilll.do help me with vba code or vb .can lisp be converted to vb or vba . Quote
fuccaro Posted May 15, 2008 Posted May 15, 2008 Would help a program to export the data in CSV format? It can be opened in Excel. Try it: ; Save the Dimension's values to a CSV file ; [email="mfuccaro@hotmail.com"]mfuccaro@hotmail.com[/email] ; 2008 May (defun dimexp( / s tx fn i d dl m file) (setq s (ssget "X" (list '(0 . "DIMENSION"))) tx nil fn (strcat (getvar "dwgprefix") (substr (getvar "dwgname") 1 (- (strlen (getvar "dwgname")) 3) ) "\CSV")) (repeat (setq i (sslength s)) (setq d (ssname s (setq i (1- i))) dl (entget d) m (cdr (assoc 42 dl))) (if (not (member m tx)) (setq tx (cons m tx))) ) (setq s nil) (if tx (progn (setq file (open fn "w")) (foreach x tx (princ x file) (princ "," file) ) (close file) ) ) ) With small adjustments you can make the program to process at one go all the drawings contained in a directory. Does it help? Quote
shamsam1 Posted May 16, 2008 Author Posted May 16, 2008 Thanks For The Help .but My Knowldge Of Lisp Is Nillllllll. Please Guide Me How To Run A Lisp Program Quote
shamsam1 Posted May 16, 2008 Author Posted May 16, 2008 Wel Do Send Me Code.also Help Me How To Run A Lisp Program Quote
PS_Port Posted May 16, 2008 Posted May 16, 2008 Have a look here http://www.cadtutor.net/faq/questions/28/How+do+I+use+an+AutoLISP+routine%3F Quote
fuccaro Posted May 16, 2008 Posted May 16, 2008 And also here to see how to batch process files:http://www.cadtutor.net/forum/showthread.php?t=22637 Quote
shamsam1 Posted May 16, 2008 Author Posted May 16, 2008 i get the following eroor Unknown command "D:\DRAWINGS\SM\1-003666.ZIP". Press F1 for help. ; error: extra right paren on input Quote
fuccaro Posted May 16, 2008 Posted May 16, 2008 ZIP?! Ok, step by step: -Select the code and press CTRL+C -Open Notepad and press CTRL+V. The code should be there -From Notepad: Save AS.. filename should be DIMEXP.LSP See the lsp extension! -Open AutoCAD, open a drawing containing dimensions -Drag the DIMEXP.LSP file in the drawing area. AutoCAD should report something like "dimexp loaded" -Enter (dimexp) in the command line -Minimize AutoCAD and go to the directory where the drawing is. You should see a file .CSV -Open it in Excel Extra right paren on input -probable you left out the end of the code when copied it. In the code window you must scroll down to see it all! Quote
shamsam1 Posted May 16, 2008 Author Posted May 16, 2008 fuccaro ur genious thanks for the help.now i can run a lisp program:).i got my dimesions which i was looking for Quote
shamsam1 Posted May 16, 2008 Author Posted May 16, 2008 how to load n no of drawings at a time and export to single excel sheet.this is my final query of the day Quote
fuccaro Posted May 17, 2008 Posted May 17, 2008 Do you wish to have all the data in the same file? It is even a litle bit simpler: ; Save the Dimension's values to a CSV file ; [email="mfuccaro@hotmail.com"]mfuccaro@hotmail.com[/email] ; 2008 May ; Changed: all the dimensions are exported in the same file (defun dimexp( / s tx fn i d dl m file) (setq s (ssget "X" (list '(0 . "DIMENSION"))) tx nil fn "c:\\MyDims.csv") (repeat (setq i (sslength s)) (setq d (ssname s (setq i (1- i))) dl (entget d) m (cdr (assoc 42 dl))) (if (not (member m tx)) (setq tx (cons m tx))) ) (setq s nil) (if tx (progn (setq file (open fn "a")) (princ (strcat (getvar "dwgname") ",") file) (foreach x tx (princ x file) (princ "," file) ) (if file (close file)) ) ) ) (dimexp) I am at home now and I can't test it, but it should work. Now about processing more files at once: did you read the posts I pointed? Nevermind; here is the way again. -In AutoCAD go to Tools>Load applications. In the opened window navigate to the folder where you saved the lisp. Drag the file DIMEXP.LSP in the startup folder. Click OK to close the window. -Go to File>Open. You must see a window where you select the files to be opened by AutoCAD. Select all the files you wish to process. How? CTRL+A will select all of them, or CTRL and/or SHIFT +click them. -Click the OPEN (or OK?) button. -In Windows Explorer find the file C:\MyDims.csv and open it. -If you run the lisp again, it will place the new results at the end of this file. So move or rename it if you wish the new dimensions in separate file -IMPORTANT: remove the DIMEXP.LSP from the startup folder. Quote
shamsam1 Posted May 18, 2008 Author Posted May 18, 2008 thanks fuccaro wiill do the testing sooon. Quote
shamsam1 Posted May 19, 2008 Author Posted May 19, 2008 hi its working .but in excel all drawing details commming in 1 line. in excel for new drawing it should take new line... thanks for u help..u have solved my problem.. Quote
fuccaro Posted May 19, 2008 Posted May 19, 2008 ; Save the Dimension's values to a CSV file ; mfuccaro@hotmail.com ; 2008 May ; Changed: all the dimensions are exported in the same file ; on a new line (defun dimexp( / s tx fn i d dl m file) (setq s (ssget "X" (list '(0 . "DIMENSION"))) tx nil fn "c:\\MyDims.csv") (repeat (setq i (sslength s)) (setq d (ssname s (setq i (1- i))) dl (entget d) m (cdr (assoc 42 dl))) (if (not (member m tx)) (setq tx (cons m tx))) ) (setq s nil) (if tx (progn (setq file (open fn "a")) (write-line "" file) (princ (strcat (getvar "dwgname") ",") file) (foreach x tx (princ x file) (princ "," file) ) (if file (close file)) ) ) ) Quote
shamsam1 Posted May 19, 2008 Author Posted May 19, 2008 u made me to succeed in my project.... ALL Credit to u Quote
fuccaro Posted May 19, 2008 Posted May 19, 2008 Keep it so, Shamsam1! Together we make a great team! Just a late question: Does your AutoCAD LT run the lisp I wrote for you? :twisted: Ok, don't spend your time answering me; better use the time to update your profile. -just a sugestion... Quote
shamsam1 Posted May 20, 2008 Author Posted May 20, 2008 i am dotnet and vb programmmer...not a lisp programmer for lisp rogram i am using autocad 2000. regads sam Quote
Recommended Posts
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.