hi all,
i have got a survey file which shows contour lines and elevation points. has there any possible way to convert these cordinates and levels in to Excel sheet? if yes please let me know.
regards,
refiq
|
hi all,
i have got a survey file which shows contour lines and elevation points. has there any possible way to convert these cordinates and levels in to Excel sheet? if yes please let me know.
regards,
refiq
when having an object, for example a block, you can use the ID command in the insert point to get it coordinates...
hmmm, selecting all
we are talking about a plain autocad right? because this sounds like LTD functionality
i think the main problem is in selecting or defining the point your need excel file from
Buffeldrek'
can you make it more clear.(your previous reply)
my other question related to this matter:
i have a file full of survey points. the drawing contains points and texts reflects the coordinates and elevation points. i think this cad file is a converted copy from some survey softwares. because of some wrong command (my assumption) all the points are with negative values. E.g. if original point has a value of +2.5, we have this point in cad file with negative (-2.5). how can i overcome this negative to the right positive value other than moving one by one to it's +ve elevation. i am using AutoCAD 2006. I’d appreciate it if you can reply sooooooon..
thanks & regards,
refiq. "_"
)(
Put the following into a lsp file called pointco and place it in your AutcAD support folder on your c drive.
Then in AutoCAD type (load"pointco") to load the routine. Type "pointco" to start the routine and follow the prompts on screen.
Import the txt file that is created into excel and set the parameters accordingly so that each x,y,z value has its own column
Disclaimer! : This is copied from a large lsp I have running and I am not sure if it relies on any other custom routines I have.
I hope this helps.
Code:;; Routine to export point coords to TXT file (defun c:pointco () (setvar "cmdecho" 0) (command "undo" "begin") (setq f nil) (setq pointco_index 0) (princ "\n Select the points\n" ) (setq pointco_ss (ssget)) (setq pointco_ss (ssget "P" (list (cons 0 "POINT")) )) (if (/= pointco_ss nil) (progn (setq DRAWING_NAME_pointco (getvar "dwgname")) (setq OLD_DWG_NAME_LENGTH_pointco (strlen DRAWING_NAME_pointco)) (setq NEW_DWG_NAME_pointco (substr DRAWING_NAME_pointco 1 (- OLD_DWG_NAME_LENGTH_pointco 4))) (setq FNAME_pointco (strcat (getvar "dwgprefix") NEW_DWG_NAME_pointco ".txt")) (setq FILE_pointco (open FNAME_pointco "w")) (setq pointco_sl (sslength pointco_ss)) (while (< pointco_index pointco_sl) (setq pointco_object (entget (ssname pointco_ss pointco_index))) (setq pointco_type (cdr (assoc 0 pointco_object))) (if (= pointco_type "POINT") (progn (setq pointco_coords (cdr (assoc 10 pointco_object))) (setq pointco_x (rtos (car pointco_coords) 2 5)) (setq pointco_y (rtos (cadr pointco_coords) 2 5)) (setq pointco_z (caddr pointco_coords)) (if (/= pointco_z nil) (setq pointco_z (rtos pointco_z 2 5)) ) (if (= pointco_z nil) (setq pointco_z "0.00000") ) (write-line (strcat pointco_x "," pointco_y "," pointco_z) file_pointco) ) ;progn ) ;if (setq pointco_index (+ 1 pointco_index)) ) ;wend (close file_pointco) ) ;progn ) ;end (command "undo" "end") (setvar "cmdecho" 1) (princ) )
How about mirroring the contours about the xy plane?Originally Posted by rputhenv
An elevation of -2.5 becomes +2.5 ; -10 becomes +10 ; etc..
Could anyone change below lsp for me to export text coordinate to excel . I have used below code but coordinate point what program calculate is not text center and text base point which is left corner . So export coordinate are not right .
;; Main part ;;
(defun C:tex (/ acsp adoc aexc awb axss cll
colm com_data csht data header_list
nwb osm pt row sht ss
tmp tmp_data
)
(or (vl-load-com))
(or adoc
(setq adoc (vla-get-activedocument
(vlax-get-acad-object)
)
)
)
(or acsp
(setq acsp (if (= (getvar "TILEMODE") 0)
(vla-get-paperspace
adoc
)
(vla-get-modelspace
adoc
)
)
)
)
(setq ss (ssget '((0 . "*TEXT"))))
(setq axss (vla-get-activeselectionset adoc))
(setq com_data nil) ;for debug only
(vlax-for a axss
(setq pt (vlax-get a 'Insertionpoint))
(setq tmp (list (substr (vla-get-objectname a) 5)
(vla-get-textstring a)
(rtos (car pt) 2 3)
(rtos (cadr pt) 2 3)
(rtos (caddr pt) 2 3)
)
)
(setq com_data (cons tmp com_data))
(setq tmp_data nil) ;for debug only
)
;; *** Excel part *** ;;
(alert "Save Excel manually")
(setq aexc (vlax-get-or-create-object "Excel.Application")
awb (vlax-get-property aexc "Workbooks")
nwb (vlax-invoke-method awb "Add")
sht (vlax-get-property nwb "Sheets")
csht (vlax-get-property sht "Item" 1)
cll (vlax-get-property csht "Cells")
)
(vlax-put-property csht 'Name "Specification")
(vla-put-visible aexc :vlax-true)
(setq row 1
colm 1
)
(setq header_list
(list "Object Name" "Content"
"X coordinate" "Y coordinate"
"Z coordinate"
)
)
(repeat (length header_list)
(vlax-put-property
cll
"Item"
row
colm
(vl-princ-to-string (car header_list))
)
(setq colm (1+ colm)
header_list
(cdr header_list)
)
)
(setq row 2
colm 1
)
(repeat (length com_data)
(setq data (car com_data))
(repeat (length data)
(vlax-put-property
cll
"Item"
row
colm
(vl-princ-to-string (car data))
)
(setq colm (1+ colm))
(setq data (cdr data))
)
(setq row (1+ row)
colm 1
)
(setq com_data (cdr com_data))
)
(vlax-invoke-method
(vlax-get-property csht "Columns")
"AutoFit"
)
(vlax-release-object cll)
(vlax-release-object csht)
(vlax-release-object sht)
(vlax-release-object nwb)
(vlax-release-object awb)
(vlax-release-object aexc)
(setq aexc nil)
(vla-clear axss)
(vlax-release-object axss)
(vla-regen adoc acactiveviewport)
(gc)
(gc)
(princ)
)
(princ " *** Type TEX to execute ***")
(princ)
;TesT:
;(C:tex)