Here you will find documentation on all the descriptions that Cinema 4D currently has. You can list them Alphabetically, by Type or Plugin . The sample Python and C++ code is automatically generated and in some cases may not be 100% correct. If something doesn't work then please refer to the official Cinema 4D SDK documentation for more information.

IDs and information for MGgridarray

MGgridarray

Attributes

  • ENGLISH NAME : GridArray
  • NAME : MGgridarray
  • INCLUDE : Obase
  • INCLUDE : otransform_panel
  • PATH : mograph/description/mggridarray.res
  • PLUGIN : mograph
  • MAXON online help (may not exist): MGGRIDARRAY

Elements

ID UI Name Type Parameters Cycle
MG_GRID_RESOLUTION Count VECTOR
MIN 1
MAX 2000000
STEP 1
OPEN
MG_GRID_MODE Mode LONG  
MG_GRID_MODE_PERSTEP Per-Step
MG_GRID_MODE_ENDPOINT Endpoint
MG_GRID_SIZE Size VECTOR
UNIT METER
OPEN
MG_GRID_TYPE Form LONG  
MG_GRID_TYPE_CUBIC Cubic
MG_GRID_TYPE_SPHERE Sphere
MG_GRID_TYPE_TUBE Cylinder
MG_GRID_TYPE_OBJECT Object
MG_GRID_INSIDE Fill REAL
UNIT PERCENT
MIN 0
MAX 100
MG_GRID_OBJECT Object LINK  
MG_GRID_UVAXIS W(UV)-Orientation LONG  
MG_GRID_UVAXIS_XP X+
MG_GRID_UVAXIS_XN X-
MG_GRID_UVAXIS_YP Y+
MG_GRID_UVAXIS_YN Y-
MG_GRID_UVAXIS_ZP Z+
MG_GRID_UVAXIS_ZN Z-

Example Code

The following code does not use the correct values when setting the data. You should check directly in C4D for the correct values that you should use in place of the ones that are shown. This code is just to show you how to access the values for getting and setting the parameters.

Python

import c4d
from c4d import gui
def main():
    obj = c4d.BaseObject(c4d.MGgridarray)
    doc.InsertObject(obj)
    c4d.EventAdd(c4d.EVENT_FORCEREDRAW)
    
    #You can set parameters two different ways. 
    #First way              
    obj[c4d.MG_GRID_RESOLUTION] = c4d.Vector(1.0,1.0,1.0)
    obj[c4d.MG_GRID_MODE] = c4d.MG_GRID_MODE_PERSTEP
    obj[c4d.MG_GRID_SIZE] = c4d.Vector(1.0,1.0,1.0)
    obj[c4d.MG_GRID_TYPE] = c4d.MG_GRID_TYPE_CUBIC
    obj[c4d.MG_GRID_INSIDE] = 0.1
    obj[c4d.MG_GRID_UVAXIS] = c4d.MG_GRID_UVAXIS_XP
    
    #Second way, using the base container.
    bc = obj.GetDataInstance()
    bc.SetVector(c4d.MG_GRID_RESOLUTION, c4d.Vector(1.0,1.0,1.0)
    bc.SetInt32(c4d.MG_GRID_MODE,c4d.MG_GRID_MODE_PERSTEP)
    bc.SetVector(c4d.MG_GRID_SIZE, c4d.Vector(1.0,1.0,1.0)
    bc.SetInt32(c4d.MG_GRID_TYPE,c4d.MG_GRID_TYPE_CUBIC)
    bc.SetFloat(c4d.MG_GRID_INSIDE,0.1)
    bc.SetInt32(c4d.MG_GRID_UVAXIS,c4d.MG_GRID_UVAXIS_XP)

if __name__=='__main__':
    main()
             

C++

#include "c4d.h"
#include "../mograph/description/mggridarray.h"
void SampleFunction()
{
    BaseDocument *pDoc = GetActiveDocument();
    BaseObject *pObject = BaseObject::Alloc(MGgridarray);
    pDoc->InsertObject(pObject);
    pDoc->StartUndo();
    pDoc->AddUndo(UNDO_NEW,pObject);
    pDoc->EndUndo();
    EventAdd(EVENT_FORCEREDRAW);
    
    //You can set parameters two different ways. 

    //First way              
    //Some objects do not store all their data in the container. You need to use GetParameter()/SetParameter() instead. 

    DESCFLAGS_SET flags = DESCFLAGS_SET_PARAM_SET;
    pObject->SetParameter(DescID(MG_GRID_RESOLUTION),GeData(Vector(1.0,1.0,1.0)),flags);
    pObject->SetParameter(DescID(MG_GRID_MODE),GeData(MG_GRID_MODE_PERSTEP),flags);
    pObject->SetParameter(DescID(MG_GRID_SIZE),GeData(Vector(1.0,1.0,1.0)),flags);
    pObject->SetParameter(DescID(MG_GRID_TYPE),GeData(MG_GRID_TYPE_CUBIC),flags);
    pObject->SetParameter(DescID(MG_GRID_INSIDE),GeData(0.1),flags);
    pObject->SetParameter(DescID(MG_GRID_UVAXIS),GeData(MG_GRID_UVAXIS_XP),flags);
    pObject->Message(MSG_UPDATE);            

    //Second way, using the base container.
    BaseContainer *bc =     pObject->GetDataInstance();
    bc->SetVector(MG_GRID_RESOLUTION, c4d.Vector(1.0,1.0,1.0);
    bc->SetInt32(MG_GRID_MODE,MG_GRID_MODE_PERSTEP);
    bc->SetVector(MG_GRID_SIZE, c4d.Vector(1.0,1.0,1.0);
    bc->SetInt32(MG_GRID_TYPE,MG_GRID_TYPE_CUBIC);
    bc->SetFloat(MG_GRID_INSIDE,0.1);
    bc->SetInt32(MG_GRID_UVAXIS,MG_GRID_UVAXIS_XP);
    pObject->Message(MSG_UPDATE);                                                      
}