I am planning to use the Fe Viewer to convert coordinates between a 2D sheet and a 3D model. The goal is to store and display certain resources managed on the 2D sheet in model-invariant coordinates. For the coordinate conversion, I am considering the use of functions such as Autodesk.AEC.AecModelData.get2DTo3DMatrix and Autodesk.AEC.AecModelData.get3DTo2DMatrix.
In the 3D viewer, I am using the standard Autodesk.Viewing.GuiViewer3D instead of an AggregatedView (because it is difficult to migrate to AggregatedView right away). I am also considering a situation where multiple models are displayed using a LinkedFile that has been configured with Shared Coordinates.
With that in mind, I am concerned about the following three points:
(1) Revit’s 3D models have several types of origins:
- Internal Origin
- Survey Point
- Project Base Point
When using get2DTo3DMatrix or get3DTo2DMatrix to convert coordinates to the 3D model, which of these points is treated as the origin?
(2) If the origin in (1) is something other than the Survey Point, we would like to determine an appropriate offset method. For example, in the Fe Viewer, is there a way—using AECModelData.json or an API—to obtain the difference between the Survey Point and the origin mentioned in (1)?
(3) Similarly, when you load a 3D model into Autodesk.Viewing.GuiViewer3D and subtract the globalOffset, what is considered the origin by the definition above?
Additionally, if there is any function other than Autodesk.AEC.AecModelData.get2DTo3DMatrix that can be used to achieve the above objectives, I would appreciate it if you could let me know.
I am planning to use the Fe Viewer to convert coordinates between a 2D sheet and a 3D model. The goal is to store and display certain resources managed on the 2D sheet in model-invariant coordinates. For the coordinate conversion, I am considering the use of functions such as Autodesk.AEC.AecModelData.get2DTo3DMatrix and Autodesk.AEC.AecModelData.get3DTo2DMatrix.
In the 3D viewer, I am using the standard Autodesk.Viewing.GuiViewer3D instead of an AggregatedView (because it is difficult to migrate to AggregatedView right away). I am also considering a situation where multiple models are displayed using a LinkedFile that has been configured with Shared Coordinates.
With that in mind, I am concerned about the following three points:
(1) Revit’s 3D models have several types of origins:
- Internal Origin
- Survey Point
- Project Base Point
When using get2DTo3DMatrix or get3DTo2DMatrix to convert coordinates to the 3D model, which of these points is treated as the origin?
(2) If the origin in (1) is something other than the Survey Point, we would like to determine an appropriate offset method. For example, in the Fe Viewer, is there a way—using AECModelData.json or an API—to obtain the difference between the Survey Point and the origin mentioned in (1)?
(3) Similarly, when you load a 3D model into Autodesk.Viewing.GuiViewer3D and subtract the globalOffset, what is considered the origin by the definition above?
Additionally, if there is any function other than Autodesk.AEC.AecModelData.get2DTo3DMatrix that can be used to achieve the above objectives, I would appreciate it if you could let me know.
Share Improve this question asked Mar 12 at 9:35 y.sayamay.sayama 113 bronze badges1 Answer
Reset to default 2I have communicated with Autodesk engineer and gathered information around the query.
When the model is loaded into the Viewer, it will calculates a global offset from Viewer's origin(0, 0, 0) to the center of the model. Then the model will be placed at Viewer's origin with applying the globalOffset to the model.
The origin of the globelOffset should be the same with Revit internal origin.
The Autodesk.AEC.AecModelData.get3DTo2DMatrix()/Viewport.get2DTo3DMatrix() methods returns the matrix between the 3D model and the one in the viewport (2D view) placed on the sheet.
Thus, these methods return a matrix based on Viewer's origin.
You can find the sample code on the below blog post and github repo.
Mapping between sheets and 3D views of AEC models
https://aps.autodesk/blog/mapping-between-sheets-and-3d-views-aec-modelspublic/aec-mapping-2d-to-3d.html
https://github/petrbroz/fe-viewer-samples/blob/master/public/aec-mapping-2d-to-3d.html
If you want to get a coordinates on Revit from Viewer or vice versa, you can get transform for the purpose.
viewer.model.getInverseModelToViewerTransform();
viewer.model.getModelToViewerTransform
To aggregate multiple models without using AggregateView, our engineer have published a sample code in the following thread.
- Revit shared coordinates to Fe viewer
Revit shared coordinates to Fe viewer
For survey points, GeolocationExtension is available which supports mapping between latitude/longitude coordinates and Viewer coordinates through lonLatToLmv() and lmvToLonLat(). Here are the links for tips.
Autodesk Fe - Absolute coordinates
Autodesk Fe - Absolute coordinatesMini-map with Geolocation extension
https://aps.autodesk/blog/mini-map-geolocation-extensionIncorrect results using Autodesk Fe Viewer Geolocation Extension
Incorrect results using Autodesk Fe Viewer Geolocation Extension
Also you can get metadata to calculate the geolocation by yourself.
- Meaning of Revit's geospatial metadata retrieved with Model Derivative API
Meaning of Revit's geospatial metadata retrieved with Model Derivative API