TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: K12RS on August 14, 2015, 12:23:39 PM

Title: Need to access "Description" from AECC_COGO_POINT
Post by: K12RS on August 14, 2015, 12:23:39 PM
Please forgive any wrongdoings
This is my first post
As the title says, I'm trying to access the "Description" from an AECC_COGO_POINT so I can change that entity to a layer based on said Description.

I'm not aprogramming guru but have been doing fine with lisp for years without hurting my brain to learn new stuff.
But perhaps it's time.

LSP code from LDD worked great

Code: [Select]
(partial)
     (setq elist (entget ename))
     (setq ptype (cdr (assoc 0 elist)))    ;find primative type

     (if (= ptype "AECC_COGO_POINT")
         (progn
            (Read-Description)
            (Change-desc-to-Layer-name)
            (Make-Layer-Change)
         ) ;end progn
     ) ;end if



(defun Read-Description()
   (setq ename1 (entget ename))
   (setq desc  (cdr (assoc 302 elist)))

   (if (or (= desc " ") (= desc "") (= desc "."))
       (setq desc "null")
   ); end if
); end Read-Next-Attribute

PLEASE - any ideas or links?
Thanks
Title: Re: Need to access "Description" from AECC_COGO_POINT
Post by: Jeff_M on August 14, 2015, 12:40:19 PM
Welcome to the Swamp, K12RS!

For Civil3D objects you need to use ActiveX/COM, as they don't have DXF codes for most of the properties.
Make sure you run the single line:
(vl-load-com)
at least once per session. This makes sure you can use the vla-, vlax-, functions.

Code - Auto/Visual Lisp: [Select]
  1.    (setq ptObj (vlax-ename->vla-object ename))
  2.    (setq desc  (vlax-get ptObj 'rawdescription))
  3.  
  4.  
Title: Re: Need to access "Description" from AECC_COGO_POINT
Post by: K12RS on August 14, 2015, 01:59:59 PM
Worked!
THANK YOU
Title: Re: Need to access "Description" from AECC_COGO_POINT
Post by: CAB on August 14, 2015, 04:32:17 PM
Welcome to the Swamp.  8)