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

    [Plugin] Camera Settings Export/Import

    Scheduled Pinned Locked Moved Plugins
    33 Posts 21 Posters 48.3k Views 20 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.
    • thomthomT Offline
      thomthom
      last edited by

      Btw - to avoid potential clashes with other plugins it's best to wrap everything into a module. otherwise you're adding methods inthe global namespace which affects all other plugins.
      See more notes about avoiding clashes with other plugins in this article: http://www.thomthom.net/thoughts/2012/01/golden-rules-of-sketchup-plugin-development/

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

      1 Reply Last reply Reply Quote 0
      • A Offline
        Aerilius
        last edited by

        In addition to using a module, avoid any hard-coded file paths:
        %(#000000)[D:\SU_camera_export.txt] does most likely not exist.
        An alternative is to use environment variables ( %(#000000)[ENV["TEMP"]||(ENV["TMP"]]; %(#000000)[ENV["USERPROFILE"]||ENV["HOME"]]) to get a default path or to ask the user directly for a path.
        Example:
        mypath = [UI.savepanel](https://developers.google.com/sketchup/docs/ourdoc/ui#openpanel)("Save the camera settings") return if mypath.nil? mypath = [File.expand_path](http://www.ruby-doc.org/core-1.8.6/File.html#method-c-expand_path)(mypath) myfile = File.new(mypath, "w")

        ...

        UI.messagebox exported_cams.to_s + " Cameras were successfully exported to #{mypath}"

        Lastly file_loaded?("camera_export_import.rb") does not look up a file path but just an arbitrary string. That means after the file has loaded, we have to tell it SketchUp at the end of the file by using the same string: file_loaded("camera_export_import.rb")

        Otherwise it looks good for the first script! πŸ‘ We are always happy if people accomplish the first step . Once you're infected by Ruby, you can not get away from it.

        1 Reply Last reply Reply Quote 0
        • C Offline
          careca
          last edited by

          hi Aerilius, thomthom, all.

          thanks for the feedback, i have updated the script accordingly and replaced it in my original post.

          regards,
          martin

          p.s. advanced camera tools would be great - maybe you can convince our sysadmins to install it for us πŸ˜‰

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

            @careca said:

            p.s. advanced camera tools would be great - maybe you can convince our sysadmins to install it for us πŸ˜‰

            Should be bundled with SketchUp 8... Maybe you need to enable it under you list of Extensions?

            Anyway - looking forward to seeing more plugin creations! πŸ˜„

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

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

              Could you add support for hidden geometry, visible layers, style and shadows please?

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

                Is that a pro tool only? Not in my free 8.
                Not in Ext. list either

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

                  @jpalm32 said:

                  Is that a pro tool only? Not in my free 8.
                  Not in Ext. list either

                  Ah! Now that's a good point! Could very well be a Pro feature. Didn't think of that. 😳

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

                  1 Reply Last reply Reply Quote 0
                  • C Offline
                    careca
                    last edited by

                    @unknownuser said:

                    Re: [Plugin] Camera Settings Export/Import

                    Postby rv1974 on Wed Aug 29, 2012 11:36 am
                    Could you add support for hidden geometry, visible layers, style and shadows please?

                    thanks for your comment - but to be honest, this was not the intention of this plugin, I only wanted to transfer camera settings between files. going into "hidden geometry, visible layers, style and shadows" will require to write a script for transferring complete scenes/pages, a completely different approach...

                    martin

                    1 Reply Last reply Reply Quote 0
                    • C Offline
                      careca
                      last edited by

                      "...with Maintenance 2 release, ACT installs with SketchUp 8.

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

                        @careca said:

                        "...with Maintenance 2 release, ACT installs with SketchUp 8.

                        Not free version! Unless I'm getting a missing module.

                        1 Reply Last reply Reply Quote 0
                        • M Offline
                          mirale999
                          last edited by

                          Great plugin~ I was worrying how to compare two designs the very last minute~

                          paranoia is a higher form of awareness...

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

                            Works exactly as advertised,thank you.

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

                              ACT is a Pro-only add-on...
                              Just like LayOut, Solid tools, some Exporters/Importers etc...

                              TIG

                              1 Reply Last reply Reply Quote 0
                              • G Offline
                                grasset17
                                last edited by

                                Merci beaucoup pour ce script qui fonctionne Γ  merveille

                                1 Reply Last reply Reply Quote 0
                                • Q Offline
                                  qazokm
                                  last edited by

                                  Finally I found it, thanks

                                  1 Reply Last reply Reply Quote 0
                                  • lsztukaL Offline
                                    lsztuka
                                    last edited by

                                    I have the same problem with going back to older designs often. The script does what it should in a fast and simple way. It helped me a lot! Thanks!

                                    1 Reply Last reply Reply Quote 0
                                    • OxerO Offline
                                      Oxer
                                      last edited by

                                      Thanks you very much!! πŸ‘
                                      Very useful for a project that I'm working on.

                                      "The result is the end what is important is the process" by Oxer
                                      [http://www.oxervision.blogspot.com/(http://www.oxervision.blogspot.com/)]

                                      1 Reply Last reply Reply Quote 0
                                      • halroachH Offline
                                        halroach
                                        last edited by

                                        Would it be possible to export/import also shadow settings and layer visibility along with the camera scenes?
                                        Basically exporting/importing whole scenes, and not just the cameras?

                                        FlexTools - Super Quick Windows, Doors, Slats...

                                        1 Reply Last reply Reply Quote 0
                                        • OxerO Offline
                                          Oxer
                                          last edited by

                                          Hi again,
                                          I have installed the plugin in SU2014 on Mac OS X 10.9.4 but it doesn't work, it appears this message in Ruby Console when I try to import the cameras exported:

                                          Error: #<ArgumentError: Cannot create unit vector from zero length vector> /Users/Oxer/Library/Application Support/SketchUp 2014/SketchUp/Plugins/camera_export_import.rb:240:ininitialize'
                                          /Users/Oxer/Library/Application Support/SketchUp 2014/SketchUp/Plugins/camera_export_import.rb:240:in new' /Users/Oxer/Library/Application Support/SketchUp 2014/SketchUp/Plugins/camera_export_import.rb:240:in block in run_import_camera'
                                          /Users/Oxer/Library/Application Support/SketchUp 2014/SketchUp/Plugins/camera_export_import.rb:184:in each' /Users/Oxer/Library/Application Support/SketchUp 2014/SketchUp/Plugins/camera_export_import.rb:184:in run_import_camera'
                                          /Users/Oxer/Library/Application Support/SketchUp 2014/SketchUp/Plugins/camera_export_import.rb:45:in block in <module:NN_Camera_Export_Import>' -e:1:in call'`

                                          The plugin works fine on SU2013, the file exported with SU2013 it's opened perfectly with SU2014.
                                          If this can help you, here the content of the SU_export_camera.txt files for SU2013 & SU2014, the cameras exported are the same for SU2013 & SU2014:

                                          SU_export_camera.txt file generated by SU2013

                                          Escena 1xxxxx114.776582759505xxxxx-470.759756047837xxxxx255.52670318483xxxxx-4.73467719892792xxxxx394.780293580179xxxxx-156.71068082903xxxxx-0.0583630895867597xxxxx0.42268478698106xxxxx0.904395555400768xxxxx1xxxxx35.0 Escena 2xxxxx284.515642984778xxxxx24.4839257174341xxxxx100.474199327822xxxxx-646.416139390573xxxxx156.269579438326xxxxx-121.743571298921xxxxx-0.227740570706893xxxxx0.0322396770177899xxxxx0.973187975511354xxxxx1xxxxx35.0

                                          SU_export_camera.txt file generated by SU2014

                                          ["Escena 1", "xxxxx", 114.776582759505, "xxxxx", -470.759756047837, "xxxxx", 255.52670318483, "xxxxx", -4.73467719892792, "xxxxx", 394.780293580179, "xxxxx", -156.71068082903, "xxxxx", -0.05836308958675972, "xxxxx", 0.4226847869810601, "xxxxx", 0.9043955554007682, "xxxxx", 1, "xxxxx", 35.0] ["Escena 2", "xxxxx", 284.515642984778, "xxxxx", 24.4839257174341, "xxxxx", 100.474199327822, "xxxxx", -646.416139390573, "xxxxx", 156.269579438326, "xxxxx", -121.743571298921, "xxxxx", -0.22774057070689294, "xxxxx", 0.032239677017789896, "xxxxx", 0.9731879755113538, "xxxxx", 1, "xxxxx", 35.0]

                                          "The result is the end what is important is the process" by Oxer
                                          [http://www.oxervision.blogspot.com/(http://www.oxervision.blogspot.com/)]

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

                                            This is because the way the data is compiled from the array into a string in Ruby1.8 is different to Ruby2. It is currently incompatible with v2014 !
                                            Here is how to fix it...
                                            Open the file in Notepad++ on PC or TextWrangler on the MAC.
                                            Find line #152, which reads:
                                            myfile.write(new_array_entry.to_s)
                                            Change it to read

                                            if Sketchup.version.to_i < 14
                                              myfile.write(new_array_entry.to_s)
                                            else ### >=v2014
                                              new_array_entry.each{|e| myfile.write(e) }
                                            end
                                            

                                            Save it and restart SketchUp.
                                            Now it should write the same format of data-file in all versions of SketchUp.
                                            The import [reading] part should remain unaffected across versions...

                                            TIG

                                            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