ScriptSpot home

Find identical geometry and instance it

Downloads

All files (3)
3ds Max compatibility
See original listing claims
Community compatibilityNo compatibility reports yet

No reports yet for the available releases.

Community reviewsNo reviews yet.

Listing details

Version
Version 2 Revision 1
From original requirements
2008 or newer
Original version requirement
MAX 2008 and later
Author’s update date
Legacy votes
35
Listing created
How compatibility works

Compatibility comes from the author’s supported range or requirements in the original listing. A tested version records what the author tried.

“2020 unconfirmed” in the catalog means support for 3ds Max 2020 is still unknown.

Community reports record successful tests on specific releases.

Posted by

enthed

Credited author: 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.

Setup & notes

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

Comments (25)
Kevin Merino

Thanks for sharing this! Works well.

I have the same need as you described with repurposing CAD data. This works well! Kudos to you!Thank you!

Sergey

Improvement

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

Sergey

Improvement

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?

Mousa Abu Doush

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.

https://www.dropbox.com/s/fih1sadfv2j5qti/light-part.max?dl=0

Mousa Abu Doush

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

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

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

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.

Attachments
milie

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.

lantlant

Not only to find the same objects, but it also calculates how transformations were wearing ...
For me, this is incredibly good.
Other scripts have not found that it could.

Graph

anubis and enthed, if you want to make it faster and better there are a few simple things you can do.
first off leave the worldTM out of it and multiply the positions of items (verts faces ect) by the inverse transform to get em to local space, then dont check all faces or verts if you check 42 of 3k verts for their relative position in the mesh and they match the index and position its highly likely the meshes are equal.. plus it will create a seperate reality everytime you run it .. if you got that joke grats at your memory ;)

tomastnt

Hi. I tried this script on easy scene width 20 objects importet by 3DS format from sketchup, but script doesn't work properly. See the attachement. Your script helped me, but on this object doesn't work and i don't know where is a mistake. Thank you.

Attachments
lantlant

goooood script :)

Reply to jedie
Panayot Karabakalov

Thanks Jedie, I still work with Max2009, and I glad to hear that my script is compatible with objects that even I've no seen yet :) also I appreciate your advice to merge both scripts. If Martin permit I could add his face topology checks as an option to my script.

Yes, I saw your script "Anubis" but it really don't solve the problem I was after, if you are not hiding that in something I can't see of course. That is if you have imported geometry from a CAD system, you normally get several nodes that should be instances but have different orientation and different transforms.

1st, I have tried to take care of that, so even if they have different transforms and pivot points according to the geometries direction it will solve the instancing. I use their first face transform of the both objects to translate the instanced node to the right place.

2nd, Even if the face count is the same you can't be certain that the models are the same so I try to do a topology check on each face, maybe not the fastest one, but still it's there ;-). I can't see that in your script.

Your script looks more professional than mine so you could probably redo my script with above features if you want too !!! ;-) If you do I would love to see it.....

/Martin

Reply to enthed
Panayot Karabakalov

In my code (it's just an quick example) show how I'll struct logical the code (to can extend it with more comparing options), and yes, that topology check on each face I found as slow. I see your point to go on this way, I just think so there must to be some more faster way... Sorry so dubd your script ;) Don't worry, you done good script, am just a mxs maniac (lol). I'll post another script that also will not sort your issue with CADs objects but may will bring to you some ideas :) [edit] It's here: http://www.scriptspot.com/3ds-max/scripts/select-similar-objects

[edit 2] ...if you attach a small example max scene file (with few imported CAD objects) just to test on it, I'll check it out later on to see if I can find something.

cheers,
Anubis

Reply to enthed
Panayot Karabakalov

Unfortunately I cannot open the scene file. Recently I saw the same missing dll error and only can guess it come from files maded in Max 2010. I forgot to insert so I work on Max 2009.

Missing DLLs

Reply to enthed
Panayot Karabakalov

Thanks for the file. I already have an idea that work fine here, but now I can test it better on your file. Of course, as any man and I have to fight with my problems, so I can't tell when I'll done with this task (just hope will be soon).

[edit] I was done something, attached ;-)

Cheers,
Anubis

Attachments
satori

Cool man, always wanted something like this!
Thanks!!