Hi Folks,
Im trying to build a Script which positions all selected Vertices of some Mesh on the nearest Points on some Edge (from Reference Geometry). Till now I wrote a Script which checks the Distance between all my Selected Meshes and my Reference Mesh Vertices, and it works but its horrible slow.
convertTo obj Editable_Mesh
convertTo refObj Editable_Mesh
vec2 = (getVert refObj vec2)
vec1 = (getVert obj vec1)
NewX = vec1.x - vec2.x
NewY = vec1.y - vec2.y
NewZ = vec1.z - vec2.z
--calculates distance between to Vertices (Points)
betrag = sqrt((NewX*NewX) + (NewY*NewY) + (NewZ*NewZ))
print betrag
return betrag
Thats how i calculate the Distance till i reached the Reference Vertice with the lowest distance then i let my Vertex snap to his Position.
But how can i get the real nearest Point which migth lie on the Edge from this Vertice is there a way (Im not completly new to maxscript but still somehow a noob :D)?
Any help would be nice
EliDerDeli
miauu · 2018-05-25