sketchucation logo sketchucation
    • Login
    🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    Automating export of scenes

    Scheduled Pinned Locked Moved Developers' Forum
    6 Posts 3 Posters 462 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.
    • chrisglasierC Offline
      chrisglasier
      last edited by

      I had a look at this thread. As Allan wrote: "there has to be a better way?" Anyone know of one?

      The reason I need it is described here and here

      Thanks

      Chris

      With TBA interfaces we can analyse what is to be achieved so that IT can help with automation to achieve it.

      1 Reply Last reply Reply Quote 0
      • chrisglasierC Offline
        chrisglasier
        last edited by

        Thanks again TIG. I will try it out tomorrow as it's time for dinner hereabouts. Did you have a look at the post links? I would be interested to have your opinion on whether the ruby part is possible.

        Cheers

        Chris

        With TBA interfaces we can analyse what is to be achieved so that IT can help with automation to achieve it.

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

          Try something like this...

          def scenes2images()
            model=Sketchup.active_model
            view=model.active_view
            width=view.vpwidth.to_int
            height=view.vpheight.to_int
          ### you can change the width/height away from the default if you desire
            pages=model.pages
            pages_times=[]
            pages.each{|page|pages_times.push([page,page.transition_time])
              page.transition_time=0.0 }
          ### remembers pages' transition times and sets them all to 0
            filepath=File.dirname(model.path)+"\\" ### assumes model is saved
            0.upto(pages.count-1)do|images|
              ### this msgbox pauses and lets each view refresh and the image process...
              UI.messagebox("Exporting Image of Scene...")
              model.active_view.write_image("#{filepath+pages.selected_page.name}.jpg",width,height,true)
              Sketchup.send_action("pageNext;")
            end#loop
          ### reset pages' transition times
            pages_times.each{|array|array[0].transition_time=array[1]}
            UI.messagebox("Scenes' Image Exporting - Completed.")
          end#def
          
          

          save as scenes2images.rb and scenes2images in the ruby console to run it...

          TIG

          1 Reply Last reply Reply Quote 0
          • chrisglasierC Offline
            chrisglasier
            last edited by

            Thanks again TIG. Here's your code that I have altered a bit (in black) to be later made into a callback. Hope that's OK with you.

            My regards

            Chris

            ` def scenes2images()

            %(#000000)[# variables from js in webdialog
            subdir = "E:/Chiang Mai/Scenes jpg/"
            w = 800]

            model=Sketchup.active_model
            view=model.active_view
            
            width=view.vpwidth.to_int
            height=view.vpheight.to_int
            
            %(#000000)[width = w
            height = w/width*height]
            

            you can change the width/height away from the default if you desire

            pages=model.pages
            pages_times=[]
            pages.each{|page|pages_times.push([page,page.transition_time])
            page.transition_time=0.0 }
            

            remembers pages' transition times and sets them all to 0

            filepath=File.dirname(model.path)+"\" ### assumes model is saved

            ## changed to subdir variable - see above

            0.upto(pages.count-1)do|images|

            %(#000000)[# using 2 just for testing

            0.upto(2)do|images|]
            model.active_view.write_image("#{subdir+pages.selected_page.name}.jpg",width,height,true)
            Sketchup.send_action("pageNext:")

            %(#000000)[UI.messagebox("Exported "+pages.selected_page.name)]
            

            this msgbox pauses and lets each view refresh and the image process...

            %(#000000)[## changed position to get correct scene name

            considering change to question with OK/Skip/Cancel + new position]

            end#loop

            reset pages' transition times

            pages_times.each{|array|array[0].transition_time=array[1]}
            UI.messagebox("Scene Image Exporting - Completed.")
            end#def`

            With TBA interfaces we can analyse what is to be achieved so that IT can help with automation to achieve it.

            1 Reply Last reply Reply Quote 0
            • R Offline
              RickW
              last edited by

              SceneExporter and SceneExporterPro will do this as well.

              RickW
              [www.smustard.com](http://www.smustard.com)

              1 Reply Last reply Reply Quote 0
              • chrisglasierC Offline
                chrisglasier
                last edited by

                @rickw said:

                SceneExporter and SceneExporterPro will do this as well.

                Very thoughtful and generous, thanks.

                You may be interested in seeing how this relates to my templates query

                Chris

                With TBA interfaces we can analyse what is to be achieved so that IT can help with automation to achieve it.

                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