How to get adjacent vertices

How to get adjacent vertices

mihi0315
Participant Participant
540 Views
5 Replies
Message 1 of 6

How to get adjacent vertices

mihi0315
Participant
Participant

Hi,

Is there a way to get vertices adjacent to a selected vertex in maxscript?

It's like Houdini's "neighbours"

0 Likes
Accepted solutions (1)
541 Views
5 Replies
Replies (5)
Message 2 of 6

dmitriy.shpilevoy
Collaborator
Collaborator

You might want to use octree/kdtree. Go through this thread:
https://maxscriptbook.com/community/maxscript/%5bmaxscript%5d+kdtree.+can+we+make+it+faster%3f/
there is a ton of related code. 

Message 3 of 6

miauuuu
Collaborator
Collaborator
(
	selObj = selection[1]
	selVertBA = (polyop.getVertSelection selObj)
	vertEdgesBA = polyop.getEdgesUsingVert selObj selVertBA
	adjacentvertsBA = polyop.getVertsUsingEdge selObj vertEdgesBA
	polyop.setVertSelection selObj adjacentvertsBA
)
https://miauu-maxscript.com/
Message 4 of 6

mihi0315
Participant
Participant

thank you.
I'll use it as a reference.

0 Likes
Message 5 of 6

mihi0315
Participant
Participant

wonderful!
This is exactly what I wanted to achieve.

0 Likes
Message 6 of 6

miauuuu
Collaborator
Collaborator
Accepted solution

Keep in mind that this will select only vertices which have common edges with the selected vert.

https://miauu-maxscript.com/