[codesyntax lang=”python”]
#****************************************************** # Find the distance between two objects # # - VueTapeMeasure.py # - Finds the Distance between two objects # - By Mark Caldwell # - Version 0.1 # - 3rd July 2007 # - Copyright Mark Caldwell 2007 # - Tested with Vue 6 Infinite # # How to use in 3 easy steps # # 1. Download this file onto your computer # # 2. Select 2 Objects # # 3. Then run script and wait for it to work # To run it go to Python -> Run Python Script # Then locate the file on your computer # #****************************************************** from math import sqrt countobj=CountSelectedObjects() if countobj>1: object=GetSelectedObjectByIndex(0) pos1=object.Position() object2=GetSelectedObjectByIndex(1) pos2=object2.Position() x=pos2[0]-pos1[0] y=pos2[1]-pos1[1] z=pos2[2]-pos1[2] d=sqrt(x*x+y*y+z*z) Message ("Distance: "+str(d),"VueTapeMeasure") #---------------------------------------------- # End of Script #----------------------------------------------
[/codesyntax]