Get face vertices from a group


I want to get entities and all sub entities of 3 groups namely “existing”, “proposed” and “surrounding”, and want to export it to dae. I tried this but not working.

def exportToDae

@daeFileFullPath = @modelPath + @modelName + ".dae"
model = Sketchup.active_model

group = Sketchup.active_model.entities.grep(Sketchup::Group).find{|e|“existing” ||“proposed” ||“surrounding”}
selection = model.selection

show_summary = true

options_hash = { :triangulated_faces => true,
:doublesided_faces => false,
:edges => false,
:author_attribution => false,
:texture_maps => true,
:selectionset_only => true,
:preserve_instancing => true }

status = model.export @daeFileFullPath, options_hash



Your use of ...find{... only returns the first thing found, so you are in effect selecting just that one thing.
Also just use: selection.add(group) to highlight it, do NOT highlight its contents [entities]

Substitute ...find_all{...
This returns an array of what it finds - 0/1/2/3 elements.
Then add that array to the selection with: selection.add(group) to highlight them.

It’d be more logical to rename your reference from group to groups as that is what you are hoping for ?


Thanks, that worked. All the child groups and components will also get exported to dae right?