how to catch this error: cannot find nice quad ...

Connecting two loops by quads with a script I get this error: (Bl 2.53)
“cannot find nice quad from concave set of vertices”
quads are generated by
bpy.ops.mesh.edge_face_add()
(only 4 different verts selected)
how does a catch for this problem looks like (if possible).


try:
   bpy.ops.mesh.edge_face_add()
?????

Nice Idea PKHG!

This would be a nice addition.
Its a real pain to close a hole with F-key!

I used a preversion of your script, its definitely great (the example blend-file!)
here is the blend-file:
http://www.blendpolis.de/viewtopic.php?f=16&t=29786

Basically, in 2.49 (may be in 2.5 too) you cannot push blender to connect 4 verts that form a figure with 1 internal angle > 180 degrees. That’s a tough bug in 2.49… so if it exists in 2.5 you should investigate the verts layout and (in such situations) take some additional measures to connect the verts correctly. If ALL inner angles are <= 180 degrees, scripts run w/o problems. :wink:

Your example layout shown at your postings in the other forum (link) may get problematic to connect if the 4-th vertex from the top on the right curve is a little bit to the left… The same will be if the 2-nd vertex from top on the left curve is to the left too. You may fall into situation that you are not able to make Blender join triangles to quads as well.

See some of mine here and here

Regards,

Your answer is correct, but not for my case interesting. Why?
I have a loop selecting ( 2 or 3 or 4 only) vertices and give command to add a face and
I DON’T bother if it was possible or not, I would only like to give a ‘warning’ (or…)
therefore my question how to catch the error .

@tungee
The basic script has evolved yesterday a lot … I will inform, when and where my 99% version will be found :wink:

:edit: see http://petertregarg.host22.com/pmwiki/pmwiki.php/Api/ConnectTwoComponents
I am already several steps further…
Searching for a nice solution if the (closed) paths have a different number of vertices (tri’s needed?!).
Idea: split the number of ‘superfluous’ vertices in two sets, and connect with tri’s left and right … or so …
(old version: I connected the last vertex with tri’s, worked, but something else may be better, who knows.)

That’s what I mean - in order to know if your script is to make a face or the result would be unsuccessful, you’d need to clarify for yourself what is the verts position… Blender wont issue an appropriate warning message automatically in case of a situation problematic to making a face after your command… So it is up to the developer to decide if he/she is to put more efforts on that or leave the script run as is with a potential of non-successful work w/o any warnings.

Regards,

Hmm, shall think about how to decide (with Python) when a quad will fail …

An animation of a successful connection (start the two orange selected ‘lines’)
http://petertregarg.host22.com/pmwiki/uploads/Api/connectreverse0.gif

That looks nice! As it should be… :eyebrowlift:

Here is a simple example of how things may go wrong:

http://www.mediafire.com/imgbnc.php/537b3ec44f3ee2ae2a45db9870ef02936g.jpg

Three sets of 4 verts with edges [LEFT] (connected just for the viewer to see the order, but your script may supply it in the same order and result will be the same) and faces [RIGHT]. The last one (incorrect solution) shown in EDIT MODE to see more clearly where are the two parts of the face.

Sorry, my raised issue of finding internal angles > 180 degrees wasnt a sufficient ground to issue a warning…

Still going strong:
One click only:
http://petertregarg.host22.com/pmwiki/uploads/Api/version0_5.jpg

An animation of 4 different case:
http://petertregarg.host22.com/pmwiki/uploads/Api/version0_5.gif

Fantastic script… just tried to abuse it by connecting two faces together (probably not something you are trying to accomplish).
It didn’t work as I hoped, it seems to get twisted when you close the loop, but its still very very Awesome, I’ve got some serious reading to do.

http://i163.photobucket.com/albums/t301/pharion/join.jpg

yeah, I run across problems too. I have to understand more about my goal …
But a fine number of cases are already done nicely.

I replace the code by version 0.5 now …:wink: , done :yes: