# Why does a curve not create a face even though it completes the edges?

I have created four lines that close a loop, but they do not create a face. Can someone explain why and how to solve it? I can manually add a line on top of any of the created lines and the face will appear, but I would like it to be automatic.

``````i = 0
b = 10.mm
num = 10

gents = grp.entities

bl = [i,i*i,0]
tl = [i,i*i+b,0]

while i < num do
pti = [i,i*i,0] # first base point
ptix = [i,i*i+b,0] # first offset point
i += 1 # go to next step
ptj = [i,i*i,0] # next base point
ptjx = [i,i*i+b,0] # next offset point
end

br = [i,i*i,0]
tr = [i,i*i+b,0]
``````

I have tried this

``````while i < num do
pti = [i,i*i,0] # first base point
ptix = [i,i*i+b,0] # first offset point
i += 1 # go to next step
ptj = [i,i*i,0] # next base point
ptjx = [i,i*i+b,0] # next offset point
end
``````

But this creates a face for each iteration, where I would need to erase each construction line instead. I hope there is a simpler solution.

Why does a polyline

SketchUp Polylines are special non-geometric path objects that are not yet exposed to the Ruby API.

You are speaking about `Curves` which are a series of connected edges thta can form any kind of shape. (Bezier, sine wave, freeform, etc.)

Technically, you created edges. Lines in the API are virtual geometric helper objects as described by the `Geom` module Overview.

I’ve always disliked the naming of the `#add_line` method.

Because they are not yet stitched together into a `Loop` object. Only (AFAIK) the `#add_circle`, `#add_face` and `#add_ngon` factory methods create a face inside a loop of edges.

The simplest way is to call `#find_faces` upon one of the edges.

Another way is to pass the curve’s edges into the `#add_face` factory method along with the other “loose” edges. Ie …

``````# If you know all the group's current edges will form a face loop:
``````

But, … can we be sure that `#grep` will return the edges in the order that we want?
If you had kept references to the edges and curves that you created …

``````gents.add_face(efirst, *curve_edges.flatten, elast)
``````
Your code with the changes ... (click to expand)
``````i = 0
b = 10.mm
num = 10

gents = grp.entities

bl = [i,i*i,0]
tl = [i,i*i+b,0]

curve_edges = []

while i < num do
pti = [i,i*i,0] # first base point
ptix = [i,i*i+b,0] # first offset point
i += 1 # go to next step
ptj = [i,i*i,0] # next base point
ptjx = [i,i*i+b,0] # next offset point
end

br = [i,i*i,0]
tr = [i,i*i+b,0]
elast = gents.add_line(tr,tl) # always draw to the starting point

# create the face:
Hmmm… a quick look makes me think that `elast`'s 2nd point should be `efirst`'s first point (`tl`) instead of whatever `br` evaluates as. This way you are sure to close the loop.
{"ft_lang_label":"__label__en","ft_lang_prob":0.79579425,"math_prob":0.9237712,"size":1148,"snap":"2021-43-2021-49","text_gpt3_token_len":400,"char_repetition_ratio":0.16958041,"word_repetition_ratio":0.34418604,"special_character_ratio":0.33101046,"punctuation_ratio":0.1609589,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.97270304,"pos_list":[0,1,2],"im_url_duplicate_count":[null,null,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2021-10-20T10:44:18Z\",\"WARC-Record-ID\":\"<urn:uuid:660cffbd-2468-4a58-93d5-3f2c11c20833>\",\"Content-Length\":\"30046\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:b87e11cb-ec7b-4c26-999e-963f8c973da3>\",\"WARC-Concurrent-To\":\"<urn:uuid:ac702991-796a-499c-9bd3-2413f8bfd060>\",\"WARC-IP-Address\":\"184.105.176.42\",\"WARC-Target-URI\":\"https://forums.sketchup.com/t/why-does-a-curve-not-create-a-face-even-though-it-completes-the-edges/175984\",\"WARC-Payload-Digest\":\"sha1:CEOHGM46IT6FJRRCDEJ34VZTOCXGDT4Y\",\"WARC-Block-Digest\":\"sha1:SULFEDC6MGYZX2INJ5RYPI5F6JL6HCKW\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2021/CC-MAIN-2021-43/CC-MAIN-2021-43_segments_1634323585305.53_warc_CC-MAIN-20211020090145-20211020120145-00463.warc.gz\"}"}