When using rs.ProjectPointToMesh the documentation says that it will return a list of points. Instead this is happening. It is not a Python list and does not behave like a Python list.
Thanks, this is a little better than my current work around.
I should have added that rs.ProjectPointToMesh worked properly in Rhino 7 but does not in Rhino 8. It changed. I thought the transition from 7 to 8 was going to be easier but it took the whole day to track little issue that were not there before.
import rhinoscriptsyntax as rs
import Rhino
pt_ids=rs.GetObjects("Select points",1,preselect=True)
if pt_ids:
mesh_id=rs.GetObject("Select mesh",32)
if mesh_id:
dir_vec=Rhino.Geometry.Vector3d(0,0,-1)
result=rs.ProjectPointToMesh(pt_ids,mesh_id,dir_vec)
print(result[0])
print(type(result))
Output: 1,1,0 <type 'Array[Point3d]'>
Same script in V8 in ScriptEditor with #! python 2:
Output : 1,1,0 <type 'Array[Point3d]'>
Same script in V8 in ScriptEditor with #! python3:
Output: 1,1,0 <class 'Rhino.Geometry.Point3d[]'>
So yes, there is a difference, but one still seems to be able to parse the list by index.
Not all the rhinoscriptsyntax methods have been adapted for python 3 and I’m sure there will need to be some fixes, as well as some adaptation by people who write scripts.