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
This chapter gives you an understanding how to create an instance of an object you request. CINEMA 4D is shipped with a big pool of objects, tags and nodes. All these objects are derived at least from BaseList2D and registered with a unique ID, even they are part and parcel of CINEMA 4D like the Cube or Sphere.
If you pass such unique ID to BaseList2D.__init__ you get an instance of the corresponding type:
import c4d
from c4d import symbols as sy
print sy.Ocube
cube = c4d.BaseList2D(sy.Ocube)
print cube #
The returned object is a subclass and of BaseObject which is also derived from BaseList2D. You can also write:
import c4d
cube = c4d.BaseObject(5125)
In this case we used the ID 5125. Because the Cube object is such a part and parcel of CINEMA 4D, there is a constant available in the c4d module called Ocube. All IDs of objects, tags, etc... which are shipped with CINEMA 4D are available as constants in c4d. If you want to create an instance of a plugin, you have to pass just the ID or define your own constant in your code:
import c4d
cube2 = c4d.BaseList2D(c4d.Ocube) #this function does the...
cube1 = c4d.BaseObject(c4d.Ocube) #...same like this function
cube3 = c4d.BaseTag(c4d.Ocube) #returns <None>
See also