Can Python do this?



  • On 12/03/2014 at 10:29, xxxxxxxx wrote:

    Hi

    I know nothing about Python so please bear with me if this is the mother of all dumb questions.

    I have to produce 62 models of industrial equipment. Certain parts of each model are coloured (all the same colour) and there are 12 different colour options. I have to produce a render for each colour option, so that's 62 models x 12 colour ways, making 744 renders in total.

    So the plan is to do something like this…

    Set up master scene that contains lighting and 12 materials.
    Bring in model 1.
    Drag all 12 materials onto relevant parts of model.
    Save version 1.
    Delete right most material tag.
    Save version 2.
    Delete right most material tag.
    Save version 3
    Delete rightmost material tag.
    Save version 4.
    And so on…

    The saved files will all be sent off to a renderfarm.

    So my question is, can Python automate the 'Delete rightmost material tag. Save version…' process so that, once I've applied the materials, I can just press 'execute' and it will delete the right most tag and save the file with a unique file name such as 'Sand Blaster 001', 'Sand Blaster 002' etc. into a folder of my choosing.

    I don't even know if this is the sort of thing that Python is used for, so any guidance would be appreciated.

    Thanks.



  • On 12/03/2014 at 13:40, xxxxxxxx wrote:

    Yes python can do that. Python is one step above COFFEE which could do this as well. It wont be easy if you are new to python.

    With only 12 materials It would be better to just have them named accordingly and search for your material rather than trying to automate the finding of the last material.

    Python is used for setups like you described and so much more! You can pretty much do anything you want with python From helping you animate, animating for you, automating tasks, creating plugins and pipeline development.

    The real question is what can't python do.



  • On 12/03/2014 at 14:38, xxxxxxxx wrote:

    Thank you for the reply.

    That's excellent news, though I thought there might be a "It won't be easy if you are new to python." sting in the tail!  😂

    How difficult would it be for someone who knows nothing? I watched some started tutorials earlier and I have to admit I was a little lost. Is this smoothing that's relatively easy for the experienced coder?

    And I think you're right, applying all materials and deleting might be a little convoluted. It might be better to get Python to sequentially apply the materials or even do something with the Vray override material.



  • On 12/03/2014 at 18:43, xxxxxxxx wrote:

    The biggest thing other then writing the code itself is figuring out how you want to do it. There is no one way to do something.

    As for difficulty, that basically depends on how well you can research (google). The sad part is, learning the cinema syntax so python can interact with your scene. There is documentation but that is it, a lot of the details are missing.  I found this harder to learn than python.

    here is the python documentation
    http://www.maxonexchange.de/sdk/CINEMA4DPYTHONSDK/index.html

    best of luck!



  • On 13/03/2014 at 00:34, xxxxxxxx wrote:

    Thanks for that and the link looks like my starting point. Seems I have some work ahead of me, though at least now I know that Python can actually do what I need. Nothing for it, then, but to get tucked in though, ultimately, I may have to pay someone to write the code if I find I'm getting bogged down.


Log in to reply