For context, I am working in Civ3D 2025.
I am trying to create a custom LISP that when I do a cogoexport command, I get the following information:
Point Name, Northing, Easting, Elevation, Description, Layer
The catch is, I want to use the originally created Point Number to be the Point Name in the string. I have been trying to modify the following LISP routine, but I don't really have a clue as to what I am doing. I copied this LISP from @hippe013 from a previous thread and tried to tweak it on my own, but no luck.
Any help/guidance would be greatly appreciated!
Thanks
Solved! Go to Solution.
For context, I am working in Civ3D 2025.
I am trying to create a custom LISP that when I do a cogoexport command, I get the following information:
Point Name, Northing, Easting, Elevation, Description, Layer
The catch is, I want to use the originally created Point Number to be the Point Name in the string. I have been trying to modify the following LISP routine, but I don't really have a clue as to what I am doing. I copied this LISP from @hippe013 from a previous thread and tried to tweak it on my own, but no luck.
Any help/guidance would be greatly appreciated!
Thanks
Solved! Go to Solution.
Solved by Jeff_M. Go to Solution.
Use this for the PointNumber
(setq ptName (itoa (vlax-get-property cogo 'Number)))
Use this for the PointNumber
(setq ptName (itoa (vlax-get-property cogo 'Number)))
The routine could use some more error checking in case no points were selected or the file could not be created.
(defun c:cogoExport ( / ss fileName n f )
(if (setq ss (ssget '(( 0 . "AECC_COGO_POINT"))))
(setq fileName (getfiled "Export Cogo Point Data" "" "csv" 1)))
(if (and ss fileName)
(if (setq n -1 f (open fileName "w"))
(progn
(repeat (sslength ss)
(write-line (cogoExport:pntToString (vlax-ename->vla-object (ssname ss (setq n (1+ n))))) f))
(close f)
(princ (strcat "\n" (itoa (1+ n)) " cogo point(s) exported to " fileName)))
(princ (strcat "\nError creating file " fileName)))
(princ (if ss "\nCommand canceled" "\nNo cogo points selected")))
(princ))
(defun cogoExport:pntToString ( cogo )
(strcat (itoa (vlax-get-property cogo 'Number))
"," (rtos (vlax-get-property cogo 'Northing) 2 3)
"," (rtos (vlax-get-property cogo 'Easting) 2 3)
"," (rtos (vlax-get-property cogo 'Elevation) 2 3)
"," (vlax-get-property cogo 'RawDescription)
"," (vlax-get-property cogo 'Layer)))
(princ)
The routine could use some more error checking in case no points were selected or the file could not be created.
(defun c:cogoExport ( / ss fileName n f )
(if (setq ss (ssget '(( 0 . "AECC_COGO_POINT"))))
(setq fileName (getfiled "Export Cogo Point Data" "" "csv" 1)))
(if (and ss fileName)
(if (setq n -1 f (open fileName "w"))
(progn
(repeat (sslength ss)
(write-line (cogoExport:pntToString (vlax-ename->vla-object (ssname ss (setq n (1+ n))))) f))
(close f)
(princ (strcat "\n" (itoa (1+ n)) " cogo point(s) exported to " fileName)))
(princ (strcat "\nError creating file " fileName)))
(princ (if ss "\nCommand canceled" "\nNo cogo points selected")))
(princ))
(defun cogoExport:pntToString ( cogo )
(strcat (itoa (vlax-get-property cogo 'Number))
"," (rtos (vlax-get-property cogo 'Northing) 2 3)
"," (rtos (vlax-get-property cogo 'Easting) 2 3)
"," (rtos (vlax-get-property cogo 'Elevation) 2 3)
"," (vlax-get-property cogo 'RawDescription)
"," (vlax-get-property cogo 'Layer)))
(princ)
Can't find what you're looking for? Ask the community or share your knowledge.