[Plugin] Camera Settings Export/Import
-
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.
Martinp.s. updated version uploaded 2012-08-29
-
Thanks I'll let you know how i get on.
-
Using the Advanced Camera extension in SU8 you can copy and paste camera objects around.
View > Toolbars > Advanced Camera Tools
-
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/ -
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.
-
hi Aerilius, thomthom, all.
thanks for the feedback, i have updated the script accordingly and replaced it in my original post.
regards,
martinp.s. advanced camera tools would be great - maybe you can convince our sysadmins to install it for us
-
@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!
-
Could you add support for hidden geometry, visible layers, style and shadows please?
-
Is that a pro tool only? Not in my free 8.
Not in Ext. list either -
@jpalm32 said:
Is that a pro tool only? Not in my free 8.
Not in Ext. list eitherAh! Now that's a good point! Could very well be a Pro feature. Didn't think of that.
-
@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
-
"...with Maintenance 2 release, ACT installs with SketchUp 8.
-
@careca said:
"...with Maintenance 2 release, ACT installs with SketchUp 8.
Not free version! Unless I'm getting a missing module.
-
Great plugin~ I was worrying how to compare two designs the very last minute~
-
Works exactly as advertised,thank you.
-
ACT is a Pro-only add-on...
Just like LayOut, Solid tools, some Exporters/Importers etc... -
Merci beaucoup pour ce script qui fonctionne Γ merveille
-
Finally I found it, thanks
-
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!
-
Thanks you very much!!
Very useful for a project that I'm working on.
Advertisement