SketchUp is detecting issues in the geometry I create via ruby api. The issues are shown in the Validity Check window. I would like to know what the “rules” are for creating and joining various geometry (eg, curves (all types arcs, circles, ngons, etc), faces, lines, etc.) so I can avoid the validity check issues.
My current issue is with curves via the add_curve() method.
For example, creating two curves shaped as triangles each in there own group. If the groups are connected by a single vertex and then exploded, SketchUp generates a validity check like this:
Results of Validity Check.
The connectivity for CCurve (3879) is bad - fixed
When you fix the problem, Sketchup chooses one of the curves as the “victim” and destroys the curve, leaving the edges of course.
From experimenting, I’ve theorized the following 2 rules for curves:
A vertex can join many edges each of which belong to a different curve (no loops).
A vertex can join 2 edges from the same curve (in a loop) but then cannot have any other edge that participates in a curve.
The problem is that I’m not sure these rules are correct or even complete.
Instead of having to experiment in order to detect what SketchUp is doing, I’d like to just read what the rules are for creating geometry and follow them.
Is there any documentation that explains these types of rules that “should” be followed in order to avoid validity checks? I don’t want to ignore the validity checks, I want to avoid them.
After running the code, explode group_a and group_b. Then run a validity check and you get a message like:
Results of Validity Check.
The connectivity for CCurve (3950) is bad - fixed
My original post description was definitely a bow tie. I used this code, which is not a bow tie, to show that it’s not always just loops touching each other that cause problems. Even putting two ngon’s in separate groups, connected by a vertex, then exploded cause a similar validity issue. Basically they are the same issue dealing with curves.
However, my main question isn’t really about getting around this specific issue, this was just an example to highlight the need for documentation explaining the rules. I’d like to know what the rules are when creating geometry, like what scenarios to avoid so I’m not getting the validity issues. I don’t want to be guessing at the rules and constantly refactoring my code when I run into another issue that I wasn’t aware of. Does such documentation exist?
Thanks Dan, I’ll have a look at the resources you provided. I’d be happy with just a documented list of the checks that the validity checker is making (and what they mean in layman terms). Knowing that should be enough to avoid the validity pitfalls without the need for any tutorial or programmer’s handbook. Although, having those would be GREAT!