View Full Version : Question: in python in c4d R12
leeeesh 11-05-2010, 04:01 PM Hello,
I am new at the world of scripting and programing. I am learning to use python.
my question is can i integrate the simulation (Dynamics) & (Mograph) in python ?
If it is possible, then how to use the spring & connector objects or in Mograph the cloner object?
I searched the document but couldn't find anything, also I tried using the console and it give me the names of the Objects but couldn't find there path.
Thanks,
|
|
mayajunky
11-05-2010, 08:40 PM
From what I've read on here, not all areas of C4D are compatible with Python at the moment.
donelgreeko
11-05-2010, 08:57 PM
Hi leeeesh, what are you trying to achieve with MoGraph / Dynamics?
Cheers, Sebastian
leeeesh
11-06-2010, 05:05 AM
From what I've read on here, not all areas of C4D are compatible with Python at the moment.
I really do not know.
Hi donelgreeko,
I am thinking of creating a system where in each time a clone is introduced a relationship between that clone and the existing ones are created.
so for example i have an intregre that represent how many clones i want. so lets say i have a cube, and i wanted 10 of them so that intregre will create those. I created this system, however what i want is the relationship between each of them.
In dynamics the spring Object has two object inside it to create the relation between them. What i want to create is a system where every time i clone one cube it goes in a relationship with the rest.
to illustrate more. to create relations for 10 cube means i need 45 spring object.
9 + 8 +7 + 6 + 5 +4 +3 +2 +1 = 45
now when i want to introduce extra cube then 10 more springs should be introduce to create the matrix.
I wanted it to be like a plugin so for users to use it.
I am a student and need that for a project in one of my subject.
Thanks
donelgreeko
11-08-2010, 03:59 PM
You can create any object of C4D in Python, also dynamic springs and then set the link fields.
SPRING_ID=180000010 #ID got from the Python Console
spring = c4d.BaseObject(SPRING_ID)
spring[FORCE_OBJECT_A] = anyobject
Cheers, Sebastian
leeeesh
11-09-2010, 07:41 AM
Thanks Sebastian,
I didnt know that I could use the ID, but when applying the code the console return
" The plugin'c4d.BaseObject' (ID 556257936) is missing. could not allocate instance."
def main():
SPRING_ID=0x12127d210 #ID got from the Python Console
spring=c4d.BaseObject(SPRING_ID)
spring[FORCE_OBJECT_A] = c4d.BaseObject(c4d.Ocube)
return spring
what is the thing that I am doing wrong ?
Thanks for your time.
donelgreeko
11-09-2010, 07:48 AM
Hi,
0x12127d210 is the memory address of the object, the correct ID is 180000010.
Btw, the assignment of the cube to the link field will not work. Both objects
must be part of the same document first.
Cheers, Sebastian
leeeesh
11-09-2010, 12:18 PM
Hi,
Oh ok, so how can I get the ID of an object.
okay thanks :)
donelgreeko
11-12-2010, 05:20 PM
Just drag the object you want to create by code into the Python console. Then you get a message like:
The object 'Cube' (Ocube) was added as 'Cube'.
In this example Ocube is the constant. All of them are stored in the c4d main module. If the constant is not defined in the c4d module, define it manually in your code. You can get the ID by:
obj.GetType()
Cheers, Sebastian
leeeesh
11-13-2010, 12:17 PM
Thanks Sebastian for your help. :)
CGTalk Moderation
11-13-2010, 12:17 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.