如何以编程方式在 SketchUp 中为页面设置相机?
How to set camera for page in Sketchup programmatically?
我是编写 Sketchup 插件的新手,遇到了问题。我知道如何创建页面(场景)和相机,但我不知道如何为页面设置相机。有小费吗?
eye = [100, 100, 500]
target = [300, 300, 300]
up = [0, 0, 1]
pg_front = pages.add "front"
front_cam = Sketchup::Camera.new eye, target, up
# First idea, but it's not working
pg_front.camera = front_cam
# Second idea, but it's not working too
pg_front.use_camera = front_cam
您尝试过使用 Camera#set
吗?
pg_front.camera.set(front_cam)
我对Sketchup知之甚少,不过以后可能要更新页面了:
pg_front.update(1)
根据 Page#update
的文档,可以使用以下更新标志:
- 1 - Camera Location,
- 2 - Drawing Style,
- 4 - Shadow Settings,
- 8 - Axes Location,
- 16 - Hidden Geometry,
- 32 - Visible Layers,
- 64 - Active Section Planes.
如果这不起作用,请尝试在重新分配之前禁用相机,然后再次启用它 (pg_front.use_camera = true/false
)。
我是编写 Sketchup 插件的新手,遇到了问题。我知道如何创建页面(场景)和相机,但我不知道如何为页面设置相机。有小费吗?
eye = [100, 100, 500]
target = [300, 300, 300]
up = [0, 0, 1]
pg_front = pages.add "front"
front_cam = Sketchup::Camera.new eye, target, up
# First idea, but it's not working
pg_front.camera = front_cam
# Second idea, but it's not working too
pg_front.use_camera = front_cam
您尝试过使用 Camera#set
吗?
pg_front.camera.set(front_cam)
我对Sketchup知之甚少,不过以后可能要更新页面了:
pg_front.update(1)
根据 Page#update
的文档,可以使用以下更新标志:
- 1 - Camera Location,
- 2 - Drawing Style,
- 4 - Shadow Settings,
- 8 - Axes Location,
- 16 - Hidden Geometry,
- 32 - Visible Layers,
- 64 - Active Section Planes.
如果这不起作用,请尝试在重新分配之前禁用相机,然后再次启用它 (pg_front.use_camera = true/false
)。