Job offer: Python code for restructuring a project

On 25/02/2013 at 05:00, xxxxxxxx wrote:

We are looking for someone who can help us with a current project.
Please send your application with your price to solve the following problem directly to: [email protected]

Questions? 089-69708608 (ask for Ronald Kissling)

Kind regards,
Ronald Kissling
www.vision4d.de

Project1:

Download sample project files here:
http://www.vision4d.de/downloads/restructure-project-files.zip

We need to navigate through an object structure with nested NULL-Objects with several polygon objects under them (it can start with a NULL, too!)
Some of the polygon objects have the same material assigned and we need these to become single objects (connectObjects&delete;)
The NULL-structure must be preserved.

The start structure could look like this:
Cube Material-1 #connect&delete; this with the next n objects(in this case 2) with the same material assigned:
Cube1 Material-1        +
Cube2 Material-1        +
Cube3 Material 2 #(do nothing, because no other object with material 2 follows directly)
Cube4 Material-3 #connect&delete; this with the next n objects(in this case 1) with the same material assigned:
Cube5 Material-3        +
Cube6 Material-1 #connect&delete; this with the next n objects (in this case 3) with the same material assigned:
Cube7 Material-1        +
Cube8 Material-1        +
Cube9 Material-1        +
Cube10 Material-2 #(do nothing, because no other object with material 2 follows directly, do NOT merge with Cube3, which has Material 2 as well)
Null
|-- Cube11 Material-1 #(do nothing, because no other object with material 1 follows)
|-- Cube12 Material-2 #(do nothing, because no other object with material 2 follows)
Null
     |-- Cube13 Material-2 #connect&delete; this with the next n objects(in this case 1) with the same material assigned:
     |-- Cube14 Material-2        +
     Null
     |   |-- Cube15 Material-1 (do nothing, because no other object with material 1 follows)
     |   |-- Cube16 Material-2 #connect&delete; this with the next n objects (in this case 3) with the same material assigned:
     |   |-- Cube17 Material-2        +
      |   |-- Cube18 Material-2        +
      |   |-- Cube19 Material-2        +
      |   |-- Cube20 Material-1 #connect&delete; this with the next n objects (in this case 1) with the same material assigned:
      |   |-- Cube21 Material-1        +
     |
     |-- Cube22 Material-3 #connect&delete; this with the next n objects (in this case 3) with the same material assigned:
     |-- Cube23 Material-3          +

The final structure should look like this (the cube auto-numbering is messed up by the connect&delete; action) :

Cube11 Material-1 (3 merged objects)
Cube3 Material 2 (no change)
Cube4 Material-3 (2 merged objects)
Cube6 Material-1 (4 merged objects)
Cube10 Material-2 (no change, do NOT merge with Cube3, which has Material 2 as well)
Null
|-- Cube11 Material-1 #(no change, do not combine with cube 11 or 6 above)
|-- Cube12 Material-2 #(no change, do not combine with cube 3 or 10 above)
Null
     |-- Cube Material-2 (2 merged objects)
     Null
     |   |-- Cube15 Material-1 (do nothing, because no other object with material 1 follows)
     |   |-- Cube Material-2 (4 merged objects)
      |   |-- Cube1 Material-1 (2 merged objects)
     |
     |-- Cube1 Material-3 (2 merged objects)

On 26/02/2013 at 12:47, xxxxxxxx wrote:

so basically, you would like to be able to select a node and search the entire hierarchy, merging any items that have the same material?