我是撰写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
答案 0 :(得分:2)
您是否尝试过使用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
)。