Script
Find identical geometry and instance it
EBy enthed · Credited author: Martin Enthed · 2010-02-27
- Version
- Version 2 Revision 1
- Version requirement
- MAX 2008 and later
- Date updated
- 2010-02-27
- Votes
- 35
Description
Everybody who have imported large amount of data from any cad system know that it normally kills the instancing. The intention of this script is to find geometrically identical nodes and instance them. This script will of course work if someone have used copy instead of instance in a scene and wants them instanced instead.
Added 2015:
I'm happy to see that so many have tried out my Sunday hack that I made 5 years ago...but as it was only something to do for a Sunday its not really something I support. I would love to, but my daytime job takes all my time ;-)
But the code is open so please take it and redo it....take the idea and redo from scratch or improve it (and there is a lot of possibilities to do that ;-)
The basic idea was to: Compare the geometries by looking at face order and relations between faces and disregard everything else. If they match, then instance and align the 1st face of the new instance with the object that matches, 1st face, before deleting the found object. This is to make it stay in the same position as before even if its a totally different pivot point and rotation.
Additional Info
To be instanced.....
The nodes needs to have:
Identical face count, same class, identical face topology and identical scale
The nodes does not need to have :
Identical Transform,Pivot point position, Materials, Parents or Children
Why:
I did not want to read a book and crosswords are boring so I thought I would make a type of script, that is far from what I do as a daytime job.
Improvement:
I have already got some hints on what to do, and I really appreciate it.
The really slow part is the compare geometry topology stuff. If the face count is big and they are very close to the same topology then it will go through all faces in both objects while comparing, and that takes time.
I have included a MAX and Collada test file for anybody that wants to test out the script or help me improve it....
Hope this can help someone in their daily work....
... and as always, don't run this before backing up your scene... ;-)
Tags: instance, find, geometry, auto, node