how to import c4d on my python project
-
Hi guy:
i am a new python learner but i have no idea how to install c4d python sdk.I have found some information about python tutorials,however it said "no module named c4d" when i import C4D in my PyCharm, my C4D version is R19 and python version is 3.7,could anyone tell me how to solve this? -
Hi @zhhm156,
First of all, I would like to remind you to please use the Q&A functionality and also make proper usage of Tagging system.
I let you set up your first post correctly.With that's said, there is currently no installation needed for the c4d python SDK. It's already embedded within Cinema4D and you can only access the c4d python module within c4d.
Now with the R20 version and only R20 and more, we introduce a new executable called c4dpy which allow you to get the autocompletion, and doing some debugging within Pycharm. Unfortunately, it's not working for prior version.
What you can do is use a Fake module for the autocompletion. Note this is made by the community (David Weidemann) and we don't provide support for it.Finally, c4d use a python version of 2.7x.
To know the current python version you can write in the C4D python console.
import sys print sys.version
But as I know, in PyCharm you have to define an executable, even if you will not be able to run directly your code through PyCharm.
You can find the python executable for versions prior to R20 in{C4D Install Path}/resource/modules/python/Python.win64.framework/python.exe
If you have any question left, please let me know.
Cheers,
Maxime. -
Thanks firstly,you have made perfect answer i need, And i will keep your reminding about usage of QA functionationlty correctly in my mind.As your suggestion, i wonder if i tranfer my project from R19 to R20,are there some sources needed to change because of Compatibility? (PS: my project is made up of C++codes with a little bit of python)
-
@m_adam I have read maxon offical API Transition about R20 just before, And it made me a little bit astonished,which there are many changes in API between R20 and R19. It really puts my thought off even if i would like to use c4dpy as my python interpreter (╯ ̄Д ̄)╯
-
Hi, @zhhm156 you can see the list of python changes from R19 to R20 in this page, but pretty much all pythons scripts can be transferred from R19 to R20 without any change needed.
For C++ there is more work needed, but you can search in the forum with the correct tag(it's why tagging is important, so please make use of them) or even in the SDK directly.If you have any questions regarding the migration, please open a new topic.
Then finally here is how to setup c4dpy in pycharm for an R20 project.
Cheers,
Maxime. -
Hi @zhhm156
I'm wondering if your question has been answered. If so, please mark this thread as solved.
Cheers,
Maxime.