sketchucation logo sketchucation
    • Login
    โ„น๏ธ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Julia Eneroth's Viewport Resizer / SketchUp 2023

    Scheduled Pinned Locked Moved Solved Extensions & Applications Discussions
    20 Posts 6 Posters 357 Views 6 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.
    • F Offline
      faust07
      last edited by

      If that helps: a plugin for easily exporting SketchUp images, as shown in the viewport but with free input of height, width, format and compression.
      Originally modified for a smooth scene animation to coincide with the Skindigo AnimationExport (Indigo Render Animation).
      Here reduced to a SketchUp single image output with input of image parameters.
      Transfer the code to an rb file called Single_Image_Export.rb and copy it to the plugin folder of the respective SUp version (tested up to SUp2022).
      Restart SketchUp ....

      # Formerly Created by Dale Martens AKA 'Whaat' as "Smoothstep Animation"
      # Released 6 Oct 2008 As-is and without warranty of any kind.
      # Originally modified by faust07 for a smooth scene animation to coincide with the Skindigo AnimationExport (Indigo Render Animation).
      # Here reduced to a SketchUp single image export with input of image parameters.
      # Modified by faust07 (AT) 2024-03-25
      
      require 'sketchup.rb'
      
      if( not file_loaded?("Single_Image_Export.rb") )
      	menu=UI.menu("Plugins")
      	menu.add_separator
      	menu.add_item("Export Single Image") {(SingleImageExport.new(true))}
      end
      
      file_loaded("Single_Image_Export.rb")
      
      class SingleImageExport
      
      def initialize(export)   # export should be true or false
      
      if export			# Inputs
      	prompts = ["Width","Height","Format","Compression"]  
      	values = ["1920","1080","JPG","1.0"]
      	format_choices = "JPG|PNG"
      	enums = [nil,nil,format_choices,nil]
      	results = UI.inputbox(prompts,values,enums,"Export Options")
      	if results
      		@width = results[0].to_i
      		@height = results[1].to_i
      		@format = results[2]
      		@comp = results[3].to_f
      		if @comp < 0.1 or @comp > 1.0
      			UI.messagebox("Compression must be between 0.1 and 1.0")
      			@export = false
      			return
      		end
      		def_filename = "SU."+@format.downcase
      		path = UI.savepanel "Export Frame","",def_filename
      		if path
      			@export_path = File.dirname(path)
      			@filename = File.basename(path,".*")   # remove the file extension
      		end
      	end
      end
      
      # single image export
      @image_path = File.join(@export_path,@filename + ".#{@format.downcase}")
      Sketchup.set_status_text("Exporting Frame to #{@image_path}")
      Sketchup.active_model.active_view.write_image(@image_path, @width, @height, true, @comp)
      
      end 	# end def initialize(export) 
      
      end # class
      
      1 Reply Last reply Reply Quote 1
      • Rich O BrienR Offline
        Rich O Brien Moderator @HornOxx
        last edited by

        @HornOxx said in Julia Eneroth's Viewport Resizer / SketchUp 2023:

        of course doesn't lead to the desired result on the basis of my SkUp setup

        You can just press CTRL+F10 to set it to 'My Square' and then use File > Export >2D Graphic. In the option box if you click Use View Size you will see what the image dimension is for you.

        Then adjust line 24 values accordingly to get you to 600px. Not the most elegant approach.

        I think the better approach would be to ask Fredo if his Screenshot tool in Fredo Portrait could be extended to handle this. It already has ratio based selecting.

        Download the free D'oh Book for SketchUp ๐Ÿ“–

        HornOxxH 1 Reply Last reply Reply Quote 1
        • HornOxxH Offline
          HornOxx @Rich O Brien
          last edited by

          ...Rich, I will definitely try your approach (first) to get a better understanding of what is going on between your script and the result "in front" since all that is pretty new to me and then continue by trying to tweak the script here and there to find out which are the right "lines" and values which are necessary - what an exciting thing and refreshing to learn always on top of that.
          1000 times thanks for guiding me this far. And if Tig contributes from his almost inexhaustible fundus of knowledge, this is always and everywhere welcome in any case!!!!! โค๏ธ

          @Faust07
          Hi and as always I am very happy to hear from You and when I look around in this fantastic group of people here I ask myself "where on earth did I go to school and was it worth it all these years" ๐Ÿ˜ ๐Ÿ™„ ๐Ÿ˜€
          Yor Script worked out of the Box and and delivered the result I need for my/our workflow.
          I rendered a hiddenline (1920 x 1080) from SketchUp and did the same with the view synchronised Enscape, also in 1920 x 1080. Both graphic components fit together exactly. This means that I can also use the functional renderings from Enscape, such as Material-ID or Depth-mask etc. without any time-consuming fiddling in Photoshop and it also means that every other machine in my team reproduces exactly the same "picture"-result.
          So, thank you too for dealing with my topic and for providing a working script on top of that! โค๏ธ
          3040e6eb-7d53-4a0b-a630-59133d9574f3-image.png

          (๐Ÿ˜‚ Which schools did you all attend?)

          never trust a skinny cook

          1 Reply Last reply Reply Quote 0
          • F Offline
            faust07
            last edited by

            I'm glad this helps.
            I find it a shame that the SkerchUp programmers have not yet considered it necessary to implement a precisely definable image export, even though the basic functions are available in Rubi.
            Regarding school: "Hochschule fรผr Architektur- und Bauwesen Weimar" today "Bauhaus Universitรคt" - we punched out punched cards and handed them over to the computer center (short time after Konrad Zuse...) ๐Ÿ˜‰
            I learned most of Rubi from AntonS for scripting in MSPhysics and from customizing simple plugins for my own purposes. It's enough for small things...

            HornOxxH 1 Reply Last reply Reply Quote 1
            • HornOxxH Offline
              HornOxx @faust07
              last edited by

              TH Darmstadt / Architektur, and a completely digital-free education back then (not even Zuse) ๐Ÿ˜‰ This (CAD) topic then came over me very intensively in my first year of work, but thankfully in a company that provided very good training...

              Yes, I agree with you that this issue discussed here has been a flaw since the beginning and yes, it also annoys me that Sketchup never fixed this flaw.

              Again to your script and for information for everyone participating here - in the meantime I played through at least 10 scenarios (a: because this topic is so important to me and b: because I have to simulate the output of my many colleagues and our cross-workplace collaboration) and in all these scenarios your script consistently delivered the same and good output results! Prima! I even included the downstream render output in this test, with excellent results as well.
              Again, Thanks! to All!!

              I'm definitely going to deal with the scripting topic - because that's the only key to solving problems like this!
              faust 07.jpg

              never trust a skinny cook

              HornOxxH 1 Reply Last reply Reply Quote 1
              • Rich O BrienR Rich O Brien has marked this topic as solved on
              • HornOxxH Offline
                HornOxx @HornOxx
                last edited by HornOxx

                Hi all - apparently there is a solution to my (for you surely annoying) viewport export dilemma, and that is by using Sketchup's own onboard tools:
                Instead of using the classic 2D export you can use the animation export instead. There you do not export a video file but individual frames, for example as png or jpg with the setting 1 frame per second.
                There you can set a viewport-independent export resolution. I have tested this under all possible settings and various viewport modifications, I always get identical export image results, and these even fit together with a downstream renderer (e.g. Enscape) provided the renderer is set to Sketup's viewport synchronisation.
                0036f8a0-bd1f-4375-8acd-a988d30d02be-image.png
                I wouldn't have come up with this obvious solution if Eric M Sargeant hadn't posted his video Batch Exporting Scenes and Styles
                Batch Exporting Scenes and Styles
                So thanks to Eric M Sergeant and all of you here ๐Ÿ˜‰

                never trust a skinny cook

                1 Reply Last reply Reply Quote 1
                • F Offline
                  Firdaus_KL Newcomers @Rich O Brien
                  last edited by

                  @Rich-O-Brien Hi sir. Really appreciate your help. Can I know how to get window stats to create more preset? I see in the script it state "+F8" and when I press those keys, nothing happen. Sorry Im a bit noob in this script-things.

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

                    @Firdaus_KL said in Julia Eneroth's Viewport Resizer / SketchUp 2023:

                    Can I know how to get window stats to create more preset?

                    Windows Stats is to report the current dimensions of the active window. Pressing CTRL+SHIFT+F8 will open a dialog with the dimensions of the window.

                    SketchUp_aOBgEIgmpd.png

                    To create a new preset you would need to add a line with your preferred dimensions after line 27

                    ^F6::ResizeWin(1301,524) ; Ctrl+F6 
                    

                    Download the free D'oh Book for SketchUp ๐Ÿ“–

                    1 Reply Last reply Reply Quote 0
                    • F Offline
                      FlorinAp
                      last edited by

                      MC Vie Size still works, tested and use it every day in SU23 and 24, the catch is it has a difference in pixels (which is constant) that you have to remember, for example in SU23 you have to type minus 2 pixels for horizontal and minus 32 pixels for vertical, and after that you will see the correct and intended dimensions of viewport in the measurements field.
                      Eneroth is the same, but I don't remember why, I concluded that MC View Size is better...

                      1 Reply Last reply Reply Quote 0
                      • F Offline
                        FlorinAp
                        last edited by

                        Anyway, the best export tool I've found so far is S4U export Scene with complete control over everything - resolution, select the scenes as you please, auto transfer the names of the scenes...

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

                          @FlorinAp
                          I love this
                          https://sketchucation.com/pluginstore?pln=ViewportBuster

                          Download the free D'oh Book for SketchUp ๐Ÿ“–

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

                          Advertisement