Hello again, as Ngons seem to pop up once again in the questions, I'm doing some investigations on them, and... well, they are still not very Python friendly.
Question 1: Is anybody currently working on expanding the Ngon handling in the Python API? (Status August 2020, comparing the newest Python and C++ documentation) Python is missing the classes Ngon
and NgonBase
and the struct NgonNeighbor
. The PolygonObject
does not have the functions GetNgonBase
and GetAndBuildNgon
. The modeling interface is missing AddNgon
, SetNgon
, FindNgon
, GetNgon
, NewNgon
, and more. In total, that means Ngons cannot be created in Python (sure, we can use SendModelingCommand
to send a Melt command, but that is not practical and only feasible at all in certain threading situations.)
This seems to be the case since a long time, and I wonder if the Python API will ever be amended to enable Ngon generation, or whether that's not even planned (as Ngon handling is fairly complicated and may not be suitable for the targeted Python audience)
(Edit: I am aware that there are functions in the PolygonObject that allow inferring the Ngons - returning the relationship lists between Ngons and polygons. But these are read-only: GetPolygonTranslationMap()
and GetNGonTranslationMap()
.)
Question 2: Browsing the PluginCafé history, I found the mention that GetPolygonTranslationMap()
is broken (2017). Is that still the case? It was also mentioned that the error is known and it's being worked on, but in lack of a complete error history I can't find a confirmation that it has been fixed. The thread ends shortly after without mentioning the issue again.
Question 3: Is there any documentation on permitted Ngon constructs? An Ngon is ultimately just a collection of polygons, but not every arbitrary collection of polygons can be an Ngon. This is normally ensured by C4D functions that generate the Ngons. But if we could create Ngons ourselves (let's pretend we have the needed C++ functionality), what are the rules? From the behavior of the Melt command, I can only infer:
- Disjunct polygons cannot make an Ngon
- Polygons that meet only in a point cannot make an Ngon
- Corollary: Any two polygons in an Ngon must transitively share an edge
- All points of an Ngon are border points. An Ngon cannot contain "inner" points (points that are only part of "inner" Ngon edges).
- An Ngon may not have edges that "cut into" the Ngon and end on an isolated point (an edge that is technically a border edge but neighbors only Ngon polygons)
- Ngons can contain holes, even multiple ones
- Ngons can be non-planar and have concave borders
- A polygon of an Ngon may have only inner Ngon edges (but its points still must be border points)
Also:
Melt may completely change the polygon selection and create triangles and poles with inner Ngon edges even if the original polygon selection in my opinion would have made a perfectly valid Ngon. -- I am fairly sure that this is just a weakness of the algorithm but I cannot be totally sure that there are more rules behind it that I simply don't know.
By cutting a line between two holes in an Ngon, I was able to create an Ngon that is invalid - it's not an open manifold, and it contains an edge that cuts into the Ngon. Apparently a bug, since the algorithm also closed one of the holes. Just for fun:
20200823__02__NgonInvalid.c4d