On 25/08/2015 at 10:54, xxxxxxxx wrote:
Hi! :)
They do not work GetNearestPoint and GetNearestPolygon
always error: Invalid object length
I tried to change the radius, but I do not get anything ...
def MouseInput(self, doc, data, bd, win, msg) :
mouse_x = int(msg[c4d.BFM_INPUT_X])
mouse_y = int(msg[c4d.BFM_INPUT_Y])viewport_select = c4d.utils.ViewportSelect()
frame = bd.GetFrame()
left = frame["cl"]
right = frame["cr"]
top = frame["ct"]
bottom = frame["cb"]
width = right - left + 1
height = bottom - top +1pick_objects = viewport_select.PickObject(bd, doc, mouse_x, mouse_y, rad=10, flags=c4d.VIEWPORT_PICK_FLAGS_0)
viewport_select.Init(width, height, bd, pick_objects, c4d.Mpolyedgepoint, True, c4d.VIEWPORTSELECTFLAGS_IGNORE_HIDDEN_SEL)nearestPoint = viewport_select.GetNearestPoint(pick_objects[0], mouse_y, mouse_y, maxrad=10, onlyselected=False, ignorelist=None, ignorecnt=0)
print nearestPointnearestPoly = viewport_select.GetNearestPolygon(pick_objects[0], mouse_y, mouse_y, maxrad=10, onlyselected=False, ignorelist=None, ignorecnt=0)
print nearestPolyreturn True