sketchucation logo sketchucation
    • Login
    πŸ€‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    Export selection as jpg?

    Scheduled Pinned Locked Moved Plugins
    6 Posts 3 Posters 448 Views 3 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.
    • john2J Offline
      john2
      last edited by

      Is there a plugin that enables me to export a selection as jpg image?

      Sketchup Make 2017 (64-bit), Vray 4.0 , Windows 10 – 64 bit, corei7-8750H, 16GB RAM, Nvidia GeForce GTX 1050Ti 4GB

      1 Reply Last reply Reply Quote 0
      • sdmitchS Offline
        sdmitch
        last edited by

        @john2 said:

        Is there a plugin that enables me to export a selection as jpg image?

        This should do it.

        mod = Sketchup.active_model
        ent = mod.active_entities
        sel = mod.selection
        vue = mod.active_view
        ent.each{|e| sel.toggle e}
        tmp = sel.to_a;sel.clear
        tmp.each{|e| e.hidden=true}
        vue.zoom_extents
        vue.write_image "test.jpg"
        tmp.each{|e| e.hidden=false}
        vue.zoom_extents
        
        

        Nothing is worthless, it can always be used as a bad example.

        http://sdmitch.blogspot.com/

        1 Reply Last reply Reply Quote 0
        • john2J Offline
          john2
          last edited by

          Plugin ruby file.. How can I make from this?

          Sent from my IQ 446 using Tapatalk

          Sketchup Make 2017 (64-bit), Vray 4.0 , Windows 10 – 64 bit, corei7-8750H, 16GB RAM, Nvidia GeForce GTX 1050Ti 4GB

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

            @john2 said:

            Plugin ruby file.. How can I make from this?
            You don't need to.
            Just copy+paste all of those lines in one go, into the Ruby Console + <enter>
            On MACs or PCs using at least v2014 multi-line entries are allowed.

            TIG

            1 Reply Last reply Reply Quote 0
            • sdmitchS Offline
              sdmitch
              last edited by

              @john2 said:

              Plugin ruby file.. How can I make from this?

              Sent from my IQ 446 using Tapatalk

              As simply as wrapping it in a def and end statement and copying it to the Plugins folder. Hiding/un-hiding can be a little slow.

              module SDM
               def self.expsel2jpg
                mod = Sketchup.active_model
                ent = mod.active_entities
                sel = mod.selection
                vue = mod.active_view
                @name ||= "expsel2.jpg"
                inp=UI.inputbox(["Image Name;"],[@name],"Export Selection to jpg")
                if inp
                 @name=inp[0];@name += ".jpg" if File.extname(@name)==""
                 Sketchup.set_status_text "Toggling the selection";vue.refresh
                 ent.each{|e| sel.toggle e}
                 tmp = sel.to_a;sel.clear
                 Sketchup.set_status_text "Hiding non-selected";vue.refresh
                 tmp.each{|e| e.hidden=true}
                 vue.zoom_extents
                 vue.write_image @name
                 Sketchup.set_status_text "Un-hiding non-selected";vue.refresh
                 tmp.each{|e| e.hidden=false}
                 vue.zoom_extents
                end
               end
              end
              UI.menu("Plugins").add_item("Export Selection to jpg"){SDM.expsel2jpg}
              
              

              Nothing is worthless, it can always be used as a bad example.

              http://sdmitch.blogspot.com/

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

                Not forgetting... that the file you add into the Plugins folder, must be called something like " SDM-expsel2jpg**.rb**" - in order for it to auto-load as SketchUp starts... AND also, equally importantly, it must be encoded as " UTF-8_without_BOM".
                On a PC - Notepad.exe will NOT do this - it will be encoded as ANSI, this will break SketchUp >v8 !
                But if you have a free tool installed like Notepad++.exe - then that will either encode its as you need [depending on the app's settings], OR you can at least change the file's encoding to suit using menu items.
                On a Mac, TextEdit/ TextWrangler should pre-encode the file as you need...

                TIG

                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