{{{
selection = Sketchup.active_model.selection
faces = []
comp = []
# 获取选择集中的面和组件
selection.each{ | i |
faces << i if i.is_a? Sketchup::Face
comp << i if i.is_a? Sketchup::ComponentInstance
}
# 根据顶点将面加入组件中
faces.each{ | i |
vert = []
i.outer_loop.vertices.each{ | i | vert << ( i.position.transform! comp[0].transformation.inverse ) }
comp[0].definition.entities.add_face(vert)
}
}}}