Remove points from a polygon

I have created a function that adds points to a polygon.
But how to remove a point from a polygon, as well as remove the faces that contain it ?

Hey @kantronin,

Thank you for reaching out to us. I would recommend having a look at the Modeling Python Examples. They are a bit hidden, but in the Geometry section I went over the general classic API geometry model of Cinema 4D.

Regarding your core questions:

  • Removing points from a polygon: Without wanting to be overly pedantic, I must point out that polygons only index vertices, they do not hold them; CPolygon references with its fields a, b, c, and d the vertices of the PolygonObject it is attached to. In this sense removing points from a polygon is not possible, you can just de-index them. Cinema 4D expresses both triangles and quadrangles with the type CPolygon, i.e., as quadrangles. A triangle simply repeats its c index in its d index. I explained this in the modelling examples in more detail.
  • Removing vertices or polygons from a PolygonObject: There is neither a PolygonObject.RemovePolygon nor aPointObject.RemovePoint if that is what you are looking for. When you want to change the vertex or polygon count of a PolygonObject, you must call PolygonObject.ResizeObject and then call PointObject.SetAllPoints() and for each (new) polygon PolygonObject.SetPolygon. The operation_extrude_polygons_s26 example covers this subject, although I go there into the opposite direction, I increase the point and polygon count rather than decreasing it.

PS: Useful might also be geometry_polygonobject_s26 because I explained there the type from scratch.

Cheers,
Ferdinand

MAXON SDK Specialist
developers.maxon.net