sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    [SOLVED]set standard view

    Scheduled Pinned Locked Moved Developers' Forum
    15 Posts 4 Posters 800 Views 4 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J Offline
      Jim
      last edited by

      Not 100% sure, but...

      What is the Scene transition time set to? Either set it to 0, or wait for the Scene animation to finish before writing the image.

      Hi

      1 Reply Last reply Reply Quote 0
      • P Offline
        Pout
        last edited by

        ThomThom:
        no, but i'll give it a shot

        Jim:
        scene transitions are off

        1 Reply Last reply Reply Quote 0
        • thomthomT Offline
          thomthom
          last edited by

          @pout said:

          ThomThom:
          no, but i'll give it a shot

          No - I was thinking that might be why it didn't work.

          Maybe you can use view.refresh ?

          Thomas Thomassen β€” SketchUp Monkey & Coding addict
          List of my plugins and link to the CookieWare fund

          1 Reply Last reply Reply Quote 0
          • J Offline
            Jim
            last edited by

            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
            
            

            Hi

            1 Reply Last reply Reply Quote 0
            • P Offline
              Pout
              last edited by

              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.

              1 Reply Last reply Reply Quote 0
              • thomthomT Offline
                thomthom
                last edited by

                Hm...
                Tried setting the camera object itself instead of issuing the SU commands?

                Thomas Thomassen β€” SketchUp Monkey & Coding addict
                List of my plugins and link to the CookieWare fund

                1 Reply Last reply Reply Quote 0
                • P Offline
                  Pout
                  last edited by

                  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)

                  1 Reply Last reply Reply Quote 0
                  • thomthomT Offline
                    thomthom
                    last edited by

                    @pout said:

                    But I need the standard views attributes for that so i can use them in a camera definition.

                    ❓
                    Attributes? Camera definitions?

                    Thomas Thomassen β€” SketchUp Monkey & Coding addict
                    List of my plugins and link to the CookieWare fund

                    1 Reply Last reply Reply Quote 0
                    • thomthomT Offline
                      thomthom
                      last edited by

                      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... ?

                      Thomas Thomassen β€” SketchUp Monkey & Coding addict
                      List of my plugins and link to the CookieWare fund

                      1 Reply Last reply Reply Quote 0
                      • P Offline
                        Pout
                        last edited by

                        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 πŸ˜„)

                        1 Reply Last reply Reply Quote 0
                        • TIGT Offline
                          TIG Moderator
                          last edited by

                          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 ???

                          TIG

                          1 Reply Last reply Reply Quote 0
                          • thomthomT Offline
                            thomthom
                            last edited by

                            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

                            Thomas Thomassen β€” SketchUp Monkey & Coding addict
                            List of my plugins and link to the CookieWare fund

                            1 Reply Last reply Reply Quote 0
                            • P Offline
                              Pout
                              last edited by

                              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!

                              1 Reply Last reply Reply Quote 0
                              • 1 / 1
                              • First post
                                Last post
                              Buy SketchPlus
                              Buy SUbD
                              Buy WrapR
                              Buy eBook
                              Buy Modelur
                              Buy Vertex Tools
                              Buy SketchCuisine
                              Buy FormFonts

                              Advertisement