This documentation is for the free plugin Py4D in CINEMA 4D R11.5 and not for the C4DSDK of Python in CINEMA 4D R12. For R12, please visit PluginCafe.com

c4d.utils.Neighbor - a helper class for polygon objects

Class to get neighbouring polygons from edges and points.

Warning

This class assumes that the geometry is clean such that an edge is only shared by two polygons, if this is not the case then the information may not be correct.

class c4d.utils.Neighbor

Methods

Neighbor.__init__()
Return type:Neighbor
Returns:The new neighbor object.
Neighbor.Init(op[, bs=None])

Initialise the internal polygon information, this function must be called before the class can be used to get the neighbouring polygons.

Parameters:
  • op (PolygonObject) – The class object.
  • bs (BaseSelect) –

    BaseSelect that contains a polygon selection that will be used to build the neighbor information.

    Note

    Set to None to use all polygons.

Neighbor.Flush()
Flushes the neighbor information.
Neighbor.GetNeighbor(a, b, poly)

Gets the polygon opposite to poly with respect to the edge from point a to b.

Parameters:
  • a (int) – The point index that defines the first edge point.
  • b (int) – The point index that defines the second edge point.
  • poly (int) – The index of the polygon to get the polygon opposite to.
Return type:

int

Returns:

The opposite polygon index, or NOTOK if none exists or if poly isn’t one of the edge polygons.

Neighbor.GetPointPolys(pnt)

Get the polygons that are attached to the given point index.

For example:

To get the polygons around say point 137 you would use:

polys = neigbor.GetPointPolys(137)
for poly in polys:
    #do something with poly
    pass
Return type:list
Returns:A list of returned polygons.
Neighbor.GetEdgeCount()

Get the total number of edges found.

Return type:int
Returns:The number of edges in the given polygons.

Table Of Contents

This Page