Preventing purging a material and/or a component definition

Is there a way how I can mark a material and/or component definition (with ruby) to prevent cleaning up by the Sketchup purge function?

2 Likes

Afraid not. But that’s not a bad idea. Some times extensions rely on a material or component even if it’s not currently applied to the model - but SketchUp has no idea the extension is “using” it.
Can you fill out a feature request for this? (You know where.)

You could assign the material to some hidden geometry somewhere.
But that’s not ideal…

filled in a feature request in center code

1 Like

I was just looking for a cleaner method than put it on some hidden geometry. But thanks for the tip.

1 Like

Yea, this is a common pattern and it would be good to clean this up.

Just as a reminder, since we have a dedicated team for the API now, please submit those nagging issues - even though they might have been mentioned before. It will ensure they are brought up for consideration again.
That includes requests for better solutions to “hacks” and workarounds.

Like a propper layers.remove(layer) ? :smiley:

1 Like

Yea, stuff like that. Ditto for DefinitionList.remove(definition).

1 Like

[quote=“tt_su, post:9, topic:412, full:true”]
Yea, stuff like that. Ditto for DefinitionList.remove(definition)
[/quote] you have definition.entities.clear!
But there are many.
My extra ‘layers’ methods hacks - made some time ago, had layer.color= - which is not added properly.
They also include layer.delete() [akin to layers.delete(layer)], with flags to delete contents or move to Layer0 etc…

In passing text.font_name, text.font_name=, text.font_height, text.font_height= , combined with text_fixed/text.fixed=true/false [zoom-able point size or fixed ‘inches’]

Integrated SKM tools like my old hacks - to export SKM, import SKM, make SKM, extract imahes/thumbnails from SKM etc - much easier in v2014 now that Zlib etc is accessible to all…

Additional Image methods to get definition, get transformation, access image-contents, export image, copy it, clone it, do a make_unique, turn it into a material, get/set its file-path, get/set face_me property… more readily than with my hacks [in SKM toolset]…

Additional Group method to allow ‘glue_to’ of gluing component instances to be ‘reglued’ [like with Face], also accessing 'glued_to face within the Group [and perhaps components] - linked to a new ability for a glued-cutting component instance to cut faces within a group…

1 Like