Create a plane furface from a selection of lines/curves

Hi,

I’m a quite new Sketchup user. I’m sorry for that “stupid” question, but I can’t see how to create a plane surface from a bunch of selected lines/arcs ?

I tried to write a ruby module, but model.entities.add_face(selection) doesn’t work too

Thanks for helping.

If you have a set of edges and curves that are on the same plane, you can redraw one of the edges to have the enclosed face heal itself.

To do the same thing with Ruby, this seems to work, but again, the edges need to be coplanar:

model = Sketchup.active_model
selection = model.selection
selected_edges = selection.grep(Sketchup::Edge)
model.entities.add_face(selected_edges)

Hi @colin

Thanks for your answer,

1 - the tricks works, but still strange that a native operation doesn’t exist

2 - the ruby code works fine !

It does, you just need to use it… as Colin showed one of the native methods. :wink:

The Entities #add_face method is described in the API, you need to follow it.

So, you need to “feed” this method with the right parameters, that means give for example the Array of <Sketchup::Edge> as parameter
You can check the overloads, what other kind of entities are accepted by this method.
This method designed like this for a reason, so you need to filter out entities as needed from Selection before you call the method.

Another consideration may be to pass the edges in the correct winding order so that the face’s normal is in the direction desired, and so you don’t get a bowtie face. (Meaning that grep may return the face objects in random order.)

It could be that the random set of lines I drew happened to be healable, and yours are not. Can you show a small example model where the ruby worked but drawing over an edge didn’t?