Save Components as separate files
-
Something like: https://extensions.sketchup.com/en/content/cg-adjust-n-export
But this script doesn't work perfectly... -
Geo location is intended for whole buildings or other structures whose location on the earth is important. You would generally get the geo-location info from Google Maps or set a location in Model Info. Maybe that would work for your application.
What doesn't work "perfectly" with that plugin?
-
Thanks for your information.
That Plugin isn't perfect because it only saves unique components. Not copies of it. So when having a building with 10 copies of a door it only exports 1 of them.
And for some reason the export option doesn't pop-up when selecting multiple components with subcomponents in it. -
I understand about the nested components. Perhaps the author could be asked to revise the plugin to handle nested components.
As for the 10 copies of your door component, no matter how many copies (instances) there are of it in your model, there's still only one component definition to save. The only way to save all 10 copies of the door would be to make each one unique from the rest. You'd want to do that anyway if you were going to reset their origins to the model origin. The component origin and axis alignment is part of the definition so every door would need a different definition.
-
You can export all component definitions with a simple one-liner.
Of course it could be made more sophisticated, but here it is...m=Sketchup.active_model;puts p=File.dirname(m.path);m.definitions.each{|d|next if d.group? || d.image?;puts n=d.name.gsub(/[\/\\;<>"|\*\?]/,'_')+'.skp';d.save_as(File.join(p,n))};puts
Copy+Paste it into the Ruby Console + <enter>.
It processes every Component Definition [even nested ones] in the Model, it skips Groups and Images.
It prints the path to the saved files [the Model's path folder].
It prints out the names of the individual SKP files as it processes them...
Note how any characters that might be acceptable in a component's name, but which will be unacceptable in a file-path [e.g. ':'] are replaced by a '_'... -
@tig said:
You can export all component definitions with a simple one-liner.
Of course it could be made more sophisticated, but here it is...m=Sketchup.active_model;puts p=File.dirname(m.path);m.definitions.each{|d|next if d.group? || d.image?;puts n=d.name.gsub(/[\/\\;<>"|\*\?]/,'_')+'.skp';d.save_as(File.join(p,n))};puts
Copy+Paste it into the Ruby Console + <enter>.
It processes every Component Definition [even nested ones] in the Model, it skips Groups and Images.
It prints the path to the saved files [the Model's path folder].
It prints out the names of the individual SKP files as it processes them...
Note how any characters that might be acceptable in a component's name, but which will be unacceptable in a file-path [e.g. ':'] are replaced by a '_'...Can you modify this to specify a specific version of SKP to save as (I think it may be a workaround for the lvl to skp?)
-
In this example code,
definition.save(path)
can have no argument to set the SKP's version.
But inmodel.save(path, version)
there is [at least in the newer versions of SketchUp]
To save all definitions as separate SKPs you can make a folder, save the definitions into it in turn...
Then you can process the SKPs in that folder, you'd need to open each of then and save, resetting the version...Alternatively, in a set of start_operation...abort_operation... blocks [iterated one per definition] - so that the changes to the model are not remembered - you could .clear! the model.entities, then place an instance of that component at the origin, zoom to it, explode the instance [and any nested containers too?], then purge unused components, layers and materials, then save the model, specifying the version desired, then abort_operation to reset the model... repeat until all definitions have SKPs in a subfolder. The final abort should reset back to the starting set up.
This is very similar to my recently reissued 'layer exporter', but easier to control and use ??
-
I'll PM you an RBZ version of TIG-export_SKP_by_definition v1.0 for you to test.
If it's OK then I can publish it in the PluginStore...
-
Great, I should have PM'd you my feedback on the TIG-export_SKP_by_definition, let me know if it didn't go through and I'll post it here.
-
@tig said:
I'll PM you an RBZ version of TIG-export_SKP_by_definition v1.0 for you to test.
If it's OK then I can publish it in the PluginStore...
TIG, did you ever upload this onto the Extension Warehouse?
-
@chrismichaelgentile said:
TIG, did you ever upload this onto the Extension Warehouse?
I don't think I've ever seen any of TIG's plugins / extensions on the EW, he has them here in the SketchUcation PluginStore.
Advertisement