Message 1 of 9
Help with CSV Cogo export script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am trying to edit a script that I have to also write the COGO custom property from below:
Here is my code. everything works except for the (setq bearing (vlax-get-property cogo 'Bearing)) line. Is there a way to export these custom properties in LISP?
(defun c:cogoExport ( / ss fileName f n)
(setq ss (ssget '(( 0 . "AECC_COGO_POINT"))))
(setq fileName (getfiled "Export to" "" "csv" 1))
(if (and ss fileName)
(progn
(setq f (open fileName "w"))
(setq n 0)
(setq line "CAD Index, x, y, z, ," )
(write-line line f)
(repeat (sslength ss)
(setq cogo (vlax-ename->vla-object (ssname ss n)))
(setq line (cogo:pntToString cogo))
(write-line line f)
(setq n (+ n 1))
)
(close f)
(princ (strcat "\nPoints have been exported. Quantity: " (itoa n)))
)
(princ "\nCommand Canceled.")
)
(princ)
)
(defun cogo:pntToString (cogo / num northing easting elev rawDesc layer)
(setq num (vlax-get-property cogo 'Number))
(setq easting (rtos (vlax-get-property cogo 'Easting) 2 3))
(setq northing (rtos (vlax-get-property cogo 'Northing) 2 3))
(setq elev (rtos (vlax-get-property cogo 'Elevation) 2 3))
(setq rawDesc (vlax-get-property cogo 'RawDescription))
(setq layer (vlax-get-property cogo 'Layer))
(setq bearing (vlax-get-property cogo 'Bearing))
(strcat (itoa num) "," easting "," northing "," elev "," rawDesc "," layer "," bearing)
)