Help with CSV Cogo export script

Help with CSV Cogo export script

carl3ZPF6
Enthusiast Enthusiast
600 Views
8 Replies
Message 1 of 9

Help with CSV Cogo export script

carl3ZPF6
Enthusiast
Enthusiast

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

carl3ZPF6_0-1706825706882.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)
  )
0 Likes
601 Views
8 Replies
Replies (8)
Message 2 of 9

Sea-Haven
Mentor
Mentor

If I remember correctly, a COGO point has a "Rotation". (vlax-put-property obj 'Rotation ang )

 

Use dumpit for this situation and get correct property name.

 

0 Likes
Message 3 of 9

carl3ZPF6
Enthusiast
Enthusiast
Do you mean store information in the rotation property? Not sure I can do
this since what I want to export is a string. Also I will have multiple
properties not just 1 to do this with.
0 Likes
Message 4 of 9

Sea-Haven
Mentor
Mentor

 I think I misunderstood, CIV3D has a tangled web of information, you are maybe looking at for that point the "point file" properties, which is like a separate linked property. What does dumpit show.

0 Likes
Message 5 of 9

carl3ZPF6
Enthusiast
Enthusiast

 

Command: DUMPIT
 pick object ; IAeccPoint: IAeccPoint Interface
; Property values:
;   Application (RO) = #<VLA-OBJECT IAeccApplication 000001982a979bb0>
;   Convergence (RO) = Civil 3D API: This operation is not supported because the geodetic coordinate system has not been set.
;   Description = Civil 3D API: The parameter is incorrect.
;   DescriptionFormat = ""
;   DisplayName (RO) = Civil 3D API: The parameter is incorrect.
;   Document (RO) = #<VLA-OBJECT IAeccDocument 000001982a979e50>
;   Easting = 3.24787e+06
;   Elevation = 5490.59
;   EntityTransparency = "ByLayer"
;   FullDescription (RO) = ""
;   GridEasting = Civil 3D API: This operation is not supported because the geodetic coordinate system has not been set.
;   GridNorthing = Civil 3D API: This operation is not supported because the geodetic coordinate system has not been set.
;   Handle (RO) = "732F4"
;   HasExtensionDictionary (RO) = 0
;   Hyperlinks (RO) = #<VLA-OBJECT IAcadHyperlinks 0000019883ea0d38>
;   LabelRotation = 0.0
;   LabelStyle = nil
;   Latitude = Civil 3D API: This operation is not supported because the geodetic coordinate system has not been set.
;   Layer = "0"
;   Linetype = "ByLayer"
;   LinetypeScale = 1.0
;   Lineweight = -1
;   Location = (3.24787e+06 1.70129e+06 5490.59)
;   Longitude = Civil 3D API: This operation is not supported because the geodetic coordinate system has not been set.
;   Material = "ByLayer"
;   Name = ""
;   Northing = 1.70129e+06
;   Number = 211
;   ObjectID (RO) = 42
;   ObjectName (RO) = "AeccDbCogoPoint"
;   OwnerID (RO) = 43
;   PlotStyleName = "ByLayer"
;   ProjectVersion (RO) = Civil 3D API: The parameter is incorrect.
;   RawDescription = ""
;   Rotation = 0.0
;   Scale (RO) = Civil 3D API: This operation is not supported because the geodetic coordinate system has not been set.
;   ShowToolTip = -1
;   Style = #<VLA-OBJECT IAeccPointStyle 000001987f382d10>
;   StyleName (RO) = "<none>"
;   SurveyPoint (RO) = 0
;   TrueColor = #<VLA

The custom "Point file" properties do not appear to be contained.

 

0 Likes
Message 6 of 9

carl3ZPF6
Enthusiast
Enthusiast
0 Likes
Message 7 of 9

john.uhden
Mentor
Mentor

@carl3ZPF6 ,

I'm happy to see that you retrieved all those Cogo point properties using VisualLisp.

Sadly, a singular (1) point does not have a bearing.  A bearing is an angular direction between two (2) points.

John F. Uhden

0 Likes
Message 8 of 9

john.uhden
Mentor
Mentor

@Sea-Haven ,

The rotation property is not a bearing.  You need two (2) points to define a bearing.

It is the rotation angle of the point marker about its insertion point and is defined in its point style.

There is a separate label rotation property for the label about its insertion point, but that is relative to the point's rotation angle.

When I submitted "MatchLabelRotation" (mentioned in the 2020 C3D help) I was thrilled (and lucky) that it worked, but it was only because all the points I was matching had the the same point style, and I wasn't going to try to find and excavate into the point styles to figure out what the point rotation was.  Just trying to get the jobs done expediently.

Ya know, I have done complete designs for all kinds of commercial, residential, institutional, and military projects including stormwater management and all permitting.  but when an aortic aneurism puts you out of work for six years (and you're still alive), you'll take that position as a survey tech for half the rate.

John F. Uhden

0 Likes
Message 9 of 9

Sea-Haven
Mentor
Mentor

Sorry John maybe not correct "It is the rotation angle of the point marker about its insertion point and is defined in its point style." Every cogo point can have an individual point rotation, yes an initial rotation is implied by the point style. So we are both 1/2 correct.

0 Likes