Get Points and Polygons from Primitives
-
How do I get points and polygons from primitives without making them editable?
Say I insert a sphere into my scene. How do I get all the mesh data from it? It doesn't provide any of the methods like
GetPolygonCount
usually used to retrieve this data.c4d.utils.Neighbor.Init
doesn't like primitives either, just saysargument 1 must be c4d.PolygonObject, not c4d.BaseObject
.My goal is to get all edges and create a spline for each edge.
Python is preferred but C++ is fine as well. I'm on 2023.2.
-
Hi @CJtheTiger primitives are generators that generate and holds a PolyonObject in there cache. So most of the time for simple primitive like a cube, to access its generated PolygonObject, you should first retrieve it's cache with the GetCache method.
If you want a more indepth introduction to this topic please read SDK Example - Geometry Readme. Then if you want to cover more complex cases I suggest you to read geometry_caches Example.
And if you want to visualize the cache and the scene structure I would highly recommend to take a look at the C++ Example - activeobject dialog.Finally regarding the spline creation, you can find all the information needed to create a spline in Python Example - SplineObject, if you have more question on the spline creation please open a new topic.
Cheers,
Maxime.