Perspective camera view in SketchUp using Ruby


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"

Perspective View :

My Need:
Perspective 2

If anyone has any solutions please help me.

Siva S

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

have you looked at rotating the camera around the geometry?

cam =
current_eye = cam.eye
current_up = cam.up
current_target =

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

up = current_up

target = current_target

my_camera = eye, target, Z_AXIS

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

you could manipulate the target for desired result…


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