Camera Settings within ACT Extension

Member, Moderator, Employee Posts: 479
100 Answers 250 Likes 100 Comments Second Anniversary
✭✭✭✭
edited June 2023 in Structures
  1. camera = Graphics.Camera
  2. camera.FocalPoint = Point([0.255500, -0.002500, 0.000000], 'm')
  3. camera.ViewVector = Vector3D(0.000000, 0.000000, 1.000000)
  4. camera.UpVector = Vector3D(0.000000, 1.000000, 0.000000)
  5. camera.SceneHeight = Quantity(0.327739, 'm')
  6. camera.SceneWidth = Quantity(0.624862, 'm')
  7. camera.Rotate(30, CameraAxisType.ScreenY)
  8. camera.Rotate(30, CameraAxisType.ScreenX)
  9. camera.SetFit()

The above mentioned code within ACT Console works perfectly fine, however when used within an extension, I get the following error:

  1. File "C:\Program Files\ANSYS Inc\v201\ACT\extensions\DropTestReport\main.py", line 14, in main
  2. AttributeError: 'type' object has no attribute 'Camera'
Tagged:

Best Answers

  • Member, Employee Posts: 201
    100 Likes 100 Comments Second Anniversary Ansys Employee
    ✭✭✭✭
    Answer ✓

    Can you try to use the full path i.e: camera = ExtAPI.Graphics.Camera

Answers

  • Member, Employee Posts: 385
    25 Answers 100 Comments Second Anniversary 25 Likes
    ✭✭✭✭

    You can also get the camera view and up vectors from a CS like this:

    1. **Graphics.Camera.FocalPoint = Point([0.057308251171011626, 0.049519448731302887, 0.013134819241786163], 'm')
    2. Graphics.Camera.ViewVector = CS.PrimaryAxisDirection
    3. Graphics.Camera.UpVector = CS.SecondaryAxisDirection
    4.  
    5. Graphics.Camera.SceneHeight = Quantity(0.32284138156079928, 'm')
    6. Graphics.Camera.SceneWidth = Quantity(0.24734358049907681, 'm')**

Welcome!

It looks like you're new here. Sign in or register to get started.