SketchUp / api-issue-tracker

Public issue tracker for the SketchUp and LayOut's APIs
https://developer.sketchup.com/
39 stars 10 forks source link

add_faces_from_mesh() return value incorrect #265

Open MaschMaker opened 5 years ago

MaschMaker commented 5 years ago

Using:

I'm creating a face using add_faces_from_mesh() method. The documentation says this method returns the number of faces created, however, I'm always getting 0 as a return value.

In the example below, count1 returns zero when it should return 1 like count2 does.

model = Sketchup.active_model
mesh_group = model.entities.add_group
mesh_group.name="api_issue"

points = []
points.push(Geom::Point3d.new(0.mm, 0.mm, 0.mm))
points.push(Geom::Point3d.new(0.mm, 5.mm, 0.mm))
points.push(Geom::Point3d.new(5.mm, 5.mm, 0.mm))
points.push(Geom::Point3d.new(5.mm, 0.mm, 0.mm))

mesh = Geom::PolygonMesh.new
index = mesh.add_polygon(points)

count1 = mesh_group.entities.add_faces_from_mesh(mesh,Geom::PolygonMesh::NO_SMOOTH_OR_HIDE)
puts "count1 = #{count1}"

group_faces = mesh_group.entities.grep(Sketchup::Face)
puts "count2 = #{group_faces.length}"

results are:

count1 = 0 <-- this should be 1 count2 = 1

thomthom commented 5 years ago

I can confirm this. Looks like our code doesn't increase the counter after creating the faces...

taustin73 commented 4 years ago

SU-44308