How to access Reference Documents or Notes in Extended Data

How to access Reference Documents or Notes in Extended Data

CodeDing
Advisor Advisor
1,253 Views
6 Replies
Message 1 of 7

How to access Reference Documents or Notes in Extended Data

CodeDing
Advisor
Advisor

Hello,

 

Can anyone tell me if it's possible to access (read and write) the data contained in the "Reference Documents" or "Notes" portion of the Extended Data of an object?

 

Here's some sample data I added to a Polyline (these tabs are available on the PROPERTIES palette):

image.png

 

But when I access the ENTITY --> EXTENDED DATA --> AEC_REF_DOCS (or AEC_TEXT_NOTE)... This is all that comes up:

((-1 . <Entity name: 16106b7c900>) (0 . "AEC_REF_DOC") (5 . "8700") (102 . "{ACAD_REACTORS") (330 . <Entity name: 16106b7c8f0>) (102 . "}") (330 . <Entity name: 16106b7c8f0>))
((-1 . <Entity name: 16106b7c970>) (0 . "AEC_TEXT_NOTE") (5 . "8707") (102 . "{ACAD_REACTORS") (330 . <Entity name: 16106b91d70>) (102 . "}") (330 . <Entity name: 16106b91d70>))

 

...and it's no better with Visual Lisp, or using the (dumpallproperties ...) method.

 

I found these 2 posts on the matter, but to no avail:

https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/retrieve-notes-information/td-p/4363...

https://forums.autodesk.com/t5/objectarx/add-notes-to-an-entity/td-p/321686

 

Any insight?

Best,

~DD

 

 

0 Likes
Accepted solutions (1)
1,254 Views
6 Replies
Replies (6)
Message 2 of 7

CodeDing
Advisor
Advisor

I guess, I'm not sure if this is a Civil 3D-Only thing? If so, can I get some help moving it to the Civil 3D Customization forum?

0 Likes
Message 3 of 7

john.uhden
Mentor
Mentor

I'm not sure if this is the right source, but every object in AutoCAD can have an extensiondictionary which can contain all kinds of things in the form of xrecords.

Try using the vla-hasextensiondictionary and vla-getextensiondictionary functions to initiate access to this data.  Do a dump on each item within to see the structure and methods you can use to access all the data.

I was looking for an example, but maybe it's on my old laptop.  If I find it, I'll post it.  I think I called it XNOTES which could read all the Land Desktop note data, even from an attached xref.  Sorry, but it's been a while.

John F. Uhden

0 Likes
Message 4 of 7

john.uhden
Mentor
Mentor

I found it.

Now this is written specifically to find AECC stuff, but the structure may help you.

  (defun @Anonymous_getnote (Object / XDict RefNote RefDocs Data)
    (and
      (cond
        ((= (type Object) 'VLA-Object))
        ((= (type Object) 'ENAME)
          (setq Object (vlax-ename->vla-object Object))
        )
      )
      (= (vla-get-hasextensiondictionary Object) :vlax-true)
      (setq XDict (vla-getextensiondictionary Object))
      (setq XDict (vlax-vla-object->ename XDict))
      (Setq XDict (entget XDict))
      (or (setq RefNote (cdr (assoc 360 (member '(3 . "AEC_TEXT_NOTE") XDict)))) 1)
      (if (setq RefDocs (cdr (assoc 360 (member '(3 . "AEC_REF_DOCS") XDict))))
        (setq RefDocs (@cv_dxflist (entget RefDocs) 360))
        1
      )
      (or
        RefNote
        RefDocs
        (prompt "\nObject has no Notes attached.")
      )
      (if RefNote
        (setq RefNote (entget RefNote)
              RefNote (cdr (assoc 1 RefNote))
        )
        1
      )
      (if RefDocs
        (setq RefDocs
          (mapcar
           '(lambda (x)(setq x (entget x))(list (cdr (assoc 3 x))(cdr (assoc 2 x))))
            RefDocs
          )
        )
        1
      )
      (setq Data (list RefNote RefDocs))
    )
    Data
  )

Oops, missing function @Anonymous_dxflist is nothing more than removing all but dxf codes of a given number from a list.

It would look something like...

(defun @Anonymous_dxflist (dxf lst)
  (vl-remove-if-not '(lambda (x)(= (car x) dxf)) lst)
)
Or maybe
(setq lst (mapcar 'cdr (@cv_dxflist dxf lst)))

 

John F. Uhden

Message 5 of 7

CodeDing
Advisor
Advisor
Accepted solution

 

Thanks for the reply John.

 

But according to Jeff over at C3D Customization forum, this is not possible w/ lisp.

 

Just weird they would save SOME of the info within the entity and make it accessible, but not the rest.

 

Best,

~DD

0 Likes
Message 6 of 7

john.uhden
Mentor
Mentor
Yeah, Jeff would know.

John F. Uhden

0 Likes
Message 7 of 7

john.uhden
Mentor
Mentor

Yeah, I just tried the function out in C3D 2020 and got nuthin.

Of course you would have to know what object to attack, anyway.  I suppose you could try the anthropologist approach and turn over every stone in the drawing, but my guess is that they've hidden the data away where we're not gonna find it, as Jeff said.

John F. Uhden

0 Likes