Perspective camera view in SketchUp using Ruby

Hi,

I want to set opposite perspective camera view in SketchUp with ruby. Here my code is

@minilion_instance = instance
distance = 1.5
pers = getViewFromSide("xy",distance,instance)
pers2 = getViewFromSide("-xy",distance,instance)

axeDeTransformation1 = instance.transformation.xaxis
axeDeTransformation2 = instance.transformation.yaxis
axeDeTransformation = axeDeTransformation1 + axeDeTransformation2
distance = bounds.width * distance

vector = axeDeTransformation.clone
vector.length = distance
if axe[0..0] == "-" || axe == "xy"
  vector.reverse!
end

Perspective View :

My Need:
Perspective 2

If anyone has any solutions please help me.

Thanks,
Siva S

your pseudo code looks like your thinking of rotating the geometry…

have you looked at rotating the camera around the geometry?

cam = Sketchup.active_model.active_view.camera
current_eye = cam.eye
current_up = cam.up
current_target = cam.target

# toggle between
eye = - current_eye[0], - current_eye[1], current_eye[2]

up = current_up

target = current_target

my_camera = Sketchup::Camera.new eye, target, Z_AXIS

# Get a handle to the current view and change its camera.
view = Sketchup.active_model.active_view
view.camera = my_camera

you could manipulate the target for desired result…

john

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.