Camera Settings within ACT Extension
Ayush Kumar
Member, Moderator, Employee Posts: 449
✭✭✭✭
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
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