Jump to content

Cogo properties from the database [Civil 3D]


Kowal

Recommended Posts

In Civil 3D 2010 I used this function to retrieve data COGO points. In 2014 Civil function returns nil.

  (setq acadObject (vlax-get-acad-object))
 (princ acadObject)
 (setq acadDocument (vla-get-ActiveDocument acadObject))
 (setq mSpace (vla-get-ModelSpace acadDocument))
 (print mSpace)
 (setq lst nil)
 (vlax-for ent mSpace
   (if (equal (vla-get-ObjectName ent) "AeccDbCogoPoint")
     (progn
(setq enm (vlax-vla-object->ename ent))
(setq obj (vlax-ename->vla-object enm))
(setq nbr (vlax-get obj 'Number))
(setq coo (vlax-get obj 'Location)) 
(setq coor (mapcar '(lambda (%) (rtos % 2 3)) (list (cadr coo) (car coo) (caddr coo))))
(setq lst (append lst (list (append (list nbr) coor))))
)
     )
   )

How to get the properties COGO?

Link to comment
Share on other sites

Kowal,

 

This is quickly put together, but should be what you are looking for.

 

(defun c:test ( / ss n obj nbr coo coor lst)
 (setq ss (ssget "x" '((0 . "AECC_COGO_POINT"))))
 (setq n 0)
 (repeat (sslength ss)
   (setq obj (vlax-ename->vla-object (ssname ss n)))
   (setq nbr (vlax-get-property obj 'Number))
   (setq coo (vlax-safearray->list (vlax-variant-value (vlax-get-property obj 'Location))))
   (setq coor (mapcar '(lambda (%) (rtos % 2 3))(list (cadr coo)(car coo)(caddr coo))))
   (setq lst (append lst (list (append (list nbr) coor))))
   (setq n (+ n 1))
   )
 (princ (strcat "\n" (vl-princ-to-string lst)))
 (princ)
 )

 

regards,

 

hippe013

Link to comment
Share on other sites

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