[Plugin] Camera Settings Export/Import

[Plugin] Camera Settings Export/Import

Postby careca » Mon Aug 27, 2012 8:26 am

Hello.

I'm sharing a little script with everybody that does export & import camera settings, making transfers between files possible.
As I was not able to find any script that can do this (though "Camera Statistics" provides the raw numbers, it requires quite a bit of copy&paste efforts), I went ahead and wrote it myself.

So it's basically tackling an issue we have quite frequently in the office, when we have several versions of SU model files, dating back to different dates and occasions. And then sometime the client asks for a before/after comparison, for what we have to retain older files and retrofit them with newer camera positions (or do the same thing vice-verse).

The scripting might be ruby-beginner-style, but is seems to be working on our SU 8 Win7 systems.

It provides basic export options (choose between exporting "all scenes", "current scene" "selected scene") and import options (update camera of scenes with identical scene name)

If somebody find this helpful, feel free to download and use it and let me know if you like it.
Also feel free to enhance the script further.

Best regards.
Martin

p.s. updated version uploaded 2012-08-29
3
Last edited by careca on Wed Aug 29, 2012 8:13 am, edited 1 time in total.

careca 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Camera Settings Export/Import

Postby Tobobo » Tue Aug 28, 2012 1:15 pm

Thanks I'll let you know how i get on.
0
Toby

Philippians 4:13

I can do everything through him who gives me strength.
User avatar
Tobobo 
 

Re: [Plugin] Camera Settings Export/Import

Postby thomthom » Tue Aug 28, 2012 1:45 pm

Using the Advanced Camera extension in SU8 you can copy and paste camera objects around.

View > Toolbars > Advanced Camera Tools
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Camera Settings Export/Import

Postby thomthom » Tue Aug 28, 2012 1:47 pm

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/0 ... velopment/
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Camera Settings Export/Import

Postby Aerilius » Tue Aug 28, 2012 2:29 pm

In addition to using a module, avoid any hard-coded file paths:
D:\SU_camera_export.txt does most likely not exist.
An alternative is to use environment variables (ENV["TEMP"]||(ENV["TMP"]; ENV["USERPROFILE"]||ENV["HOME"]) to get a default path or to ask the user directly for a path.
Example:
mypath = UI.savepanel("Save the camera settings")
return if mypath.nil?
mypath = File.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! :thumb: We are always happy if people accomplish the first step :berserk: . Once you're infected by Ruby, you can not get away from it.
0

Aerilius 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Camera Settings Export/Import

Postby careca » Wed Aug 29, 2012 8:15 am

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 ;-)
0

careca 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Camera Settings Export/Import

Postby thomthom » Wed Aug 29, 2012 8:39 am

careca wrote: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! :)
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Camera Settings Export/Import

Postby rv1974 » Wed Aug 29, 2012 10:36 am

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

rv1974 
 

Re: [Plugin] Camera Settings Export/Import

Postby jpalm32 » Wed Aug 29, 2012 2:53 pm

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

jpalm32 
Premium Member
Premium Member
 

Re: [Plugin] Camera Settings Export/Import

Postby thomthom » Wed Aug 29, 2012 2:55 pm

jpalm32 wrote: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. :oops:
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Camera Settings Export/Import

Postby careca » Thu Aug 30, 2012 1:43 am

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
0

careca 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Camera Settings Export/Import

Postby careca » Thu Aug 30, 2012 1:44 am

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

careca 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Camera Settings Export/Import

Postby jpalm32 » Sat Sep 01, 2012 12:48 am

careca wrote:"...with Maintenance 2 release, ACT installs with SketchUp 8.

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

jpalm32 
Premium Member
Premium Member
 

Re: [Plugin] Camera Settings Export/Import

Postby mirale999 » Tue Nov 20, 2012 3:42 pm

Great plugin~ I was worrying how to compare two designs the very last minute~
0
paranoia is a higher form of awareness...

mirale999 
 

Re: [Plugin] Camera Settings Export/Import

Postby floffy1983 » Thu Dec 06, 2012 11:18 am

Works exactly as advertised,thank you.
0

floffy1983 
 

