Extending Py4D with Third Party Packages [TUT]

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 12/03/2011 at 16:33, xxxxxxxx wrote:

Hi there !
I briefly want to tell you how to exten Py4D with third party packages.
Thanks to Sebastian giving me tips how to do it. 😉
I've started Python just 2 or 3 weeks ago, so I'm still learning, if anything is missing or even wrong, Sebastian, correct me please.

This is just how to install Python Packages, I haven't tried C Packages yet.

First, you need Python being installed on your system. If you haven't already installed it,
do this now. python.org

Then you need a package you want to install. You can get some here: Python Packages
You'll need the Package's Source, not Egg or something.
Got it ? Unzip the file and copy the content onto a Folder on your local harddrive.
For example: 😄 mp\mypackage
The Folder 'mypackage' should contain a 'setup.py' file.

Open your systems Commandline. You now need to change the directory. On Windows one can
use the 'cd' command, I don't know how to do it on other systems.

cd 😄 mp\mypackage

Then call this:

python setup.py build

If successful, a new folder has been created in your 'mypackage' folder called 'build'. In it
there's another folder 'lib'. All the content of this folder must be moved to the following path:

*$Userpath\MAXON\CINEMA 4D R12\library\python\packages$my_os*

$Userpath is not your Programsfolder. For example on my system it's the following:

*C:\Users\Niklas\App Data\Roaming*

Also, $my_os represents your Systems type. I've got Windows 7 x64 so my folder is called
'win64'.

Now you can import the package with Py4D. If you for example installed the pyfo Package, this is an example code:

  
import pyfo  
  
lst = ["MyValue", 9999, {"x": 12, "y": 14, "z": 16}]  
print pyfo.pyfo(lst)  

which prints the following:

<MyValue y="14" x="12" z="16">9999</MyValue>

And here's an easy-to-use BATCH for Windows users. Just drag your setup.py onto this BATCH File and copy the content of the 'build\lib' into your userpath.

PythonBuilder.bat

Cheers, nux

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 17/03/2011 at 14:51, xxxxxxxx wrote:

Please also take a look at the 'Import Patch' plugin.

Import Patch