Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Need help with a custom cogo point LISP routine

arontYN6CF
Participant

Need help with a custom cogo point LISP routine

arontYN6CF
Participant
Participant

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

 

 

0 Likes
Reply
Accepted solutions (1)
515 Views
2 Replies
Replies (2)

Jeff_M
Consultant
Consultant
Accepted solution

Use this for the PointNumber

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

Jeff_M, also a frequent Swamper
EESignature

GTVic
Advisor
Advisor

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)

 

0 Likes