Jump to content

Help with CSV Cogo export LISP script


Recommended Posts

Posted

I am trying to edit a script that I have to also write the COGO custom property from below:

image.thumb.png.fc009c71e121234367ba6c2e4ce90d9e.png

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)
  )

 

Posted

Are you using civil 3d 

 cogo not have  Bearing property 

Maybe another property like

user-defined property value for the point.

 

 

Posted

This is posted elsewhere and yes I hinted CIV3D is very interwoven with object getting info from multiple sources, so in this case need to look at Point File being used for that Cogo point.

 

Need to see a DUMPIT of a point to comment further.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...