Focal Distance is not set using Naviswork API

Anonymous

Focal Distance is not set using Naviswork API

Anonymous
Not applicable
We are developing  the .net application using navisworks api.
In that I have got one error –  “Focal distance not set”

Document document = Autodesk.Navisworks.Api.Application.ActiveDocument;

  foreach (SavedItem item in document.SavedViewpoints.Value)
            {

                        SavedViewpoint SVP = item as SavedViewpoint;
                        Viewpoint vp = new Viewpoint();
                        vp = SVP.Viewpoint;
                       double focaldistance = VP.FocalDistance;
           }

Can you tell me how I can solve this.
1.I can access properties of manual created viewpoints by this api but
when I create viewpoints automatically(Export from Clash)that it gives
null properties(AngularSpeed =
{System.Reflection.TargetInvocationException: Exception has been thrown by
the target of an invocation. --->
System.Runtime.InteropServices.COMException: <<NavisWorks Error - Element
not present>>) such as focal Distance,Angular speed .

Thanks
0 Likes
Reply
Accepted solutions (1)
789 Views
1 Reply
Reply (1)

CADsoftOrl
Contributor
Contributor
Accepted solution

The viewpoint does not have a "View" assigned to it so the focal distance is not valid.  I've had this issue as well.  I had to save the current viewpoint, make this viewpoint current, get the info needed and then reset to the current viewpoint that I saved.  My issue was not with getting the focal distance but trying to zoom the viewpoint to a bounding box.

 

Hope this helps,

Joe