Hello Lukas,

The is no real "automatic" way of optimizing a toolpath, because every application has got different constraints and degrees of freedom. For example with milling, you can rotate around the tool axis, because it is symmetrical. With the iiwa, you can adjust the redundant axis (but also not all the time, depending on the application).

In any case, Galapagos is a nice way to start experimenting with automatic optimization. So you get the Analysis component (available in the member version) and e.g. do a mass addition on the collision output (0 for an axis is no collision, 1 is a collision). Then you set your parameters for Galapagos to adjust (e.g. the value of the redundant axis) and let Galapagos minimize the fitness value, thus reducing collisions. Of course you can also do this "brute-force", by just evaluating ten different values or so and taking the best.

In general, the iiwa is slightly complicated when it comes to reachability because of its limited axis range.

One more thing regarding collision checking: Use the Rhino command "ReduceMesh" to reduce the complexity of meshes as far as possible (both tools and collision geometry).

Let me know if you've got any further questions!

Best,

Johannes