How to break faces?



I write code to create two faces(copy & run in the builtin ruby console):

entities = Sketchup.active_model.entities

# create a red face
red_face = entities.add_face [
red_face.back_material = 'red'

# create a blue face
blue_face = entities.add_face([
blue_face.back_material = 'blue'
# TODO: break the intersection face

then the view is:

How to break the intersection face?


You can try:
group = entities.add_group(blue_face)


Use Entities.intersect_with:

If you create a group with entities, its much more efficient to create the group first and then add the geometry into it. Optimal way of creating groups via the API is different than from the UI.


Also note that add_group with parameters can produce crashes and other unexpected behavior if those entities aren’t in the active drawing context. I would advise to only use add_group with parameters when there is no other way.


I second that.