Maxscript needed?

Hi Forum,

I currently encountered an interesting problem about selectioning specific objects in a scene (Max 6).
For example:
I have a scene where (for import reasons) a large number of primitive cylinders exist. All those cylinders share the same parameters (even materials) except one detail: A part of them is of a different radius then the others.
As I want to delete those thicker ones and it makes no sense selecting them one by one (10.000 objects) I would need a selection filter that points those thicker cylinders out (the thickness is always the same among those thicker ones).

I wonder if anybody encountered similar situations and what solution would be the best.

Thanks in advance,

Daniel

--select all objects to filter out

x=10
--radius to trigger

filteredobjects=#()

for i in selection do
(
try (
if i.radius >= x then append filteredobjects i
)
catch()
)

clearSelection()
for i in filteredobjects do selectMore i

--filtered objects should remain selected now

Hi,

as you’re talking about imported geometry, i doubt they still have a radius property, so you might try it with absolute values

first, select one of the big cylinders and type

$.max - $.min

into the script command line. You’ll get something like f.ex.[63.5234,63.5234,150.222]
The first value is the diameter, so if you want to select all cylinders bigger than a certain diameter threshold, you got to edit that value in the script. For sure you can measure out that value as well.
Then select all cylinders and go.


bigones = #()
diameter = 60 --parameter to edit

for i in selection do
(
a = i.max - i.min
if a.x > diameter
then append bigones i
else()
)
select bigones

Hope this helps,
Michael

edit: for sure, the first value is only the diameter if the cylinders are straight up - else you gotta choose the appropriate one. When they’re all rather randomly rotated, my script won’t work as it only checks the bounding box in worldspace.

Thanks guys,

I’ll try that out.

@sushidelic:

Even imported they remain primitive cylinders, as they are vrml objects and 3dsmax knows to translate them to own native cylindres.