Documentation Field API

MagicDraw OpenAPI, scripting related questions and discussions

Moderator: Moderators

Documentation Field API

Postby mrlevy@mitre.org » Wed Apr 12, 2023 12:55 pm

Hello,

I am trying currently iterating over a block diagram and trying to extract the documentation field for each component. Currently I am able to extract part values, but have not found any API for extracting the documentation.
Is this a supported API feature or will I need to do a workaround of using a string part value for a custom description field for each block?

Thank you
mrlevy@mitre.org
Forum Newbie
Forum Newbie
 
Posts: 1
Posts Rating:0
Joined: Thu Nov 18, 2021 2:02 pm

Re: Documentation Field API

Postby yu3333 » Fri Apr 14, 2023 6:51 am

To get the documentation, we can do it this way:

Code: Select all
Element block = ... ;
Collection<Comment> comments = block.getOwnedComment();
    if(comments != null) {
        for (Comment comment : comments) {
            if (comment.getBody() != null) {
                print(comment.getBody());        //    comment.getBody() is the documentation we need   
            }
        }
    }

yu3333
Forum Newbie
Forum Newbie
 
Posts: 7
Posts Rating:0
Joined: Wed Mar 29, 2023 1:09 am


Return to Programmatic Extendibility

Who is online

Users browsing this forum: No registered users and 0 guests