3ds Max Script: Reparent Groups to Objects


I am a user of 3ds max 2016 64bit (Win 7)

I do import Inventor files (aim, ipt) into 3ds max.

My problem is that 3ds max imports inventor´s assembly as a group.

For example I have a scene in 3ds max which looks like: one group (called Assembly) that contains three objects (meshes)


- Object01
- Object02
- Assembly_Pivot

So, I would be very grateful if someone could help me make a script that would do the following:

Find if there is a group in the scene, if so open it, find the object inside this group with the same name (but with postfix _Pivot), and replace this group with this object (as a new parent).
So it means Assembly will be deleted and replaced with Assembly_Pivot, which becomes a new parent of other objects which were in Assembly..
The pivot position of Assembly_Pivot cannot be changed (or position of Assembly_Pivot), meaning, it cannot inherit the pivot position of Assembly.

So new scene after the script will look like this:

- Object01
- Object02

Thanks a lot in advance for the help.