Explode each DC sub-group and re-group
-
i was wondering how to take a dynamic component and convert it into a static component. basically if after adjusting the parameters it was possible to explode each sub-group or sub-component and re-group it or re-componentize it with the same name as it originally had, if that would do the trick. if this script could also perform this on all DC at once or within the same family or selection, would be ideal. the sharing models with a lot of DC which are converted to static units (preferably losing all the calculations etc - purged?) would be nice to reduce size and or protect proprietary components.
-
All you need to do is remove the SKP's dc definitions'/instances' attribute dictionary named 'dynamic_attributes'.
Something long these lines, to unDC ALL in the SKP...m=Sketchup.active_model;m.start_operation("unDC");m.definitions.each{|d|d.attribute_dictionaries.delete("dynamic_attributes") if d.attribute_dictionaries and d.attribute_dictionaries["dynamic_attributes"];d.instances.each{|i|i.attribute_dictionaries.delete("dynamic_attributes") if i.attribute_dictionaries and i.attribute_dictionaries["dynamic_attributes"]}};m.commit_operation
Copy/Paste the one-liner into the Ruby Console. Warning it destroys all DC-ness, only use if you are really sure !! BUT it is one-step undo-able...
-
thanks! very cool. i didn't realize there was a set of attributes which could simply be stripped. it works really well - pretty much instantly on a fairly complex DC. definitely a last step in the process...
-
Wonderful !
The code works fine.
How to create an icon that activates this code?
To delete all the attributes of a dynamic component, you can also save your file as SKP6 format.
Thank you for your help.
Cordially
David Barros
-
it does not work in the ruby command, not sure why, I do not see any changes in sketchup 2020. I got groups with nested groups at one level and I am trying to explode all nested groups and leave a single group level
Advertisement