Drawing a Face but removing the actual Face

I’m surprised I have never had to do this type of operation before but I’m wanting to create a face given an array of points using the add_face method and then remove the actual face but leave the (outer loop) edges behind.

Its seems I must have done this sort of thing before but I can’t find a single example in any of my code.

This block first creates the face:

dep_group = Sketchup.active_model.active_entities.add_group
entities_dep = dep_group.entities
new_face_outline = entities_dep.add_face @pts

Maybe the only way (best way) to do this is to just cycle through the points and draw the edges with the add_line method.

The reason I want to use the add_face method is so that I can calculate the area of the polgyon and report that information later on in the code.

I have no problem doing this …

pts = [[0,0,10], [276,20,10], [276,276,10]]
ents = Sketchup.active_model.active_entities
f = ents.add_face pts
a = f.area
#=> 35328.0

the edges are left intact. The face is removed.

Also no issues when drawing on the ground plane (Z = 0).

FYI, There are formulas for finding area of polygons …



1 Like

Maybe I just need a break from my code. I was accidentally erasing the group and not the face, no wonder it was not working.

Too easy!


1 Like