Lewy Blue
Lewy Blue

Reputation: 638

How to use the various Forge Viewer transforms

Below are the various transforms I have found so far using NOP_VIEWER.model.getData().

I'm using the transforms to bring a position into viewer space, and I haven't been able to find any good documentation describing what they all do. My hope here is that this question can help by providing some documentation of the role of these transforms and how/when to use them.

The model originally comes from Revit.

  1. GlobalOffset (Vector3)
  2. placementWithOffset (Matrix4) - seems to be just the inverse of GlobalOffset as a matrix?
  3. placementTransform (Matrix4) - undefined in all models I've tested, I've seen some hints that this is a user defined matrix.
  4. refPointTransform (Matrix4)

Also, there are some transforms in the NOP_VIEWER.model.getData().metadata. These may be Revit specific:

  1. metadata.georeference.positionLL84 (Array[3]) - this is where the model's GPS coords are stored
  2. metadata.georeference.refPointLMV (Array[3]) - no idea what this is, and it has huge and seemingly random values on many models. For example, on my current model it is [-17746143.211481072, -6429345.318822183, 27.360225423452952]
  3. metadata.[custom values].angleToTrueNorth - I guess this is specifying whether the model is aligned to true or magnetic north?
  4. metadata.[custom values].refPointTransform - (Array[12]) - data used to create the refPointTransform matrix above

Can someone help by documenting what these transforms do?

Related: Place a custom object into viewer space using GPS coords

Upvotes: 0

Views: 637

Answers (1)

Augusto Goncalves
Augusto Goncalves

Reputation: 8604

As an alternative solution, the Viewer works with extensions. The Autodesk.Geolocation extension provides a few methods to handle the data structure you mentioned:

Load extension:

let geoExt;
NOP_VIEWER.loadExtension('Autodesk.Geolocation').then((e) => {geoExt = e});

Or get already loaded extension:

let geoExt = NOP_VIEWER.getLoadedExtensions()['Autodesk.Geolocation']

Then use the methods to convert the coordinates

geoExt.lmvToLonLat
geoExt.lonLatToLmv

Here is a quick article on it.

You may .activate() the extension to see additional information on the model geo location.

Upvotes: 2

Related Questions