c4d.PolygonObject
¶
c4d.
PolygonObject
¶
PolygonObject.GetAllPolygons()
PolygonObject.SetPolygon()
PolygonObject.GetPolygon()
PolygonObject.GetPolygonCount()
PolygonObject.GetPolygonR()
PolygonObject.GetPolygonW()
PolygonObject.GetNgonCount()
PolygonObject.GetSelectedNgons()
PolygonObject.GetHiddenNgons()
PolygonObject.ValidateEdgeSelection()
PolygonObject.GetEdgeSelection()
PolygonObject.GetNgonEdgesCompact()
c4d.PointObject
PolygonObject.
__init__
(
pcnt
,
vcnt
)
¶
Parameters: |
|
---|---|
Return type: | |
Returns: |
The object. |
PolygonObject.
GetPolygonS
(
)
¶
Return the selected polygons.
Return type: | c4d.BaseSelect |
---|---|
Returns: | A reference to the selected polygon structure. |
PolygonObject.
GetPolygonH
(
)
¶
Return the hidden polygons.
Return type: | c4d.BaseSelect |
---|---|
Returns: | A reference to the hidden polygon structure. |
PolygonObject.
GetEdgeS
(
)
¶
Get the selected edges. The edges are indexed by 4 * polygon + edge where polygon is the polygon index and edge is the edge index between 0 and 3 .
Warning
If you change this selection you must make sure that its still valid, so that shared edges have a well-defined selection status. it is safer to use
SetSelectedEdges()
.
Return type: | c4d.BaseSelect |
---|---|
Returns: | A reference to the selection of visible edges. |
PolygonObject.
GetEdgeH
(
)
¶
Get the hidden edges. The edges are indexed by 4 * polygon + edge where polygon is the polygon index and edge is the edge index between 0 and 3 .
Note
The edges are only hidden within the editor.
Warning
If you change this selection you must make sure that it is still valid, so that shared edges have a well-defined selection status. It is safer to use
SetSelectedEdges()
.
Return type: | c4d.BaseSelect |
---|---|
Returns: | A reference to the selection of hidden edges. |
PolygonObject.
SetPolygon
(
id
,
polygon
)
¶
Set a polygon.
Note
Call
obj.Message
( c4d.MSG_UPDATE ) after you set all your polygons to update the object.
Parameters: |
|
---|---|
Raises: |
IndexError
– If the polygon index
id
is out of range :
0<=id<
|
PolygonObject.
GetPolygon
(
id
)
¶
Get a polygon.
Parameters: | id ( int ) – The index. |
---|---|
Raises: |
IndexError
– If the polygon index
id
is out of range :
0<=id<
GetPolygonCount()
.
|
Return type: | c4d.CPolygon |
Returns: | The polygon at index id . |
PolygonObject.
ResizeObject
(
pcnt
[
,
vcnt=-1
]
)
¶
Change the number of points and polygons in the object. If
vcnt
is -1 or not set, the method of
PointObject.ResizeObject()
is used.
Parameters: |
|
---|---|
Return type: |
bool |
Returns: |
Success of changing the number of points and segments. |
PolygonObject.
GetPhongBreak
(
)
¶
Get the phong break edges. The edges are indexed by 4 * polygon + edge where polygon is the polygon index and edge is the edge index between 0 and 3 .
Warning
If you change this selection you must make sure that its still valid, so that shared edges have a well-defined phong break status. it is safer to use
SetSelectedEdges()
.
Return type: | c4d.BaseSelect |
---|---|
Returns: | The phong break. |
PolygonObject.
GetPolygonTranslationMap
(
)
¶
Gets a translation map from polygon indices to N-gon indices.
Return type: | tuple(int, list of int) |
---|---|
Returns: |
The number of N-gons and the list of N-gon indices. (
0
, []) if the function failed.
Changed in version R19.024: Was only returning the list of N-gon indices. Note With list as the N-gon indices map, if list[i] == p then polygon i is part of the N-gon p . |
PolygonObject.
GetNGonTranslationMap
(
ngoncnt
,
polymap
)
¶
New in version R19.024.
Gets a translation map from N-gon indices to polygon indices.
Parameters: |
|
---|---|
Return type: |
list of (list of int) |
Returns: |
The polygon index map if successful, otherwise None . Note The number of polygons in N-gon i is stored in list[i][0] . Then the polygon indices are stored in list[i][j] where j goes from 1 to list[i][0] . |
PolygonObject.
GetAllPolygons
(
)
¶
Returns all polygons.
Return type: |
list of
CPolygon
|
---|---|
Returns: | A list of copied polygons. |
PolygonObject.
CreatePhongNormals
(
)
¶
Returns a list with the stored phong normals of the object.
Return type: | list of Vectors or None |
---|---|
Returns: | The list or None if the object has no Phong Tag. |
PolygonObject.
GetPolygonCount
(
)
¶
Returns the count of polygons. Is the fastest way to get the count of polygons.
Return type: | int |
---|---|
Returns: | The count. |
PolygonObject.
GetPolygonR
(
)
¶
New in version R18.011.
Gets the start of the read-only array of polygons.
Note
While this function may sound trivial and cheap, internally it is not. For performance reasons, it is not recommended to use this function inside a loop or inside a loop condition.
Return type: | PyCObject |
---|---|
Returns: | The start of the read-only polygon array. |
PolygonObject.
GetPolygonW
(
)
¶
New in version R18.011.
Gets the start of the writable array of polygons.
Note
While this function may sound trivial and cheap, internally it is not. For performance reasons, it is not recommended to use this function inside a loop or inside a loop condition.
Return type: | PyCObject |
---|---|
Returns: | The start of the writable polygon array. |
PolygonObject.
GetSelectedEdges
(
e
,
ltype
)
¶
Get the selected, hidden or phong break edges. The edges are indexed uniquely by a
Neighbor
object, so each edge has a single index.
Note
This is a convenience wrapper around
GetEdgeS()
,
GetEdgeH()
and
GetPhongBreak()
.
Parameters: |
|
||||||
---|---|---|---|---|---|---|---|
Return type: | |||||||
Returns: |
The selected edges. |
PolygonObject.
SetSelectedEdges
(
e
,
pSel
,
ltype
)
¶
Set the selected, hidden or phong break edges. The edges are indexed uniquely by a
Neighbor
object, so each edge has a single index.
Note
This is a convenience wrapper around
GetEdgeS()
,
GetEdgeH()
and
GetPhongBreak()
.
Parameters: |
|
||||||
---|---|---|---|---|---|---|---|
Return type: |
bool |
||||||
Returns: |
True if the selection succeeded, otherwise False . |
PolygonObject.
GetNgonCount
(
)
¶
Get the number of N-gons in the object, i.e. the number of polygons with more points than 4.
Return type: | int |
---|---|
Returns: | The number of N-gons for this object. |
PolygonObject.
GetSelectedNgons
(
sel
)
¶
Copies the current N-gon selection into sel.
Parameters: | sel ( c4d.BaseSelect ) – Assigned the current N-gon selection. |
---|
PolygonObject.
GetHiddenNgons
(
sel
)
¶
Copies the current hidden N-gon selection into sel .
Parameters: | sel ( c4d.BaseSelect ) – Assigned the current hidden N-gon selection. |
---|
PolygonObject.
ValidateEdgeSelection
(
sel
)
¶
Deselects all selected edges in sel that are N-gon edges.
Parameters: | sel ( c4d.BaseSelect ) – The selection to check for N-gon edges. |
---|---|
Return type: | bool |
Returns: | True if successful, otherwise False . |
PolygonObject.
GetEdgeSelection
(
sel
,
type
)
¶
Deselects all edges in ‘sel’ that are N-gon edges as specified by type.
Parameters: |
|
||||||
---|---|---|---|---|---|---|---|
Return type: |
bool |
||||||
Returns: |
True if successful, otherwise False . |
PolygonObject.
GetNgonEdgesCompact
(
)
¶
Return type: | list |
---|---|
Returns: | N-gon edges information list. |
PolygonObject.
GetShadingBreak
(
includeBorderEdges
,
includeUserBreak
,
includeUserNormals
[
,
userNormalsAngle=DegToRad(5.0)
,
autoNormalsAngle=DegToRad(180.0)
]
)
¶
New in version R19.
Gets the shading break edges based on neighbor polygons shading edges and a specified angle limit.Note
The edges are indexed by 4 * polygon + edge where polygon is the polygon index and edge is the edge index between 0 and 3 .
Parameters: |
|
---|---|
Return type: | |
Returns: |
The shading break edges. |
A polygon is a triangle or a quadrangle. A triangle has the points A, B and C , a quadrangle has the points A, B, C, and D .
Perfect polygons, like the one in the image above, are not that common, since the points may lie anywhere in 3D space. This is not a problem if the points are planar - i.e. if they all lie on the same plane as in the next image.
If the quadrangle’s points are not on the same plane, the quadrangle is said to be non-planar . In the next image, point B has been moved into the depth plane. Now, Cinema 4D must render this polygon as two triangles. This happens internally and usually has no negative effects. However, non-planar polygons can occasionally lead to unexpected effects and are generally best avoided.
For planar quadrangles, if the interior angle at points B or D is greater than 180° , problems can occur when rendering - this is because the polygon overlaps itself as in the next image.
Another problem arises if all the polygon’s points are on the same line. In this case, a surface normal cannot exist and the polygon is called a degenerated polygon , illustrated in the next image:
Polygons in Cinema 4D have their own coordinate system. You cannot see this system in the viewports, but it is important to be aware of it when using modeling tools.
The origin of the polygon coordinate system is located at the center of the polygons. The X axis is along the line between A and B. The Z axis is the normal. The Y axis is perpendicular to the XZ plane.
An N-gon (pronounced en-gon) is simply a polygon that has more than four corner points. N-gons can help to simplify the polygon modeling process.
Before n-gons were implemented in Cinema 4D, almost every time you cut a polygon, new edges would be created automatically on the neighboring polygons. These extra edges could make the object difficult to work with and slow down your workflow, because a manual rebuilding would often be required in order to cleanup the mesh.
The following example demonstrates the advantage of using n-gons.