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?
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);
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!
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