Oguide
Attributes
-
ENGLISH NAME : GuideObject
-
NAME : Oguide
-
INCLUDE : Obase
-
PATH : model/description/oguide.res
-
PLUGIN : model
-
MAXON online help (may not exist): OGUIDE
Elements
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.Oguide)
doc.InsertObject(obj)
c4d.EventAdd(c4d.EVENT_FORCEREDRAW)
#You can set parameters two different ways.
#First way
obj[c4d.GUIDEOBJECT_TYPE] = c4d.GUIDEOBJECT_TYPE_LINE
obj[c4d.GUIDEOBJECT_LINE_MODE] = c4d.GUIDEOBJECT_LINE_MODE_INFINITE
obj[c4d.GUIDEOBJECT_SPATIAL_MODE] = True
obj[c4d.GUIDEOBJECT_SIZE_X] = 0.1
obj[c4d.GUIDEOBJECT_SIZE_Z] = 0.1
obj[c4d.GUIDEOBJECT_PLANE_CENTERAXIS] = True
#Second way, using the base container.
bc = obj.GetDataInstance()
bc.SetInt32(c4d.GUIDEOBJECT_TYPE,c4d.GUIDEOBJECT_TYPE_LINE)
bc.SetInt32(c4d.GUIDEOBJECT_LINE_MODE,c4d.GUIDEOBJECT_LINE_MODE_INFINITE)
bc.SetBool(c4d.GUIDEOBJECT_SPATIAL_MODE,True)
bc.SetFloat(c4d.GUIDEOBJECT_SIZE_X,0.1)
bc.SetFloat(c4d.GUIDEOBJECT_SIZE_Z,0.1)
bc.SetBool(c4d.GUIDEOBJECT_PLANE_CENTERAXIS,True)
if __name__=='__main__':
main()
C++
#include "c4d.h"
#include "../model/description/oguide.h"
void SampleFunction()
{
BaseDocument *pDoc = GetActiveDocument();
BaseObject *pObject = BaseObject::Alloc(Oguide);
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(GUIDEOBJECT_TYPE),GeData(GUIDEOBJECT_TYPE_LINE),flags);
pObject->SetParameter(DescID(GUIDEOBJECT_LINE_MODE),GeData(GUIDEOBJECT_LINE_MODE_INFINITE),flags);
pObject->SetParameter(DescID(GUIDEOBJECT_SPATIAL_MODE),GeData(true),flags);
pObject->SetParameter(DescID(GUIDEOBJECT_SIZE_X),GeData(0.1),flags);
pObject->SetParameter(DescID(GUIDEOBJECT_SIZE_Z),GeData(0.1),flags);
pObject->SetParameter(DescID(GUIDEOBJECT_PLANE_CENTERAXIS),GeData(true),flags);
pObject->Message(MSG_UPDATE);
//Second way, using the base container.
BaseContainer *bc = pObject->GetDataInstance();
bc->SetInt32(GUIDEOBJECT_TYPE,GUIDEOBJECT_TYPE_LINE);
bc->SetInt32(GUIDEOBJECT_LINE_MODE,GUIDEOBJECT_LINE_MODE_INFINITE);
bc->SetBool(GUIDEOBJECT_SPATIAL_MODE,true);
bc->SetFloat(GUIDEOBJECT_SIZE_X,0.1);
bc->SetFloat(GUIDEOBJECT_SIZE_Z,0.1);
bc->SetBool(GUIDEOBJECT_PLANE_CENTERAXIS,true);
pObject->Message(MSG_UPDATE);
}