1

I'm using ZWcad and i need to get the coordinates of hundreds of blocks into a excel sheet or .CSV file so i can import that into the GPS hardware. I know there are plenty of tools for autocad, i probably can even write one myself but as far as ZWcad goes i seem to be out of options.

However ZWcad saves to DWG too, and exports to all the other familiar cad extensions. So i was wondering if i would just save the blocks i need to export to a certain file there might be a tool/program to convert that directly into .CSV.

1 Answer 1

1

Below is a simple AutoLISP program demonstrating how to extract the WCS insertion point coordinates for a selection of block references to a comma-delimited CSV file.

(defun c:blk2csv ( / e f i p s )
    (if (and (setq s (ssget '((0 . "INSERT"))))
             (setq f (getfiled "" "" "csv" 1))
             (setq f (open f "w"))
        )
        (progn
            (repeat (setq i (sslength s))
                (setq i (1- i)
                      e (ssname s i)
                      p (trans (cdr (assoc 10 (entget e))) e 0)
                )
                (write-line (apply 'strcat (mapcar 'strcat (mapcar 'rtos p) '("," "," ""))) f)
            )
            (close f)
        )
    )
    (princ)
)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.