Print at Sep 21, 2019 4:29:11 PM

Posted by digitaltrails at Apr 3, 2019 9:33:35 PM
CameraBagPlugin Export/Import Points of View as CSV
I've written a plugin that can export and import a model's named points of view (its cameras) to a CSV file (hence camera bag, a bag of cameras). The plugin adds Export Cameras and Import Cameras menu items to the tools menu. When invoked via the menu, the plugin pops up an appropriate file selection dialog, defaulting to cameras.csv.

The ability to export/import provides you some ability to work around the current 50 points of view limit set in SH3D. Plus it provides you with the ability to generate points of view in bulk.

For example, say I need to create 30 images from the same point of view over a 3 month period. Rather than pointing and clicking to create 30 points of view, I can just export a single point of view and them use a spreadsheet or column oriented editor to generate the 29 other points of view, and then import all 30 back into SH3D.

The exported CSV looks something like:
#name,x,y,z,pitch,yaw,fov,time,cameraType,viewType,observerSizeType
Overview,13527.723,8459.4375,5482.206,42.0,-359.0,63.0,2018-05-04T12:00+12:00[Pacific/Auckland],PINHOLE,observer,variableSize
Fence,19926.076,9641.014,2976.5076,31.0,-315.0,63.0,2018-06-21T15:30:00.242+12:00[Pacific/Auckland],PINHOLE,topview,variableSize

Names with commas in them will be exported with the commas replaced by spaces.

The date will be exported in the time zone of the model's compass. Yaw, pitch, and fov angles are in degrees. For the moment x, y, z are internal metric only.

The cameraTypes are internal names that correspond to the Lens setting in the create photo panel as follows:
  • PINHOLE - Default
  • NORMAL - Depth of field
  • FISHEYE - Fisheye
  • SPHERICAL - Spherical
The viewType can be observer (virtual visitor) or topview (aerialview).

The observerSizeType is internal and determines some of the format of tooltips in some circumstances, it would normally be variableSize for both observer and topview cameras, but if the cameraType is observer, it may be fixedSize (perhaps just copy what's been exported).

The plugin has been uploaded to the sourceforge SH3D plugins contrib:
https://sourceforge.net/p/sweethome3d/plug-ins/25/