[code] ComponentDefinition-delete
-
This script adds a new method for a ComponentDefinition...
component_definition.delete
It mimics deleting a component-definition from the component-browser.
All instances of the component-definition are erased (including any locked ones)
and the component-definition itself is then purged.
However, any other 'unused' component-definitions remain unaffected...
unlike "definitions.purge_all", which purges everything that's unused...
[EDIT: AlexM has written a better version - recommend you get it here - http://www.sketchucation.com/forums/scf/viewtopic.php?p=145255#p145255]
I have removed my 'code' 20090402... -
This is a very handy time saver
Thanks
-
Yeah, thats great. Thanks TIG!
Chris
-
I wonder what the performance impact is if there's many unused components in a model. Where I work I've seen models which has been worked on for years without every being purged... But until we get a native function this is the only way I can imagine it working.
Thanks for looking into this TIG. -
Personally I purge like every five minutes. Hooked up to a hotkey. But I'm a bit afraid to just purge stuff from other people's model when I write my plugins. But your method is a fine workaround in any case. I expect that's what I'll be using.
-
Thanks Tig! Will come in usefull when rendering with Vray since getting rid of any component instances should make render times quicker (after a file copy of course).
-
You could also use my Purge.rb that purges all Components, Layers, Materials and Styles in one go... Then your model would be 'trim'... Later on a few unused things won't give much of an overhead...
I've tried "definition.delete" with 30+ unused definitions and it took 'no time at all'...
-
A better version has been written by AlexM http://www.sketchucation.com/forums/scf/viewtopic.php?p=145255#p145255
I recommend you change to that and I have added a note to the initial page on this thread... -
AlexM has found the basis of doing this without a new method at all...
model.start_operation("Delete Definition") definition.entities.erase_entities(definition.entities.to_a) model.commit_operation
I'm removing my 'code' and rewriting ComponentInstance-add_entites.rb to suit...
Advertisement