Is there a function to retrieve the redline annotation of a vewpoint in Navisworks API? I do see references to redlines elsewhere in the API Reference Manual such as AddRedlinesToCurrentSavedViewpoint in DocumentCurrentMeasurement, but I don't see a means to retreive the redline annotation information from a saved view point. Is this even possible in Navisworks API?
Thanks,
Scott.
Hi,
Sorry, I do not either see an API. What you can access is only the information of current measurement.
Redlines can be retrieved from a View by using GetRedlines():
Public Function GetRedlines() As String
Member of Autodesk.Navisworks.Api.View
Summary:
Gets redlines in the form of a JSON RedlineCollection object.
Note: It will be necessary to deserialize the JSON string to a .NET object. This is a current VB implementation:
'Class for the redline markup collection
Public Class Rootobject
Public Property Type As String
Public Property Version As Integer
Public Property Values() As Value()
End Class
'Class for the redline instances
Public Class Value
Public Property Type As String 'Type of redline
Public Property Version As Integer 'Redline version
Public Property Thickness As Integer 'Thickness
Public Property Color() As List(Of Double) 'Color (RGB values)
Public Property MinPoint() As List(Of Double) 'Ellipse - lower left corner
Public Property MaxPoint() As List(Of Double) 'Ellipse - upper right corner
Public Property Origin() As List(Of Double) 'Text origin
Public Property Text As String 'Text string
Public Property Start() As List(Of Double) 'Line start point
Public Property [End]() As List(Of Double) 'Line end point (must declare 'escaped' names by using brackets in VB or a leading @ in C#)
End Class
Caveat: This object may not be complete - use it at your own risk!
Dear @brian.k.smith
This looks great and could be very useful for my concern.
So I've tried the following code from the following scene.
string redline = document.ActiveView.GetRedlines(); System.IO.StreamWriter file = new StreamWriter("./CurrentViewPointRedline.json"); file.Write(redline); file.Close();
I was expecting to get the paramaters of the redline annotation but unfortunately my json returned string seems to be empty 😞
{"Type":"RedlineCollection","Version":1,"Values":[]}
Any idea ?
Thank you very much for your help,
Christophe.