Camera
- class compas_cadwork.scene.Camera[source]
Bases:
Data
This class is a wrapper for cadwork’s camera data which allows to get information and manipulate the camera settings in an object-oriented way.
- ..note::
While the cadwork document might use millimeters as the unit of length, the camera data is expected in meters. The caller is responsible for converting the data to the correct unit before passing it to the camera.
- Parameters:
- frameFrame
Position and orientation of the camera.
- fovfloat
The field of view of the camera.
- fwidthfloat
The field width of the camera.
- fheightfloat
The field height of the camera.
- targetPoint
The point the camera is looking at.
- projection_typeProjectionType
The projection type of the camera.
- Attributes:
- frame
Frame
, read-only Position and orientation of the camera.
- fovfloat, read-only
The field of view of the camera.
- fov_widthfloat, read-only
The field width of the camera.
- fov_heightfloat, read-only
The field height of the camera.
- positionPoint
The position of the camera.
- targetPoint
The point the camera is looking at.
- up_vectorVector
The up vector of the camera.
- frame
Examples
>>> from compas_cadwork.scene import Camera >>> camera = Camera.from_activedoc() >>> camera.position Point(0.0, 0.0, 0.0)
>>> # Set the camera position to the center of the active element and zoom to it: >>> length = element.length * 0.001 >>> target = element.midpoint * 0.001 >>> location = target + element.frame.zaxis * length >>> camera = Camera.from_activedoc() >>> camera.look_at(target, up_vector=element.frame.xaxis)
Methods
Apply the camera settings to the currently active cadwork document.
Create a camera from the camera in the currently active cadwork document.
Set the camera to look at a specific target point.
Load the camera settings from the currently active cadwork document.
Reset the camera to the standard axonometric view.
Zoom the camera to the currently active element.
Inherited Methods
Converts the instance to a string.
Make an independent copy of the data object.
Construct an object of this type from a JSON file.
Construct an object of this type from a JSON string.
Compute a hash of the data for comparison during version control using the sha256 algorithm.
Convert an object to its native data representation and save it to a JSON file.
Convert an object to its native data representation and save it to a JSON string.
Validate the data against the object's data schema.