Re: [Plugin] Camera Settings Export/Import

Postby TIG » Thu Dec 06, 2012 11:27 am

ACT is a Pro-only add-on...
Just like LayOut, Solid tools, some Exporters/Importers etc...
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Camera Settings Export/Import

Postby grasset17 » Tue Jan 08, 2013 5:07 pm

Merci beaucoup pour ce script qui fonctionne à merveille
0

grasset17 
 

Re: [Plugin] Camera Settings Export/Import

Postby qazokm » Sun Mar 17, 2013 8:34 am

Finally I found it, thanks
0

qazokm 
 

Re: [Plugin] Camera Settings Export/Import

Postby lsztuka » Wed May 15, 2013 10:02 am

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!
0
User avatar
lsztuka 
 

Re: [Plugin] Camera Settings Export/Import

Postby Oxer » Thu May 16, 2013 4:25 am

Thanks you very much!! :thumb:
Very useful for a project that I'm working on.
0
"The result is the end what is important is the process" by Oxer
http://www.oxervision.blogspot.com/
User avatar
Oxer 
 

Re: [Plugin] Camera Settings Export/Import

Postby halroach » Thu May 22, 2014 1:36 pm

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?
0
User avatar
halroach 
 

Re: [Plugin] Camera Settings Export/Import

Postby Oxer » Thu Sep 11, 2014 2:16 am

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:in `initialize'
/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]
0
"The result is the end what is important is the process" by Oxer
http://www.oxervision.blogspot.com/
User avatar
Oxer 
 

Re: [Plugin] Camera Settings Export/Import

Postby TIG » Thu Sep 11, 2014 2:38 pm

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
Code: Select all
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...
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Camera Settings Export/Import

Postby TIG » Thu Sep 11, 2014 3:17 pm

Because the author allows future changes by others, I have made v1.2 compatible with all SketchUp versions - available here http://sketchucation.com/pluginstore?pl ... ort_import
3
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Camera Settings Export/Import

Postby Oxer » Thu Sep 11, 2014 9:32 pm

Thanks TIG!!
0
"The result is the end what is important is the process" by Oxer
http://www.oxervision.blogspot.com/
User avatar
Oxer 
 

Re: [Plugin] Camera Settings Export/Import

Postby Tobobo » Fri Sep 12, 2014 8:44 am

TIG wrote:Because the author allows future changes by others, I have made v1.2 compatible with all SketchUp versions - available here http://sketchucation.com/pluginstore?pl ... ort_import


Thank you TIG :thumb:
0
Toby

Philippians 4:13

I can do everything through him who gives me strength.
User avatar
Tobobo 
 

Re: [Plugin] Camera Settings Export/Import

Postby faust07 » Tue Sep 16, 2014 12:31 pm

Thank you careca and TIG - this plugin has saved my day!
0

faust07 
 

Re: [Plugin] Camera Settings Export/Import

Postby poiseis » Sun May 31, 2015 2:32 pm

2d perspective scenes are not exported properly, i hope you add that features soon.
0

poiseis 
 

Re: [Plugin] Camera Settings Export/Import

Postby rombout » Wed Feb 24, 2016 7:32 am

Im looking for something to place a camera on exact axis. This way i can copy a camera from different modeling app. Its seems to be missing in some importers.

Does anyone know a trick or script?
0
User avatar
rombout 
 

Re: [Plugin] Camera Settings Export/Import

Postby juju » Wed Feb 24, 2016 9:53 am

rombout wrote:Im looking for something to place a camera on exact axis. This way i can copy a camera from different modeling app. Its seems to be missing in some importers.

Does anyone know a trick or script?

a quick search

- in the SketchUcation plugin store
http://sketchucation.com/pluginstore?li ... submit=%3F

- in the extension warehouse
http://extensions.sketchup.com/en/search/site/camera
0
Save the Earth, it's the only planet with chocolate.
User avatar
juju 
Premium Member
Premium Member
 

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago



Ad Machine 
Robot
 

Next


 

Return to Plugins

Who is online

Users browsing this forum: delilah116 and 4 guests

Visit our sponsors: