[REQ] workflow tool -make groups of components (nested)
-
You haven't explained yourself very clearly.
If I understand you correctly your CAD programs exports directly into SKP.
It uses SUp components [which were presumably CAD-blocks] rather than SUp groups.
I assume it also includes 'loose-geometry' too...This is to be expected...

If you were to Import the CAD [DWG/DXF] file into a SKP the very same thing will happen.
However, in that case all of the imported objects should be inside a single new component named after the imported file and therefore that'd perhaps be more readily editable.
Using the Outliner you can select whatever component[s] you want and use Explode [Edit/context-menu or recommended, use a Shortcut-key], exploded objects' geometry remains highlighted so you can immediately make that into a new group, again using Edit/context-menu or recommended, use a Shortcut-key - Entity Info can be used to rename the group after the component.To tidy up the Components Browser you can purge unused from either its pop-out menu OR from Model Info > Statistics - which also removes unused materials, layers etc that might otherwise get left behind after the components are removed from the SKP...
This one-liner can be copy+pasted into the Ruby Console and it will convert all selected [other things are simply ignored so you don't need to be too careful!] component-instances into groups, using the the same names/layer/materials etc...
m=Sketchup.active_model;as=m.active_entities;m.start_operation('Co>>Gp');m.selection.to_a.each{|e|next unless e.is_a?(Sketchup;;ComponentInstance);n=e.definition.name;o=e.name;l=e.layer;t=e.material;x=e.explode;es=[];x.each{|f|es<<f if f.is_a?Sketchup;;Drawingelement};g=as.add_group(es);g.name=n+"#"+o;g.layer=l;g.material=t};m.commit_operation;It is one step undo-able...
It doesn't deal with nested instances BUT repeated a few times on a selection it will 'group-ify' them all... -
I replied in your parallel posting... I have merged them into this one... to avoid confusion...
-
@unknownuser said:
hi there again.
where would i find help or a compendium that helps me selfteach how 2 generate a working script?!
i thind your could be a great base for what i want!
Find the free PDF on the www called Automatic-SketchUp...
Also get simple a few scripts [there are hundreds!] and read them in Notepad/Notepad++ to see/learn what they do.
Also the learn the API = https://developers.google.com/sketchup/docs/
There are also several excellent resources in the Developers' section of SCF...
Learn to use the Search tools...
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement