Custom Exporter GetCameraInfo

Here is a simple yet longstanding question with a surprisingly simple answer that should prove extremely helpful for all those who really need it, presumably including Mohan Sawant, who raised this issue in a

comment
on
the

DWF view definition
and
its camera settings:

Question: Is there any programmatic access to the Revit camera target and

FOV
?

For my application, I have to define a camera using position, target, up vector, projection type and field of view.

I tried to read the camera parameters from the View3d object returned by the filtered element collector. From this I can get the up vector and position.

How can I determine the other parameters for the camera object, especially the target and FOV?

Answer by Arnošt Löbel: The only way I know of is using a custom exporter.

When a view is processed and run through a custom context, its properties will be used to populate a ViewNode instance.

One of its methods is GetCameraInfo, which provides information that ought to cover everything you need to know about the view’s camera.

Granted, this is not the most straightforward way to get the information, but keep in mind that the exporter itself would be very simple and would not need to do anything else whatsoever.

Many thanks, Arnošt, for your help!

I put together a list of

custom exporter
discussions
that you can refer to for example implementations.


Comments

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading