SOLVED Getting points and edges of parametric objects

Hi folks. Is there a way to use the "GetNearest" functions on parametric objects ? Like Cube and Sphere and so on.

ViewportSelect.GetNearestEdge(op, x, y, maxrad=MAXLONGl, onlyselected=False, ignorelist=None, ignorecnt=0)

If the target object is not editable I get:
RuntimeError: Object is not initialized yet

I've tried currentstate and makeeditable, but the result is the same.

Hi Kalugin
A parametric object cannot be used in point, edge or polygon mode. You need to convert it to a polygonal object

what if I want to code my own snapping ? How can you snap to points of parametric objects ?

Make a clone, which you then delete, which serves as a reference and reports the coordinates on your parametric object.
This is the principle I use in my OnFloor plugin, to position a parametric object on the ground.

Nevermind. I figured it out 🙂 It was my mistake in the code. I made myself a helper function to initialize the ViewportSelect object, and I was initializing it with the wrong object. That's where the runtime error came from. Thanks anyway.