Announcements

The Autodesk Community Forums has a new look. Read more about what's changed on the Community Announcements board.

CurrentViewpoint.Position doesnt equal Position Readout in HUD

jhdempsey
Advocate

CurrentViewpoint.Position doesnt equal Position Readout in HUD

jhdempsey
Advocate
Advocate

Hi All

 

Im trying to get the camera position of the current viewport (i.e. the coordinates given by the position readout in the Heads Up Display or HUD) 

I have followed the solution in the below post, but the coordinates i get from the oDoc.CurrentViewpoint.Value.Position attribute are very different to whats shown in the position readout.

https://forums.autodesk.com/t5/navisworks-api/export-position-readout-coordinates-from-nwd-file-as-c...

In the screenshot below from my model, you can see the position readout X value is 491719.128, but the position X attribute through the API is 1613251.733

Can anyone explain why its different, and how to get he values shown on the position readout?

NavisPositionQuestion.PNG

0 Likes
Reply
Accepted solutions (2)
1,025 Views
3 Replies
Replies (3)

alexisDVJML
Collaborator
Collaborator
Accepted solution

Just my guess: you should use document Units to convert the values.
Taking your example "491719.128, but the position X attribute through the API is 1613251.733":

1613251.733 / 491719.128 = 3.28
1 feet = 305mm, 1m = 1,000mm => ratio m/ft = 3.28 😀 

Main Scientist, Full Stack Developer & When Time Permits Director of IDIGO ► On your marks, Set, Go
0 Likes

ulski1
Collaborator
Collaborator
Accepted solution

I have done this by calculating a scale factor - here is how I convert from model units to Meters

 

double MyScaleFactor = Autodesk.Navisworks.Api.Interop.LcOaUnit.ScaleFactor(Autodesk.Navisworks.Api.Units.Meters, Autodesk.Navisworks.Api.Application.ActiveDocument.Units);

 

there is properly a simpler way

 

br

Ulrik

 

0 Likes

alexisDVJML
Collaborator
Collaborator

I personally have all these conversion ratios in static tables and I cache it for the current document in my plugin using various events to update it where necessary.

BTW, this settled your issue, am I correct? Thus can mark it as solution ?

Your Sincerely.

Main Scientist, Full Stack Developer & When Time Permits Director of IDIGO ► On your marks, Set, Go
0 Likes