Remove duplicated geometries?

I have a map, however some of the geometries are duplicated, how to remove them?

They have the following characteristic:
1. same pivot
2. same texture

so basically everything is the same, thanks!

Comments

Comment viewing options

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

Nice one Barigazy, very

Nice one Barigazy, very useful, can this be made to work on duplicate splines easily ?

barigazy's picture

...

Only if splines share same pivot ei. positions in the scene.
Works on any kind of max object.

barigazy

asymptote's picture

Oh you f***ing beauty !! I've

Oh you f***ing beauty !!

I've been searching for a way to do this for weeks, your pivot comment was the solution, after centering the pivot on all the dupe splines it works perfectly!

http://www.screencast.com/t/wRWEHzc7Dxh

Many thanks!

YoyoGraphics's picture

Hello. Sorry to dig up an old

Hello. Sorry to dig up an old thread. I thought perhaps this code would work for me but I got the message:
-- Syntax error: at ), expected
-- In line: )

Here's my situation: A couple CAD files I've imported (into Max 2016, which retains instancing) have between 16k and 20k objects in them. Hundreds (maybe thousands) of these objects are duplicate instances that I don't need, and cause rendering problems. So I need a script that will delete duplicate instances of objects. However, to make sure all my instanced nuts and bolts remain, the script should only delete the extra objects that have the same pivot point.

It would probably be doable by hand if the objects had proper names, but most of these objects came in with the exact same names as hundreds of other objects.

Thanks. I hope you can help.

- Geoff

barigazy's picture

...

Try this function
BTW you can use "mode" argument as:
- #originals (when you want to select first ei. original objects)
- #duplicates (to select all object that have same position as original objects)
Also when you want to delete selected object use argument "del"

fn doubleSelect mode: del:off =
(
	local objArr = objects as array
	local uniqueObjs = dataPair node:#() hash:#()
	for o in objArr where (findItem uniqueObjs.hash (e = gethashvalue o.pos 0)) == 0 do (append uniqueObjs.hash e ; append uniqueObjs.node o)
	case mode of 
	(
		#originals: (select uniqueObjs.node)
		#duplicates: (select uniqueObjs.node ; max select invert)
	)
	if del do delete selection
)

EXAMPLE

-- select only originals and don't delete
doubleSelect mode:#originals del:off
-- select duplicates and delete
doubleSelect mode:#duplicates del:on 

barigazy

barigazy's picture

This is untested code just

This is untested code just try and tell my how works for you

geoArr = geometry as array
while geoArr.count != 1 do
(
	lastObj = geoArr[geoArr.count]
	idxArr = #() ; cnt = #() ; objArr = #()
	for o = geoArr.count-1 to 1 by -1 where lastObj.pos = geoArr[o].pos and \
	lastObj.material = geoArr[o].material do (append idxArr o ; append objArr geoArr[o]
	if idxArr.count != 0 do
	(
		delete objArr
		cnt = append idxArr geoArr.count
		for i = 1 to cnt.count do deleteItem geoArr idxArr[i]
 
	)
)

barigazy

YoyoGraphics's picture

Thank you for helping. I'm

Thank you for helping. I'm afraid nothing happens when I run the script though. :o/

- Geoff

barigazy's picture

...

First run the function then run one of theses two codes below

barigazy

barigazy's picture

double_select_tool

Try with this tool

AttachmentSize
bga_doubleselect_v1.0.ms 1013 bytes

barigazy

barigazy's picture

U can use the next --check

U can use the next
--check distance
--check bounding box
--check ClassName
--check transform
--check modifiers count etc.
Try by yourself and show me your result.
Just u need to change one line of my code

barigazy

Comment viewing options

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