model = Sketchup.active_model
entities = model.active_entities
selection = Sketchup.active_model.selection
faces =
selection.each do |e|
faces << e if e.is_a? Sketchup::Face
end
faces.each do |face|
face.add_group ???
end
Is there a way to make multiple selected face into a series of groups?
TIG
June 1, 2020, 3:12pm
2
Please learn how to format your code properly…
This make one group of the selected faces.
model = Sketchup.active_model
entities = model.active_entities
selection = model.selection
faces = selection.grep(Sketchup::Face)
if faces[0]
group = entities.add_group(faces)
group.name = "All selected faces"
end
This makes separate groups of each selected face.
model = Sketchup.active_model
entities = model.active_entities
selection = model.selection
faces = selection.grep(Sketchup::Face)
faces.each_with_index{|face, i|
group = entities.add_group(face)
group.name = "Face #{i+1}"
}
2 Likes
As said in your other topic …
2 Likes