PDA

View Full Version : Spreadsheet



Gors100
1st Oct 2003, 08:22 pm
Could someone please give any info whether it is possible to take dimensions from a simple engiineering drawing and place them in an Excell workbook, currently runnig CAD2000
Thanx

fuccaro
2nd Oct 2003, 05:57 am
Hello Gordon!
Yes, I think it is possible to export the dimensions in an Excel compatible format. I am thinking at a lisp routine to help you.
But how to export them?
Do you need just some dimensions, or all of them? or all dimensions placed on a layer?
In what order: as you created them? sorted by value? as you select them?
If they are overrided dimensions, do you need the real dimensions, or the overrided text?
And how about the tolerances? Do you need them too?
A lot of questions, but necessaires to write a program. Maybe here is an other way to do it?

Gors100
2nd Oct 2003, 09:09 pm
Thanx Fuccaro for viewng and posting reply I can see the problems of getting correct information in order. Dimensions would be real, tolerances not a problem my only thought for accomplishing this task is if object properties could be utilised. Did come across an attribute manager in CAD2002 that looked as if it could carry out this function do you know if this is correct.
Thanx again

fuccaro
3rd Oct 2003, 02:09 pm
I have not understand how to select the dimension to export (sorry for my English), so I wrote a lisp to export all dimensions within a drawing. If it is not what you need, just return with an other message and I will try to help you.
After you run the routine find a file "C:\drawingname.CSV". Auf course "drawingname" will be replaced in each case with the real name of the drawing. Open this file in Excel and save it in Excel format.
Cheers!


;| Export all dimension from a drawing
in a CSV file (Excel compatible)
mfuccaro@hotmail.com October 2003|;

(defun c:dex ; Dimension EXport
( / name file ent)

(setq
name (strcat "C:/" ; place here the desired path for the new file
(if (= (strcase
(substr (getvar "dwgname")
(- (strlen (getvar "dwgname")) 3))) ".DWG")
(substr (getvar "dwgname") 1
(- (strlen (getvar "dwgname")) 4))
(getvar "dwgname"))
".CSV")
file (open name "w")
ent (entnext))
(while ent
(if (= (cdr (assoc 0 (entget ent))) "DIMENSION")
(write-line (rtos (cdr (assoc 42 (entget ent))) 2 4) file))
(setq ent (entnext ent)))
(close file)
(princ)
)
(princ "\nLoaded. Type DEX at the command prompt")
(princ)

fuccaro
2nd Jan 2011, 01:16 pm
The code above, fixed:
;| Export all dimension from a drawing
in a CSV file (Excel compatible)
mfuccaro@hotmail.com October 2003|;

(defun c:dex ; Dimension EXport
( / name file ent)

(setq
name (strcat "C:/" ; place here the desired path for the new file
(if (= (strcase
(substr (getvar "dwgname")
(- (strlen (getvar "dwgname")) 3))) ".DWG")
(substr (getvar "dwgname") 1
(- (strlen (getvar "dwgname")) 4))
(getvar "dwgname"))
".CSV")
file (open name "w")
ent (entnext))
(while ent
(if (= (cdr (assoc 0 (entget ent))) "DIMENSION")
(write-line (rtos (cdr (assoc 42 (entget ent))) 2 4) file))
(setq ent (entnext ent)))
(close file)
(princ)
)
(princ "\nLoaded. Type DEX at the command prompt")
(princ)