I am working in a plugin code to export a sketchup file containing a room to other applications. That requires the creation of a text file with a numerical description of the surfaces contained in the room identified by the position of the vertices (or maybe the edges) defining each of the surfaces. I can find all the information I need in the “entities” (i.e. Sketchup.active_model.entities).
My problem is that in order to access these “entities” I need beforehand to explode all Groups and Components of the room, which I am observing is terribly slow for rooms containing a high number of Groups/Components. I am using this code for that:
defs = Sketchup.active_model.definitions while therearegroupsleft therearegroupsleft = false defs.each do |d| d.instances.each do |e| if (e.layer.visible?) # NOTE( In this way I only explode groups and Components belonging to visible layers) if (e.is_a? Sketchup::Group) e.explode therearegroupsleft = true elsif (e.is_a? Sketchup::ComponentInstance) e.explode therearegroupsleft = true end end end end end
I have the following questions:
1.- Do we need to explode to access the required information? Can I extract somehow from definitions or instances the info I need?
2.- Is this procedure for exploding optimal?, there is a way to use all the computational power of my PC? (maybe parallelize the process or do it in a different way that increases the performance)
Thank you very much for your help, please let me know if you need further information to give me an answer.