Find identical geometry and instance it

34 votes
Version 2 Revision 1
Date Updated: 
Author Name: 
Martin Enthed

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

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.

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... ;-)

Version Requirement: 
MAX 2008 and later
Find_Identical_geometry_and_instance_it_v02_r01.ms5.73 KB
A testfile for the script.... MAX 2010 format1.88 MB
A testfile for the script.... Collada format808.36 KB


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
chernomorets.sergey's picture


For a more predictable result, which instance will be taken as a basis, I suggest taking the last object from the selection.

chernomorets.sergey's picture


Not always instances are oriented correctly. What if to check not the angle between the normals of the faces and the distance between the centers of the faces, but to compare the positions of the corresponding points in the space of the first face? Have you tried this method?

DOUSH-007's picture

Objects are moved from its places

Hello,I apply this script to this model I attach it her, before applying the script i reset Xform for All geometry but when i apply it some of geometry are moved from it place and some are rotated, and i wish if you can tell me how to solve this problem, thanks in advance.

DOUSH-007's picture

Multi core possibility ???

Hey,first thanks a lot for this script,I'm interested to develop this script to be multi core script to be able make a huge calculation in short time , there is any possibility ????
Thanks in advance.

lantlant's picture

1 create box (box 01) 2

1 create box (box 01)
2 making a copy of boxing (box 02)
3 convert mesh (box 02)
4 convert poly (box 02)
5 convert poly box 01
6 Findidentical run and did not find out the identity of the script

and we fix it?
is messed up, it Improves the
7 convert mesh (box 02)
8 convert poly (box 02)
9.Findidentical run and find the identity of the script
I do not know why.
It really is a bug.

milie's picture

Is there a way to specify

Is there a way to specify what object will be the reference one? Eventually with a name suffix, like _master ?
I saw that the object with the starting vertices is taken as reference.

milie's picture

I have a question, how does

I have a question, how does the script detect what object it takes as a reference?
Because i've encountered an issue when i've cloned a bunch of cylinders, and gave them different transforms + resetxform, but kept one "straight".
The script didn't take the straight one as a reference, but a rotated one, and broke the original one rotation.

I've attached a max file for example. There, Tube_01 is the straight one but the script takes Tube_00 as being the reference one.
In fact, Tube_00 was the first created.

test_instance.max 276 KB
lantlant's picture

Me and I needed a version

Me and I needed a version that has a ProgressBar:

(the only difference is the progressbar in the original script)

lantlant's picture

of course

of course,
only one word to replace :)

This script will only work on the selected objects.

milie's picture

Awesome script, especially

Awesome script, especially propagating the transform of the original mesh.

Is there any way to do this calculations only on visible objects, because, for example, some of them i don't want to be instanced, and i could easily hide them.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.