DrawLineFromPoint, DynamicDraw

In the example on this page:

http://developer.rhino3d.com/samples/rhinocommon/getpointdynamicdraw/

GetPoint.DrawLineFromPoint is used. I expect this to dynamically draw a line from the first picked point to the current mouse point. However, it does not show the line. It does dynamically draw the circle on screen though.

But in this example:

http://developer.rhino3d.com/guides/rhinopython/using_rhinocommon_from_python/

dynamic drawing of lines does work. What is the reason that one does and the other doesn’t work?

Hi Gijs,

Hard to tell without looking at your code. But here is an example that you might find useful:

https://github.com/dalefugier/SamplePy/blob/master/SampleCircleRadius.py

– Dale

@Gijs,

i am not 100% sure but my understanding is that the first example above does not show the line using GetPoint.DrawLineFromPoint because it creates its own class instance of Rhino.Input.CustomGetPoint in this line:

class GetCircleRadiusPoint (GetPoint):

and this overrides all dynamically drawn content by having its own OnDynamicDraw(self, e) function. The second example in comparison adds the dynamic drawn content instead of replacing or overriding it using:

gp.DynamicDraw += GetPointDynamicDrawFunc

To get it working in the first example, you would remove this line:

gcp.DrawLineFromPoint(center_point, True)

and add what it does to the OnDynamicDraw function like this:

line = Line(self.m_center_point, e.CurrentPoint)
e.Display.DrawLine(line, Color.Red)

c.

Thanks @dale ,

that works, I study your example.

and thanks @clement for the additional info, i will try your suggestions.