Community
Civil 3D Customization
Welcome to Autodesk’s AutoCAD Civil 3D Forums. Share your knowledge, ask questions, and explore popular AutoCAD Civil 3D Customization topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Need help with a custom cogo point LISP routine

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
arontYN6CF
258 Views, 2 Replies

Need help with a custom cogo point LISP routine

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

 

 

2 REPLIES 2
Message 2 of 3
Jeff_M
in reply to: arontYN6CF

Use this for the PointNumber

 (setq ptName (itoa (vlax-get-property cogo 'Number)))

Jeff_M, also a frequent Swamper
EESignature
Message 3 of 3
GTVic
in reply to: arontYN6CF

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.

Post to forums  

Rail Community


 

Autodesk Design & Make Report