Before I even attempt it.

Ok, I VERY new to the blender API, I have no idea how to use it really, but I do know how to code in python.

I want to know, how hard do you think it would be fore a newbie like me to go and make a script that would make a hydraulic cylinder and attach its ends to two empties that are already made with a certain name?

I just thought of it, and thought how perfect it would be to at least create pistons for concept productions of mechanical objects made in blender.

I suppose that this isn’t the point of your question at all… but wouldn’t it just be easier to model the piston and attach it to the empties yourself?

As far as your question goes, my experience with python is limited to the game engine, so I would google the tutorial about making polygons with python in blender. The math part of the script should be pretty simple, as far as placing the verticies, but the script shows how to connect them and fill faces. Important stuff. Also, here’s the blender api link in case you don’t already have it.

I think what you might be after is script-links. They do a similar thing to how the MEL is set up in Maya. You can do quite complex animations with them that otherwise would me much harder or sometimes impossible with the animation tools. There was a Python contest not too long ago showing some excellent uses of Python though they weren’t using script-links, just normal code. The difference with a script-link is that you can code something and change it and it will update the animation, whereas with a standalone script, you’d have to set the keyframes.

Actually, some of the scripts did use script links in the python challenges (I know at least one of mine did).

I’m thinking python may be overkill for what your doing though, since script links, unfortunately are not what I’d like them to be, since they do not store the previous state of meshes (since that would be highly memory intensive), meaning that when you have a script linked to the change frame action, it will advance the animation by one frame whether you go forward or back. This means no “rewind” of course, which is a horrible workflow for real animators. The other option is to generate IPOs, of course, but depending on the number of objects, this can get a little heavy on memory and CPU as well.

For things like pistons, its probably best and more efficient to actually use the armature and constraint system already in place, rather than trying to reinvent the wheel, unless there is some behavior of pistons you need that cannot easily be achieved via armatures and clever animation.

Ok…Sorry…Reread your post (all that’s above is still valid stuff to consider as you get more and more advanced, though)…

As far as parametrically modelling a hydraulic cylinder (which I will continue to call a piston for ease of use), it shouldn’t be too hard unless you are looking for some wacky shape. I assume you pretty much mean a couple of cylinders modelled in different parts, which should be relatively easy.

Attaching empties should be relatively trivial as well, once you know the API.

Good Luck.

well, in my experience, sometimes it would be easier just to have a WYSIWYG type python interface to simply model a piston, but not to be used as a final product.