[SOLVED]set standard view
-
Ah, there are no scenes, so no scene tranistions.
Oh, and even simpler:
standardviews = %w(viewTop; viewBottom; viewFront; viewBack; viewRight; viewLeft viewIso;) standardviews.each do |view| Sketchup.send_action(view) # write image end
-
Thx Jim for the code update
ThomThom,
I've tried just to see if there was any diff. and there is none.
I also already tried to do active_view.refresh after each view switch but that doesn't help either.
In the API this is the explanation on send_action:
The send_action method sends a message to the message queue to perform some action asynchronously.I don't know if this could have something to do with it
Btw did you try the code?
Extra info, if you switch pages 'scenes) in the same loop all goes well.
-
Hm...
Tried setting the camera object itself instead of issuing the SU commands? -
I was thinking about that.
But I need the standard views attributes for that so i can use them in a camera definition.
I have not yet found a way to adress these standard views. (or i'm looking over it completely) -
@pout said:
But I need the standard views attributes for that so i can use them in a camera definition.
Attributes? Camera definitions? -
You mean how to set the camera vectors?
I'd think just setting the camera to match X_AXIS, YAXIS and Z_AXIS should be enough... ?
-
yes to 'copy' the standard cameras it would be great to be able to copy the eye, target and up of the standard cameras into new cameras so i can use those.
fact is i can't itterate over those standard cameras as shown above and i need the specific values of eye and target otherwise i need to calculate the center of the bounding box of all elements of the model to specify the eye and target.At the other hand, maybe i'm lacking any sense today (you wouldn't be the first to say that today )
-
And once you set the camera eye to target vector to suit an AXIS vector you need to use
Sketchup.send_action("viewZoomExtents:")
to see everything ??? -
The native standard view buttons doesn't zoom extent - but if that is what you want - then eye and target does not matter.
direction = Z_AXIS.reverse Sketchup.active_model.active_view.camera.set( ORIGIN, direction, direction.axes.y) Sketchup.active_model.active_view.zoom_extents
-
Overview of the code for each standard view (informative)
Top
direction = Z_AXIS.reverse Sketchup.active_model.active_view.camera.set( ORIGIN, direction, direction.axes.y) Sketchup.active_model.active_view.zoom_extents
Bottom
direction = Z_AXIS Sketchup.active_model.active_view.camera.set( ORIGIN, direction, direction.axes.y) Sketchup.active_model.active_view.zoom_extents
Front
direction = Y_AXIS Sketchup.active_model.active_view.camera.set( ORIGIN, direction, direction.axes.y) Sketchup.active_model.active_view.zoom_extents
Back
direction = Y_AXIS.reverse Sketchup.active_model.active_view.camera.set( ORIGIN, direction, direction.axes.y) Sketchup.active_model.active_view.zoom_extents
Left
direction=X_AXIS Sketchup.active_model.active_view.camera.set( ORIGIN, direction, direction.axes.y) Sketchup.active_model.active_view.zoom_extents
Right
direction=X_AXIS.reverse Sketchup.active_model.active_view.camera.set( ORIGIN, direction, direction.axes.y) Sketchup.active_model.active_view.zoom_extents
Iso
direction=Geom;;Vector3d.new -0.666667, 0.666667, -0.333333 Sketchup.active_model.active_view.camera.set( ORIGIN, direction, direction.axes.y) Sketchup.active_model.active_view.zoom_extents
This emulates the standard cameras, combined with zoom extents.
Credits to ThomThom!
Advertisement