Are there any OOTB methods to serialize/deserialize the current view to/from json (or xml)

Are there any OOTB methods to

  • serialize the current view to json/xml
  • restore the view back from json/xml?

Thanks,
ven

Hello @venkat. Communicator does not have out-of-the-box functions for serializing and deserializing the Communicator.View object. It is possible to serialize/deserialize one part of the View object, that being the Camera through the methods Camera.toJson() and Camera.fromJson().

1 Like

Hi @venkat,

As Tino mentioned, you can save and restore the camera using the above mentioned APIs. You can also use the Communicator.MarkupManager class to save off various parts of the view. The class as a function called exportMarkup() that will save off the following:

  • Camera
  • Sheet ID (If the model is a drawing with sheets)
  • Exploding magnitude
  • Line visibility
  • Face visibility
  • Markup items
  • Node ID color map
  • Snapshot image

I believe that in the latest version, we also safe the state of cutting planes in the view, but you’ll have to verify that. You can create a view in the in the MarkupManager that will save off model state, which you can then serialize to json and reload later. You can read more about all of this here: Markup Basics — HOOPS Communicator 2023 SP1 Documentation

1 Like

Thank you @tino and @rtadlock for the timely reply. I was planning to use markup along with some node-related information stored separately. Just wanted to make sure I wasn’t missing existing functionality. Regards -venkat