I want to create a polygon mesh with points in an array. I want to go through the array adding the points to the mesh. What I do not know how to do is use “add_polygon” with my mesh. When I put it inside the loop (in the >>x<<) it does not work. But if I take it out of the loop it does not pick up the points. Any advice?
newArr = [[0,0,0],[100, 0, 0],[100, 100, 0],[0, 100, 0],[200, 0, 50],[200, 100, 50]] myMesh = Geom::PolygonMesh.new newArr.each do |point| newPoint = Geom::Point3d.new (point) UI.messagebox(newPoint) myMesh.add_point(newPoint) >>>>>>myMesh.add_polygon newPoint<<<<<< end >>>>myMesh.add_polygon newPoint<<<< group = Sketchup.active_model.entities.add_group material = Sketchup.active_model.materials.add('green') smooth_flags = Geom::PolygonMesh::NO_SMOOTH_OR_HIDE group.entities.add_faces_from_mesh(myMesh, smooth_flags, material)