Individually export all components to .dwg
-
I haven't managed I need help
` model = Sketchup.active_model
modelpath=File.dirname(model.path)
modeltitle=model.titleclist = []
for c in model.definitions
if c.count_instances > 0 and c.group? != true
clist = clist.push([c.name])
Sketchup.active_model.selection.add( Sketchup.active_model.definitions[c.name].instances )
sel = Sketchup.active_model.selection
#export(modelpath + "/" + c.name + ".dwg",false)
sel.export(modelpath + "/" + c.name + ".dwg",false)
end
end` -
Class: Sketchup::Model
This is the interface to a SketchUp model.
SketchUp Ruby API Documentation (ruby.sketchup.com)
export(modelpath + "/" + c.name + ".dwg", options_hash )
You need to construct the options hash to only export the selection etc...
however I don't know what hash items will work with DWG and your SketchUp version...An alternative workaround would be to do the individual exports in a model.start_operation(...) block in which you need to get a reference to each component-definition in turn, erase all of the model with model.entities.clear!, then place an instance of chosen component at the origin, then purge unused definitions, layers and materials etc to tidy up, then do the export to DWG, finally immediately run mode.abort_operation which undoes all of the changes...
The export of just that one definition as a DWG will survive... but the model itself will revert to how it was before that export operation.
Process the next definition in the same way until all are done... -
3D Autocad (DWG/DXF)
:acad_version - Specifies the autocad_version to export.values: "acad_12", "acad_13", "acad_14", "acad_2000", "acad_2004", "acad_2007", "acad_2010", "acad_2013"
:faces_flag - Boolean to indcate whether to export faces.
:construction_geometry - Boolean to indicate whether to export construction geometry.
:dimensions - Boolean to indicate whether to export dimensions.
:text - Boolean to indicate whether to export text objects.
:edges - Boolean to indicate whether to export edges.
-
So if that is the extent of the options, then 'selection' is not there ?
So look at my alternative idea of deleting 'everything' but the chosen component instance, then aborting...
Advertisement