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 MGlineararray

MGlineararray

Attributes

  • ENGLISH NAME : LinearArray
  • NAME : MGlineararray
  • INCLUDE : Obase
  • PATH : mograph/description/mglineararray.res
  • PLUGIN : mograph
  • MAXON online help (may not exist): MGLINEARARRAY

Elements

ID UI Name Type Parameters Cycle
MG_LINEAR_COUNT Count LONG
MIN 0
MAXSLIDER 100
CUSTOMGUI LONGSLIDER
MG_LINEAR_OFFSET Offset LONG
MIN 0
MAXSLIDER 100
CUSTOMGUI LONGSLIDER
MG_LINEAR_MODE Mode LONG  
MG_LINEAR_MODE_ALL EndPoint
MG_LINEAR_MODE_STEP PerStep
MG_LINEAR_OBJECT_AMOUNT Amount REAL
UNIT PERCENT
MINSLIDER 0.0
MAXSLIDER 100.0
CUSTOMGUI REALSLIDER
MG_LINEAR_OBJECT_POSITION P VECTOR
UNIT METER
STEP 1.0
CUSTOMGUI SUBDESCRIPTION
MG_LINEAR_OBJECT_SCALE S VECTOR
UNIT PERCENT
STEP 1.0
CUSTOMGUI SUBDESCRIPTION
MG_LINEAR_OBJECT_ROTATION R VECTOR
UNIT DEGREE
STEP 1.0
CUSTOMGUI SUBDESCRIPTION
MG_LINEAR_JOINT_MODE StepMode LONG  
MG_LINEAR_JOINT_MODE_ALL SingleValue
MG_LINEAR_JOINT_MODE_STEP Cumulative
MG_LINEAR_JOINT_SCALE StepSize REAL
UNIT PERCENT
MIN 0.0
MAXSLIDER 100.0
CUSTOMGUI REALSLIDER
MG_LINEAR_JOINT_ROTATION StepRotation VECTOR
UNIT DEGREE
STEP 0.1
OPEN
CUSTOMGUI SUBDESCRIPTION

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.MGlineararray)
    doc.InsertObject(obj)
    c4d.EventAdd(c4d.EVENT_FORCEREDRAW)
    
    #You can set parameters two different ways. 
    #First way              
    obj[c4d.MG_LINEAR_COUNT] = 1
    obj[c4d.MG_LINEAR_OFFSET] = 1
    obj[c4d.MG_LINEAR_MODE] = c4d.MG_LINEAR_MODE_ALL
    obj[c4d.MG_LINEAR_OBJECT_AMOUNT] = 0.1
    obj[c4d.MG_LINEAR_OBJECT_POSITION] = c4d.Vector(1.0,1.0,1.0)
    obj[c4d.MG_LINEAR_OBJECT_SCALE] = c4d.Vector(1.0,1.0,1.0)
    obj[c4d.MG_LINEAR_OBJECT_ROTATION] = c4d.Vector(1.0,1.0,1.0)
    obj[c4d.MG_LINEAR_JOINT_MODE] = c4d.MG_LINEAR_JOINT_MODE_ALL
    obj[c4d.MG_LINEAR_JOINT_SCALE] = 0.1
    obj[c4d.MG_LINEAR_JOINT_ROTATION] = c4d.Vector(1.0,1.0,1.0)
    
    #Second way, using the base container.
    bc = obj.GetDataInstance()
    bc.SetInt32(c4d.MG_LINEAR_COUNT,1)
    bc.SetInt32(c4d.MG_LINEAR_OFFSET,1)
    bc.SetInt32(c4d.MG_LINEAR_MODE,c4d.MG_LINEAR_MODE_ALL)
    bc.SetFloat(c4d.MG_LINEAR_OBJECT_AMOUNT,0.1)
    bc.SetVector(c4d.MG_LINEAR_OBJECT_POSITION, c4d.Vector(1.0,1.0,1.0)
    bc.SetVector(c4d.MG_LINEAR_OBJECT_SCALE, c4d.Vector(1.0,1.0,1.0)
    bc.SetVector(c4d.MG_LINEAR_OBJECT_ROTATION, c4d.Vector(1.0,1.0,1.0)
    bc.SetInt32(c4d.MG_LINEAR_JOINT_MODE,c4d.MG_LINEAR_JOINT_MODE_ALL)
    bc.SetFloat(c4d.MG_LINEAR_JOINT_SCALE,0.1)
    bc.SetVector(c4d.MG_LINEAR_JOINT_ROTATION, c4d.Vector(1.0,1.0,1.0)

if __name__=='__main__':
    main()
             

C++

#include "c4d.h"
#include "../mograph/description/mglineararray.h"
void SampleFunction()
{
    BaseDocument *pDoc = GetActiveDocument();
    BaseObject *pObject = BaseObject::Alloc(MGlineararray);
    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_LINEAR_COUNT),GeData(1),flags);
    pObject->SetParameter(DescID(MG_LINEAR_OFFSET),GeData(1),flags);
    pObject->SetParameter(DescID(MG_LINEAR_MODE),GeData(MG_LINEAR_MODE_ALL),flags);
    pObject->SetParameter(DescID(MG_LINEAR_OBJECT_AMOUNT),GeData(0.1),flags);
    pObject->SetParameter(DescID(MG_LINEAR_OBJECT_POSITION),GeData(Vector(1.0,1.0,1.0)),flags);
    pObject->SetParameter(DescID(MG_LINEAR_OBJECT_SCALE),GeData(Vector(1.0,1.0,1.0)),flags);
    pObject->SetParameter(DescID(MG_LINEAR_OBJECT_ROTATION),GeData(Vector(1.0,1.0,1.0)),flags);
    pObject->SetParameter(DescID(MG_LINEAR_JOINT_MODE),GeData(MG_LINEAR_JOINT_MODE_ALL),flags);
    pObject->SetParameter(DescID(MG_LINEAR_JOINT_SCALE),GeData(0.1),flags);
    pObject->SetParameter(DescID(MG_LINEAR_JOINT_ROTATION),GeData(Vector(1.0,1.0,1.0)),flags);
    pObject->Message(MSG_UPDATE);            

    //Second way, using the base container.
    BaseContainer *bc =     pObject->GetDataInstance();
    bc->SetInt32(MG_LINEAR_COUNT,1);
    bc->SetInt32(MG_LINEAR_OFFSET,1);
    bc->SetInt32(MG_LINEAR_MODE,MG_LINEAR_MODE_ALL);
    bc->SetFloat(MG_LINEAR_OBJECT_AMOUNT,0.1);
    bc->SetVector(MG_LINEAR_OBJECT_POSITION, c4d.Vector(1.0,1.0,1.0);
    bc->SetVector(MG_LINEAR_OBJECT_SCALE, c4d.Vector(1.0,1.0,1.0);
    bc->SetVector(MG_LINEAR_OBJECT_ROTATION, c4d.Vector(1.0,1.0,1.0);
    bc->SetInt32(MG_LINEAR_JOINT_MODE,MG_LINEAR_JOINT_MODE_ALL);
    bc->SetFloat(MG_LINEAR_JOINT_SCALE,0.1);
    bc->SetVector(MG_LINEAR_JOINT_ROTATION, c4d.Vector(1.0,1.0,1.0);
    pObject->Message(MSG_UPDATE);                                                      
}