Forum Groups
  All forums
    Help & Feedback
      Questions
      Work in progress
      Finished Art
      Non-Max related
    Community
      Offtopic
      News
    Hardware
    Photography



Maxunderground news unavailable

Maxscript help
show user profile  Krogoth
I've just started learning maxscript and I wrote a few little scripts that work with the layer manager, but now I'm trying something else, and I need some help. I have a scene that is a model of a chemical plant/refinery, and it has a lot of pipes (First image below).

What I would like to do is to have a script that would allow me to select the end of a pipe run (or any pipe, doesn't have to be the end), and have it select the rest of the pipes that are connected to it. (Second image below)

I found a few intersect scripts and tried them, but unfortunately, the pipe ends are touching each other, the vertices are on the exact same coordinates, but 3ds max does not count that as an intersection, so the intersect command does not work. I thought about having it expand the bounding box on the end of the pipes, but the intersect command works with specified nodes, and I don't think 3ds max would appreciate looping through 10,000+ objects.




Is this even possible, or would it be faster to just manually select the pipes? I'm basically just moving each pipe run to a different layer so we can deal with it easier. The end result is to export it all out one pipe run at a time. I know it probably won't be able to handle the elbows and tees, but I'm just trying to find a way to speed this task up.

Any help would be appreciated.

Thanks,
Krogoth

read 576 times
7/13/2014 4:29:57 AM (last edit: 7/13/2014 4:29:57 AM)
show user profile  Mr.Burns
You could move all the first and last vertices of every segment by .1 or so along their respective vectors, then run intersect, then move all the verts back. No idea how Max would handle doing it with a huge amount of objects, but perhaps you could do it for say a few hundred at a time.
read 563 times
7/13/2014 10:56:08 AM (last edit: 7/13/2014 10:56:08 AM)
show user profile  br0t
A bit hacky, but I gave it a shot. Will test against complete scene, but only roughly first, whereas it can do a a more fine grained test on every intersection candidate if you set precise:True. I havent tested it on a heavy scene, may be complete overkill there. You may want to sort your objects by position and only test near objects against the current candidate.

Edit: Oh boy, I just tested it with a few more objects. Nope, performance sucks. The overlap fn ist actually waay slower than intersects, which I did not expect.

never get low & slow & out of ideas


read 542 times
7/14/2014 10:32:07 PM (last edit: 7/14/2014 11:18:07 PM)
show user profile  br0t
Simplified version, faster because using a single instanced modifier and without the boolean check, probably enough to do what you want:

If the pipe objects have proper pivots and you know they are always within some distance to each other you could speed up the whole thing by doing like: