Camera Settings within ACT Extension

Ayush Kumar
Member, Moderator, Employee Posts: 479
✭✭✭✭
- camera = Graphics.Camera
- camera.FocalPoint = Point([0.255500, -0.002500, 0.000000], 'm')
- camera.ViewVector = Vector3D(0.000000, 0.000000, 1.000000)
- camera.UpVector = Vector3D(0.000000, 1.000000, 0.000000)
- camera.SceneHeight = Quantity(0.327739, 'm')
- camera.SceneWidth = Quantity(0.624862, 'm')
- camera.Rotate(30, CameraAxisType.ScreenY)
- camera.Rotate(30, CameraAxisType.ScreenX)
- camera.SetFit()
The above mentioned code within ACT Console works perfectly fine, however when used within an extension, I get the following error:
- File "C:\Program Files\ANSYS Inc\v201\ACT\extensions\DropTestReport\main.py", line 14, in main
- AttributeError: 'type' object has no attribute 'Camera'
Tagged:
2
Best Answers
-
Can you try to use the full path i.e:
camera = ExtAPI.Graphics.Camera
0 -
Can you try something like this :
- Point=Ansys.Mechanical.Graphics.Point([1,1,1],’m’)
- a=ExtAPI.Graphics
- a.Camera.FocalPoint=Point
- a.Camera.Rotate(20.0,CameraAxisType.GlobalY)
- a.Camera.SceneHeight=Quantity('20 [m]’)
- a.Camera.SetSpecificViewOrientation(ViewOrientationType.Iso)
6
Answers
-
You can also get the camera view and up vectors from a CS like this:
- **Graphics.Camera.FocalPoint = Point([0.057308251171011626, 0.049519448731302887, 0.013134819241786163], 'm')
- Graphics.Camera.ViewVector = CS.PrimaryAxisDirection
- Graphics.Camera.UpVector = CS.SecondaryAxisDirection
- Graphics.Camera.SceneHeight = Quantity(0.32284138156079928, 'm')
- Graphics.Camera.SceneWidth = Quantity(0.24734358049907681, 'm')**
0