How get and set Documentation info (Hyperlink, notes )

How get and set Documentation info (Hyperlink, notes )

mehdi-guida
Advocate Advocate
1,397 Views
10 Replies
Message 1 of 11

How get and set Documentation info (Hyperlink, notes )

mehdi-guida
Advocate
Advocate

Hi, How can i get and set Documentation info (Hyperlink, notes ) of Extended data of an object by .Net ?

Thank you

0 Likes
Accepted solutions (1)
1,398 Views
10 Replies
Replies (10)
Message 2 of 11

Jeff_M
Consultant
Consultant

All Entity objects have the Hyperlinks collection which holds all of the hyperlinks attached to that Entity. Not sure what you mean by notes, though.

Jeff_M, also a frequent Swamper
EESignature
0 Likes
Message 3 of 11

mehdi-guida
Advocate
Advocate

Thanks. I need to set and get fields that shown in attached image.

0 Likes
Message 4 of 11

hippe013
Advisor
Advisor

As @Jeff_M points out, the Hyperlinks are contained in the Hyperlinks property on the Autodesk.AutoCAD.DatabaseServices.Entity. The notes can be found in the extension dictionary of the Autodesk.AutoCAD.DatabaseServices.DBObject. Use the ExtensionDictionary property to obtain the objectId of the dictionary. It will be opened as a DBDictionary. The entry key that you are looking for is "AEC_TEXT_NOTE". Its value will return an objectId which can then be opened as an Autodesk.AEC.DatabaseServices.TextNote. The text note has a property called "Note" that will contain the contents of the Notes added to the ExtendedData tab of the properties palette. 

0 Likes
Message 5 of 11

Jeff_M
Consultant
Consultant
Accepted solution

To add to what @hippe013 shared, you can also get the list of documents attached using the "AEC_REF_DOCS" dictionary. Here's a short example demonstrating this:

                            //this will contain the first hyperlink
                            var hl = aeccEnt.Hyperlinks[0].DisplayString;

                            var prs = aeccEnt.ExtensionDictionary;
                            var dict = (DBDictionary)prs.GetObject(OpenMode.ForRead);
                            //this is the Reference Documents
                            var docsEntry = (ObjectId)dict["AEC_REF_DOCS"];
                            var docs = (DBDictionary)docsEntry.GetObject(OpenMode.ForRead);
                            var dictEnum = docs.GetEnumerator();
                            var pathList = new List<string>();
                            while(dictEnum.MoveNext())
                            {
                                var refdoc = (Autodesk.Aec.DatabaseServices.ReferenceDocument)((ObjectId)dictEnum.Value).GetObject(OpenMode.ForRead);
                                pathList.Add(refdoc.FileFullPath);
                            }
                            //and this is the Notes
                            var noteEntry = (ObjectId)dict["AEC_TEXT_NOTE"];
                            var notes = (Autodesk.Aec.DatabaseServices.TextNote)noteEntry.GetObject(OpenMode.ForRead);
                            var actualNoteText = notes.Note;
Jeff_M, also a frequent Swamper
EESignature
Message 6 of 11

mehdi-guida
Advocate
Advocate

Thank you so much :))

0 Likes
Message 7 of 11

CodeDing
Advisor
Advisor

 

Oh, wow I guess I should have checked Civil 3D forum first, I did not realize this was a C3D-Only property.

 

I just posted over HERE asking if this was possible.

 

Does anyone know if this is possible with AutoLISP / Visual Lisp?

 

Best,

~DD

0 Likes
Message 8 of 11

Jeff_M
Consultant
Consultant

@CodeDing in a quick test, no can do in lisp.

(setq ent (vl-sel))
(setq extdict (vla-getextensiondictionary ent))
(setq notes (vla-item extdict "AEC_TEXT_NOTE"))
(vlax-get notes 'note)

Notes is set to an object: 

2021-03-09_16-32-32.jpg

but the last line returns:

; error: ActiveX Server returned the error: unknown name: "NOTE"

Jeff_M, also a frequent Swamper
EESignature
Message 9 of 11

CodeDing
Advisor
Advisor

Thanks Jeff

0 Likes
Message 10 of 11

Daniel.Sotelo.EDP
Participant
Participant

Do you have an example of this in C#?

0 Likes
Message 11 of 11

Jeff_M
Consultant
Consultant

@Daniel.Sotelo.EDP look at message #5 in this thread.

Jeff_M, also a frequent Swamper
EESignature
0 Likes