API Documentation


(Florian) #1

Hi!

now as blender.nl is down more or less, where can I find a documentation of the Python API for Blender 2.2+ ?

I suppose, only Polygon-based geometry can be accesed via Python…?
I can´t manipulate Nurbs and Beziers, right?

Please answer.

Thx,
Florian


(theeth) #2

The Python modules are self documentable. Each function has a doc property, which are called docstrings, that contains information about that function (or module/class/anything).

There is a script called DocBrowser that can help you visualize them. You can download it there: http://mysite.iptic.com/virtualblender/Script/doc_browser.zip

I suppose, only Polygon-based geometry can be accesed via Python…?
I can´t manipulate Nurbs and Beziers, right?

exactly, you can only access mesh (well, only partly true. You can access beziers, but only for IPOs)

Martin


(Florian) #3

thanks, Martin

unfortunately choosing Object or NMesh is forcing Blender to crash (WinXP, Blender2.23); I´ve tried to walk down the Object-chain manually, but recursion and maybe other things also cause a crash.

EDIT: I changed to 2.12 and everything works fine now :slight_smile:


(gavinb) #4

exactly, you can only access mesh (well, only partly true. You can access beziers, but only for IPOs)
[/quote]

I just found this out the hard way :frowning:

I have a Python function that generates X/Y/Z points for a bezier curve. I really need to be able to programmatically generate a bezier, but if I create one manually and do a “print obj.getType()” from my curve, I get “<Unsupported>”.

Does anyone know of another way I can generate a curve from Python? I really need a bezier because I have to extrude a cross-section along its length.

Failing that; I could manually position each point. Tedious, but it would work. In which case, how do I input absolute X/Y/Z positions for points in a curve?

Thanks very much for any advice…


(gavinb) #5

I just found the ‘N’ key, so the last question is solved. (RTFM!)

Still, it seems the API exposed to Python is very limited, so any info on the previous question would be great.

::g


(Florian) #6

yes, that´s a shame!
I´m looking for a way to export nurbs -CVs

As the API seems to change with every version, I just found out that
you can use older ones by writing something like:
import Blender210 As Blender

Florian


(LukeW) #7

Hi,
I tried running that doc browser script, and like Florian, it crashes when I try to browse NMesh or Object in 2.23… I’ve tried opening it up in versions 2.12, 2.20 and 2.22 but they always say “No module named types” when I try to run the script…


(jms) #8

No problem with B2.20 win32, try to download the full scripts at:
http://www.download.blender.pl/mirror/
in the blender2.14 demos files.

To see the NMesh docs, use this script with B2.25.
You have only to remove lines :
“import Blender210”
in info and doc_browser.py

regards