Rhino.DocObject.ViewportInfo.FromJSON() does not work

Hi All,

I tried to convert ViewportInfo to JSON and read this JSON to make ViewportInfo.
But It does not work.
On the other hand, it seems working ToJSON and FromJSON for ObjectAttribtues.

Is there any my mistakes?

I hope someone can helps me.

import Rhino

## Get ViewportInfo from Active RhinoViewPort
ActiveViewport = Rhino.RhinoDoc.ActiveDoc.Views.ActiveView.ActiveViewport
ViewportInfo = Rhino.DocObjects.ViewportInfo( ActiveViewport )

## Convert from ViewportInfo to JSON
VPInfoJSON = ViewportInfo.ToJSON( Rhino.FileIO.SerializationOptions() )

## Convert from JSON to ViewportInfo
VPInfoFromJSON = Rhino.DocObjects.ViewportInfo.FromJSON( VPInfoJSON )

## Not work
print(VPInfoFromJSON)

## Get DEfault ObjectAttributes
ObjectAttributes = Rhino.RhinoDoc.ActiveDoc.CreateDefaultAttributes()

## Convert from ObjectAttribtues to JSON 
AttributesJSON = ObjectAttributes.ToJSON( Rhino.FileIO.SerializationOptions() )

## Convert from JSON to ObjectAttribtues
ObjectAttributesFromJSON = Rhino.DocObjects.ObjectAttributes.FromJSON( AttributesJSON )

## It works
print(ObjectAttributesFromJSON)


ViewportInfoFromJSON.gh (2.3 KB)

Hi @AYuA,

I’ve logged the issue - thanks for reporting.

https://mcneel.myjetbrains.com/youtrack/issue/RH-86439

– Dale

Thank you so much Dale!

RH-86439 is fixed in Rhino 8 Service Release 18 Release Candidate

Thank you so much Brian !

1 Like

Finally It works ! Thank you so much for your professional work Dale and Brian !