Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 02/12/2009 at 11:51, xxxxxxxx wrote:
User Information: Cinema 4D Version: R11 Platform: Windows ; Language(s) : C.O.F.F.E.E ;
--------- Hello,
I looking for a syntax to do something like that:
main(doc,op) { var obj=doc->FindObject("Cube"); obj=CallCommand(12233); }
How can I use a command at an object? In my syntax only the selected one in the object-manager get edit.
On 02/12/2009 at 12:35, xxxxxxxx wrote:
Most likely, the command will work on selected objects. Therefore, once you find the object, you will want to select it. Selection is done using:
obj->SetBit(BIT_AOBJ);
Since other objects may be selected in the document, you may also want to deselect them so that the command only affects that object.
***
There is already a way to do this in COFFEE though.
SendModelingCommand(MCOMMAND_CURRENTSTATETOOBJECT);
A bit more fiddly, but then you set the object to affect directly instead of needing to activate the object and deactivate everything else (which, under certain circumstances, could be a long recursive list).
On 02/12/2009 at 13:06, xxxxxxxx wrote:
Thank you,
I will try it tomorrow.
On 05/12/2009 at 02:09, xxxxxxxx wrote:
Thank you, obj->SetBit(BIT_AOBJ); works well.
When I use that command to create an Instance-Object, how can I decide where the new instance put in (hierarchy)?
On 05/12/2009 at 04:13, xxxxxxxx wrote:
What do I wrong? CallCommands() in if-functions does not work.
main(doc,op) { var Strebe=doc->FindObject("1Strebescbhk"); var cStrebe=op#ID_USERDATA:1; if (cStrebe==1) { println("activated"); CallCommand(12113); //deselect all Strebe->SetBit(BIT_AOBJ); CallCommand(5160); //Instance-Object op#ID_USERDATA:1 = 0; } }
It print activated, it Select the Strebe-Object. CallCommands() get ignored?
On 07/12/2009 at 05:39, xxxxxxxx wrote:
It's probably better to allocate objects and insert them into the document manually. This way you can specify a hierarchy insertion point.
little example:
var cube = doc->FindObject("Cube"); var instance = AllocObject(Oinstance); //allocates an object doc->InsertObject(instance,cube,NULL); //insert the allocted object under the 'cube' object instance#INSTANCEOBJECT_LINK = cube; //set the instance link
Btw. it looks like you are calling your code from an expression. It is forbidden to make scene changes, like inserting objects, from within an expression. It can crash CINEMA 4D.
cheers, Matthias
On 07/12/2009 at 10:51, xxxxxxxx wrote:
Hey,
Thank you for your answer, it works well. What do you mean with expression? Maybe you can explain it? (in German )
On 07/12/2009 at 12:19, xxxxxxxx wrote:
Originally posted by xxxxxxxx What do you mean with expression? Maybe you can explain it? (in German )
Originally posted by xxxxxxxx
What do you mean with expression? Maybe you can explain it? (in German )
Ich meine damit Tags, z.B. das COFFEE Tag oder COFFEE XPresso Node.
Gruss, Matthias