Select Scene Geometry Through Array Comparison
Hello!
I finally decided to take some time and delve into Maxscript. I find it very exciting! But at the same time, a bit tough in terms of the learning curve.
I am currently trying to understand arrays.
What I want the script to do:
1. Obtain all the geometry names and positions (Assign them to specific arrays)
2. Based on a preset index range -- Example: objIndex = #{2..5} Get those names
3. Store only those names from the range in a new array
4. Compare the names in the new array with the scene geometry
5. If the scene geometry names match the new array names then (do something) -- Like Delete them
Here is the script I have so far: -- I know I am probably doing this in the most terrible and destructive way. Forgive me lol.
(
local GAPos = #()
local GAName = #()
local GASel = #()
(
GAPos = for o in geometry collect o.pos
GAName = for m in geometry collect m.name
)
GAIndex = #{3..5}
GASel = for k in GAIndex collect (GAName[k])
)

Comments
Wow!
Wow! Thank you for the comprehensive breakdowns and multiple examples.
I will take the next day or 2 to really try and wrap my head around each of these.
I ran into another situation and was curious how this could be accomplished in an array.
Is it possible to select objects within an array if they are greater than a specific index value?
I know this isn't right** But for the sake of an example:
index = {2..infinity} -- or any value greater than 2
Thanks again!
.
Tools and Scripts for Autodesk 3dsMax
.
I don't know why you want to works with the name of the objects, but...
Step by step.
Now examin the codes from barigazy and you will be more familiar with the arrays. :)
Tools and Scripts for Autodesk 3dsMax
...
This is the one of many ways.
bga
...
U can consider these few way also
bga
...
The smart way is to create an function with some arguments.
Try to do this and post it here. All info you can find in MaxScript Help document
bga