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

    Sketchup Web Exporter

    Scheduled Pinned Locked Moved Developers' Forum
    26 Posts 10 Posters 3.7k Views 10 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.
    • P Offline
      Phil Rader AIA
      last edited by

      see my post here:

      301 Moved Permanently

      favicon

      (www.sketchucation.com)

      http://www.philrader.com

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

        I do have exact the same issue and when I added the code it works fine. thank you for the code.

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

          I'm experiencing the same problem as depicted in Phil Rader's video.
          Adding this line of code did not work but it did change the behavior slightly.

          After adding Jim's line of code instead of zooming out as soon as the SWE window opens it now zooms out as soon as I click the "CREATE" button.

          Are there modifications to that line of code that will make it not zoom to extents?
          Something like: .zoom_extents_NO

          thanks
          Dave

          @jim said:

          Phil,

          First thought would be to add this line after line 822 in Plugins/swivelButtonPlugin/swivelButton.rb

          
          > Sketchup.active_model.active_view.zoom_extents
          
          1 Reply Last reply Reply Quote 0
          • R Offline
            richhinton
            last edited by

            Adding the code above to line 822 of swivelButton.rb fixes the preview image:

            Sketchup.active_model.active_view.zoom_extents
            

            Then modify line 572 of swivelButton.rb from:

              standoff_distance = getStandoffDistance() * 1.1;
            

            to

              standoff_distance = targetNow.distance eyeNow
            

            Add the following line above line 583 so you end up with:

              standoff_eyepoint = eyeNow;
              centerpoint.z = standoff_eyepoint.z;
            

            Comment out lines 656 to 663:

            # 	bb=Sketchup.active_model.bounds
            # pmax = bb.max
            #	pmin = bb.min
            #	zdiff = bb.max[2]-bb.min[2]
            #	pcenter = bb.center
            #	targetNow = pcenter
            #	up = Geom;;Vector3d.new(0.0,0.0,1.3*zdiff)
            #	upTarget = pcenter + up
            

            The code before tried to fit the entire model into the view by getting the bounding box of the active model and drawing a circle around it, then panning the camera around that circle.

            My fix, simply draws a circle around the model from the current cameras position and then pans around that circle. 😄

            1 Reply Last reply Reply Quote 0
            • tridemT Offline
              tridem
              last edited by

              Hi, I also would like the web exporter didn't zoom to extents the model, I was trying to change the script but seems the line reference of richhinton are wrong 😞 anyone had success with it? can you share the whole modified .rb file?

              1 Reply Last reply Reply Quote 0
              • GaieusG Offline
                Gaieus
                last edited by

                Hi Luca,

                What if you draw a big sphere all around the model (so it fits inside all extent) and paint this sphere with a completely transparent png file (and also make it cast no shadow at all)? This could fool the script (hopefully) as it would always zoom extents of the surrounding sphere (which would be an even zooming of course).

                Here is a model whose scene animation I made the same way (so not exactly the same case but similar solution). I then deleted the sphere (there - as the scenes will retain the camera position - obviously you should not delete your sphere).
                http://sketchup.google.com/3dwarehouse/details?mid=ed6358317ca6c63cf316679995e7e4d8

                Gai...

                1 Reply Last reply Reply Quote 0
                • tridemT Offline
                  tridem
                  last edited by

                  Thanks Gai, but I've the opposite problem 😞
                  senza titolo1.jpg

                  1 Reply Last reply Reply Quote 0
                  • GaieusG Offline
                    Gaieus
                    last edited by

                    Is there anything else in that model? Anything on a hidden layer? Also, where is the origin?

                    Sorry but I have never used this plugin so I am not sure how to trouble shoot it - especially with scripting. I can only approach these things from some practical, SU related point of view.

                    Gai...

                    1 Reply Last reply Reply Quote 0
                    • tridemT Offline
                      tridem
                      last edited by

                      No, there are no other objects and it's centered with the origin, the fact is that the plugin forces a resize to fit the scene (that could be a reasonable choice to show your model) but I'd prefer to keep the current view because I want to show only the central part of the scene 😕

                      1 Reply Last reply Reply Quote 0
                      • GaieusG Offline
                        Gaieus
                        last edited by

                        And what if you make the images this way - just big resolution export enough - and crop them to get what you want?

                        (Sorry gain that I can only offer these lame workarounds as I know as much about ruby scripting as about woodworking)

                        Gai...

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

                          The swivelButton.rb code is set to zoom extents and then x1.1 so there's some white space around the object etc

                          <span class="syntaxdefault">def SwivelButton</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">zoomInitial</span><span class="syntaxkeyword">()<br /></span><span class="syntaxdefault">  Sketchup</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">active_model</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">active_view</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">zoom_extents<br />  eyeNow    </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> Sketchup</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">active_model</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">active_view</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">camera</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">eye<br />  targetNow </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> Sketchup</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">active_model</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">active_view</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">camera</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">target<br />  upvec     </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> Sketchup</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">active_model</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">active_view</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">camera</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">up<br />  </span><span class="syntaxcomment"># draw the circle at our elevation (z coord)<br /></span><span class="syntaxdefault">  bb </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> Sketchup</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">active_model</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">bounds</span><span class="syntaxkeyword">;<br /></span><span class="syntaxdefault">  bbcenter </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> bb</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">center</span><span class="syntaxkeyword">;<br /></span><span class="syntaxdefault">  <br />  centerpoint </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> targetNow</span><span class="syntaxkeyword">;<br /><br /></span><span class="syntaxdefault">  viewvec </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> eyeNow </span><span class="syntaxkeyword">-</span><span class="syntaxdefault"> targetNow<br />  unitviewvec </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> viewvec</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">normalize</span><span class="syntaxkeyword">;<br /><br /></span><span class="syntaxdefault">  </span><span class="syntaxcomment"># add a boundary by backing up a bit more,<br /></span><span class="syntaxdefault">  standoff_distance </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> getStandoffDistance</span><span class="syntaxkeyword">()</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">*</span><span class="syntaxdefault"> 1.1</span><span class="syntaxkeyword">;</span><span class="syntaxdefault">  <br />  <br />  </span><span class="syntaxcomment"># the eye will lie along the current view line so it is <br /></span><span class="syntaxdefault">  </span><span class="syntaxcomment"># standoff_distance away from the target<br /></span><span class="syntaxdefault">  standoff_vec </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> unitviewvec</span><span class="syntaxkeyword">;<br /></span><span class="syntaxdefault">  standoff_vec</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">length </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> standoff_distance</span><span class="syntaxkeyword">;<br /></span><span class="syntaxdefault">  standoff_eyepoint </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> bbcenter </span><span class="syntaxkeyword">+</span><span class="syntaxdefault"> standoff_vec</span><span class="syntaxkeyword">;<br /><br /></span><span class="syntaxdefault">  c </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> Sketchup</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">Camera</span><span class="syntaxkeyword">.new<br /></span><span class="syntaxdefault">  <br />  c</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">set</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">standoff_eyepoint</span><span class="syntaxkeyword">,</span><span class="syntaxdefault">bbcenter</span><span class="syntaxkeyword">,</span><span class="syntaxdefault">upvec</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault">  </span><span class="syntaxcomment"># now stick this camera on our view<br /></span><span class="syntaxdefault">  Sketchup</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">active_model</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">active_view</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">camera </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> c<br />end</span>
                          

                          You can modify this method thus

                          <span class="syntaxdefault">def SwivelButton</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">zoomInitial</span><span class="syntaxkeyword">()<br /></span><span class="syntaxdefault">  </span><span class="syntaxcomment">###Sketchup.active_model.active_view.zoom_extents<br /></span><span class="syntaxdefault">  eyeNow    </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> Sketchup</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">active_model</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">active_view</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">camera</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">eye<br />  targetNow </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> ORIGIN </span><span class="syntaxcomment">###Sketchup.active_model.active_view.camera.target<br /></span><span class="syntaxdefault">  upvec     </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> Sketchup</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">active_model</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">active_view</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">camera</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">up<br />  </span><span class="syntaxcomment"># draw the circle at our elevation (z coord)<br /></span><span class="syntaxdefault">  </span><span class="syntaxcomment">###bb = Sketchup.active_model.bounds;<br /></span><span class="syntaxdefault">  </span><span class="syntaxcomment">###bbcenter = bb.center;<br /></span><span class="syntaxdefault">  <br />  </span><span class="syntaxcomment">###centerpoint = targetNow;<br /><br /></span><span class="syntaxdefault">  </span><span class="syntaxcomment">###viewvec = eyeNow - targetNow<br /></span><span class="syntaxdefault">  </span><span class="syntaxcomment">###unitviewvec = viewvec.normalize;<br /><br /></span><span class="syntaxdefault">  </span><span class="syntaxcomment"># add a boundary by backing up a bit more,<br /></span><span class="syntaxdefault">  </span><span class="syntaxcomment">###standoff_distance = getStandoffDistance() * 1.1;  <br /></span><span class="syntaxdefault">  <br />  </span><span class="syntaxcomment"># the eye will lie along the current view line so it is <br /></span><span class="syntaxdefault">  </span><span class="syntaxcomment"># standoff_distance away from the target<br /></span><span class="syntaxdefault">  </span><span class="syntaxcomment">###standoff_vec = unitviewvec;<br /></span><span class="syntaxdefault">  </span><span class="syntaxcomment">###standoff_vec.length = standoff_distance;<br /></span><span class="syntaxdefault">  </span><span class="syntaxcomment">###standoff_eyepoint = eyeNow ###bbcenter + standoff_vec;<br /><br /></span><span class="syntaxdefault">  c </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> Sketchup</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">Camera</span><span class="syntaxkeyword">.new<br /></span><span class="syntaxdefault">  <br />  c</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">set</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">eyeNow</span><span class="syntaxkeyword">,</span><span class="syntaxdefault">targetNow</span><span class="syntaxkeyword">,</span><span class="syntaxdefault">upvec</span><span class="syntaxkeyword">)</span><span class="syntaxcomment">###c.set(standoff_eyepoint,bbcenter,upvec)<br /></span><span class="syntaxdefault">  </span><span class="syntaxcomment"># now stick this camera on our view<br /></span><span class="syntaxdefault">  Sketchup</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">active_model</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">active_view</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">camera </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> c<br />end</span>
                          

                          This sets the target as the ORIGIN, keeps the current 'eye' and adds NO white space.
                          Untried... but you can see where it's going...

                          TIG

                          1 Reply Last reply Reply Quote 0
                          • tridemT Offline
                            tridem
                            last edited by

                            😞 no, it seems this affects only the preview...then, when hit "create" it still zooms out to fit the scene. I believe you should modify the way it creates a circle which is the base of cameras path. As I understood, it takes the dimensions of the model's bounding box to compute how far the camera is from the model and the radius of that construction circle...maybe could be enough using the bounding box of a selection instead of the entire model and all other methods follow... maybe! I'm not able to read and understand a script 😳

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

                              OK...
                              That's because I only showed how to correct the start frame...
                              To change the rest of the frames there's more stuff to change...
                              This is a dirty hack leaving lots of things making arrays etc that are then not used!
                              Change line #634 to read something like
                              pt=Sketchup.active_model.active_view.camera.eye;up=Sketchup.active_model.active_view.camera.up;tr=Geom::Transformation.rotation(ORIGIN,up,360.degrees/numseg);pnts=[pt];numseg-1.times{pnts<<pt.transform!(tr);};return pnts
                              [NB: This is untested]...
                              The whole thing could be rewritten a lot simpler to allow the user to determine the extents of the view etc... My nudgeOrbit.rb could be the basis of this as that simply rotates the camera around the target by given angular increments... You then combine that camera with exporting the image...

                              TIG

                              1 Reply Last reply Reply Quote 0
                              • D Offline
                                driven
                                last edited by

                                Anyone still interested in this?

                                low res gif ...NEED to Open in new tab, not continuous on Safari...
                                I've been hacking the code for use on mac and worked out the bits needed to change the default zooming

                                the gif is b+w and jumpy [down-sized for upload to the forum], but shows the base disc is filling the frame.

                                The web animation is smooth and full color, but we can't post those here...
                                I'll put some test up elsewhere if anyone wants.

                                I need to figure out a couple more things but those bits should work on PC's, if anyones interested.

                                john

                                learn from the mistakes of others, you may not live long enough to make them all yourself...

                                1 Reply Last reply Reply Quote 0
                                • Rich O BrienR Offline
                                  Rich O Brien Moderator
                                  last edited by

                                  That .gif animates once then stops. Can you upload one that runs 'forever'?

                                  It is of interest though 👍

                                  Download the free D'oh Book for SketchUp 📖

                                  1 Reply Last reply Reply Quote 0
                                  • D Offline
                                    driven
                                    last edited by

                                    rich,

                                    how big a file can I upload? and have you ever made gifs with 'image magicks' it seems to redistridute 0-9 amongst the others...

                                    learn from the mistakes of others, you may not live long enough to make them all yourself...

                                    1 Reply Last reply Reply Quote 0
                                    • Rich O BrienR Offline
                                      Rich O Brien Moderator
                                      last edited by

                                      4mb.... i think?

                                      I use PS for animated gif so i know it gives good control over file sizes. The thing with your gif is that members may miss the animation element if they read later/earlier posts. Still pretty neat output though.

                                      Download the free D'oh Book for SketchUp 📖

                                      1 Reply Last reply Reply Quote 0
                                      • D Offline
                                        driven
                                        last edited by

                                        you can get them straight out of SU, but the settings are a bit of a learning curve.... will repost when I work it out.

                                        learn from the mistakes of others, you may not live long enough to make them all yourself...

                                        1 Reply Last reply Reply Quote 0
                                        • Rich O BrienR Offline
                                          Rich O Brien Moderator
                                          last edited by

                                          No image?

                                          Download the free D'oh Book for SketchUp 📖

                                          1 Reply Last reply Reply Quote 0
                                          • D Offline
                                            driven
                                            last edited by

                                            test....no.11
                                            convert -set -delay 400 -colorspace rgb -ordered-dither o8x8,8,8,4 -dispose 1 -depth 8 -loop 0 -scale 100% *.jpg macHack14.gif

                                            very grainy as big gif, but getting better

                                            manually reordered the sequence, runs fine from file,

                                            point is do you want to 'fix' the PC version... to not zoom out.

                                            learn from the mistakes of others, you may not live long enough to make them all yourself...

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

                                            Advertisement