PolygonMesh not filled


I have created a mesh from points I created in c++. I send the array to Ruby via test5. It creates the geometry I am looking for but the faces are not filled. I have tried both fill from mesh and add faces from mesh.

      # Gets the array of vertices from C++
      vertArr = SUEX_test5.test5

      myMesh = Geom::PolygonMesh.new
      vertPointArr = Array.new
      # Loop through the array and add the points to the new mesh
      #    Create an array of the points to use in creating a polygon from the mesh
      vertArr.each do |point|
        newPoint = Geom::Point3d.new (point)

      #new_face = entities.add_face facePointArr

      # Use the array of points to create polygon
      myMesh.add_polygon vertPointArr

      group = Sketchup.active_model.entities.add_group
      material = Sketchup.active_model.materials.add('red')
      smooth_flags = Geom::PolygonMesh::HIDE_BASED_ON_INDEX
      #group.entities.add_faces_from_mesh(myMesh, smooth_flags, material)
      group.entities.fill_from_mesh(myMesh, true, smooth_flags, material)


You may need to use add_polygon as well as add_point

That mesh does not look right. If you trace over the lines, I doubt SketchUp would generate any faces from that.


I use add_point in the loop. Then I use add_polygon with those points. Here is a better picture of what it is suppose to look like. All the lines make little triangle that are the faces.

If I click on the group and trace the lines with the pencil tool the faces start to show. Like in this example.


I got it to work by just using add_face instead of add_polygon.