Programmatically creating Geometry problems

@Neil_Burkholder it seems that the above code breaks the object (leaves it with a hole in the mesh), as it now has no volume. Any fixes for that?

Can you post an example? Dividing an edge shouldn’t delete any faces. When the new face is created, the split edge is overwritten as one continuous edge. Did you try running the above code on your original model? It worked when I tried it.

@Neil_Burkholder that’s easy to show without posting anything use that scene and when you add the face just make all of the geometry a group. You’ll see that it won’t have any volume, if you use Solid you’ll see that the mesh is incomplete.

Hmm I failed to notice that. The split edge is in fact not overwritten. It’s still there, co-existing with the new continuous edge.

You could try something like this.

ent = SketchUp.active_model.entities
pts = [
[5.65553, 11.15667, 0.0], [5.65553, 6.15667, 0.0], [5.65553, 6.15667, 2.7], 
[5.65553, 11.15667, 2.7], [5.65553, 11.15667, 0.0], [5.65553, 10.33172, 0.87517], 
[5.65553, 10.33172, 2.09517], [5.65553, 7.18172, 2.09517], [5.65553, 7.18172, 0.87517], 
[5.65553, 10.33172, 0.87517]]

e = ent.grep(Sketchup::Edge).find_all {|e| e.end.position==pts[0] && e.start.position==pts[1]}
e.each{|e| e.erase!}

face = ent.add_face(pts)

face.edges.each {|e| e.find_faces}