Community
Navisworks API
Welcome to Autodesk’s Navisworks API Forums. Share your knowledge, ask questions, and explore popular Navisworks API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Add a comment to a savedview?

4 REPLIES 4
Reply
Message 1 of 5
Tehkaiser
5182 Views, 4 Replies

Add a comment to a savedview?

I'm trying to add a comment to a saved view and just can't figure out how... Anyone know how, or can anyone point me in the right direction?

4 REPLIES 4
Message 2 of 5
xiaodong_liang
in reply to: Tehkaiser

before 2013, use COM API.

 

   ComApi.InwSavedViewsColl savviews = state.SavedViews();
            ComApi.InwOpSavedView oV = (ComApi.InwOpSavedView)savviews[1];
            ComApi.InwOpComment oComment = (ComApi.InwOpComment)state.ObjectFactory(ComApi.nwEObjectType.eObjectType_nwOpComment, null, null);
             oComment.Body = "Mycomment";
             oV.Comments().Add(oComment);

 

From 2013, new API

 

        Document oDoc = Autodesk.Navisworks.Api.Application.ActiveDocument;
        SavedItem oSVP = oDoc.SavedViewpoints.ToSavedItemCollection()[0];
         Comment oComment = new Comment("mycomments", CommentStatus.Approved);
        oDoc.SavedViewpoints.AddComment(oSVP,oComment);

Message 3 of 5
Tehkaiser
in reply to: xiaodong_liang

Thanks very much for the reply, although it was too late. It will still help me now. 🙂

 

I have another thread pending, if you can help me with it, it'd be great!

Message 4 of 5
edgarpotot
in reply to: xiaodong_liang

Hi Xiaodong,

 

I tried using the code you provided inside a loop, but it is putting all the comments in the 1st viewpoint.

 

How can I control to which viewpoint it is going to put the comment in.

 

 

Cheers,

Edgar

Message 5 of 5
edgarpotot
in reply to: edgarpotot

Already solved it, thanks.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Rail Community


Autodesk Design & Make Report