Cogo Point Descriptions

1269
2
Jump to solution
04-26-2023 04:18 PM
gargarcia
New Contributor III

Using the ArcGIS for Autocad Plugin (Latest version 420) in Civil 3D you can bring in feature layer points as cogo points and the raw description of the point defaults to the feature layer name. Is it possible to make the cogo point raw description in Civil 3D read a field in the data so that the points can have raw descriptions categorized by type as defined by an attribute in the point layer?

0 Kudos
1 Solution

Accepted Solutions
Randy_Garcia
Esri Contributor

Hi, 

I think what you would be really awesome but currently the way we have it set up is that the description is set, by default, to the name of the feature layer on add of the layer.  You can change the point description to whatever you want, we are not in anyway tied to the point description. You can use Civil 3D tools to update the point description or you can use the ArcGIS for AutoCAD redraw tool to bulk update the value to something else. Note that the redraw tool is not dynamic. You would have to run it for every new point that is added.  Unfortunately if you want it to be updated based on a GIS field we don't have a way to do it out of the box. 

 

I've included a sample below of how you can do this with our lisp api, it will take a feature layer and update all the point descriptions based on a GIS field you specify. Again this isn't dynamic its also not anything we support but I wanted to show you what you can do if you really need this.  It currently only works with text fields but you could easily modify it to handle other field types such as integer. 

I hope that helps! 

 

(defun c:testDescriptionFromField ()
  ; Ask for feature layer
  (setq flname (getstring "Name of feature layer? : "))
  ; ask for GIS field
  (setq attname (getstring "Name of field? : "))
  ; get the feature layer selection set
  (setq flSelection (esri_featurelayer_select flname))
  ; get the number of features in the selection set
  (setq flLength (sslength (esri_featurelayer_select flname)))
  ; set counter to zero
  (setq entCount 0)
  ;loop through each feature in the feature layer
  (repeat flLength 
    ; create an empty selection set
    (setq ss (ssadd))
    ; get the AutoCAD entity name for the current feature
    (setq entName (ssname flSelection entCount))
    ; add the feature to the selection set
    (ssadd entName ss)
    ; get the attriubte value list for the point
    (setq attValue 
      (esri_attributes_get entName 
        (list 
          (cons "FLNAME" flname)
          (cons "FIELDNAME" attname)
        )
      )
    )
    ; grab the field value from the above list
    (setq attValue (cdr (nth 0 attValue)))
    ; Set the descritption of the point to the field value
    (esri_feature_changeElementType ss
      (list 
        (cons "Type" "AECC_COGO_POINT") 
        (cons "Description" attValue)
      )
    )
    ; empty the selection set for the next point
    (setq ss nil)
    ; add one to the counter to get to the next point
    (setq entCount (+ 1 entCount))
  )
)

 

View solution in original post

2 Replies
Randy_Garcia
Esri Contributor

Hi, 

I think what you would be really awesome but currently the way we have it set up is that the description is set, by default, to the name of the feature layer on add of the layer.  You can change the point description to whatever you want, we are not in anyway tied to the point description. You can use Civil 3D tools to update the point description or you can use the ArcGIS for AutoCAD redraw tool to bulk update the value to something else. Note that the redraw tool is not dynamic. You would have to run it for every new point that is added.  Unfortunately if you want it to be updated based on a GIS field we don't have a way to do it out of the box. 

 

I've included a sample below of how you can do this with our lisp api, it will take a feature layer and update all the point descriptions based on a GIS field you specify. Again this isn't dynamic its also not anything we support but I wanted to show you what you can do if you really need this.  It currently only works with text fields but you could easily modify it to handle other field types such as integer. 

I hope that helps! 

 

(defun c:testDescriptionFromField ()
  ; Ask for feature layer
  (setq flname (getstring "Name of feature layer? : "))
  ; ask for GIS field
  (setq attname (getstring "Name of field? : "))
  ; get the feature layer selection set
  (setq flSelection (esri_featurelayer_select flname))
  ; get the number of features in the selection set
  (setq flLength (sslength (esri_featurelayer_select flname)))
  ; set counter to zero
  (setq entCount 0)
  ;loop through each feature in the feature layer
  (repeat flLength 
    ; create an empty selection set
    (setq ss (ssadd))
    ; get the AutoCAD entity name for the current feature
    (setq entName (ssname flSelection entCount))
    ; add the feature to the selection set
    (ssadd entName ss)
    ; get the attriubte value list for the point
    (setq attValue 
      (esri_attributes_get entName 
        (list 
          (cons "FLNAME" flname)
          (cons "FIELDNAME" attname)
        )
      )
    )
    ; grab the field value from the above list
    (setq attValue (cdr (nth 0 attValue)))
    ; Set the descritption of the point to the field value
    (esri_feature_changeElementType ss
      (list 
        (cons "Type" "AECC_COGO_POINT") 
        (cons "Description" attValue)
      )
    )
    ; empty the selection set for the next point
    (setq ss nil)
    ; add one to the counter to get to the next point
    (setq entCount (+ 1 entCount))
  )
)

 

gargarcia
New Contributor III

This is very helpful to know. Thank you for providing the sample. That method does sound promising for my use. I will definitely be looking into implementing that.

My alternate method was going to be just having a separate feature layer for each object type instead of defining type with a field. But with too many types that could be overwhelming I think, so your method seems like a good path forward.

0 Kudos