Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5821

Best way to use Python to launch Rhino and then run some more Python

$
0
0

@JKolodner wrote:

Hi community folks,

The TL;DR is that I want to automate the use of Rhino and another tool using Python as the "master" program that is summoning the other apps to do specific tasks. What's the best way to have Python call an instance of Rhino, to then have Rhino fire up and run a RhinoPython script?

I'm trying to use Python to oversee some automation that incorporates multiple software tools, with a work-flow something like this:

Main routine starts

  • Initializes file lists of things to be processed
  • pulls configuration data from some .py or txt files that are meant to be edited/editable
  • Calls Rhino, telling it to initialize a particular Python script, which upon full initialization:
    • loads a 3dm file, then initializes a loop where it:
    • imports another geometry file (.ply in this case)
    • does stuff with the geometry
    • saves out the results as a new .ply file
    • cleans up the current .ply data, ready to load a new one
  • Calls other tool (CloudCompare), does some stuff, and saves out a result as a .stl or .obj
  • Calls a new instance of Rhino, with a different Python script, which:
    • loads a reference mesh .obj
    • imports the output mesh from previous processing
    • checks the mesh for integrity, fixes what it can, and bails on the attempt if it can't come up with a manifold mesh, logging it.
    • performs a mesh boolean operation between the meshes
    • If that succeeds, saves the resulting mesh as an .stl, otherwise error logs and moves on to re-setting the conditions for loading the next mesh.

When all the files initially queued have been processed (or error logged) the main routine quits, leaving that log for the user of what it could/couldn't accomplish.

At the end of the whole process I want a batch of STLs that have come from these processing steps that can't be all done efficiently or optimally in only one application, so I'm trying to "glue together" the tools from different apps to get the work done.

Any and all suggestions/code-snippets of recommendation would be very helpful!

And also, any suggestion as to what building such a tool should be worth to a client would be good information as well—I have no idea how to price coding work, as I'm a designer by background, and I'm learning my way here.

Posts: 4

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 5821

Trending Articles