Call displayconduit from command class

i am not sure if this question is very clever, but here we go:

i am trying to set up a simplified environment to develop my plugins - something like processing, where you can call draws, input etc. all from the same class/method.
So when it comes to displayconduit - i have to pass my drawing data as a class to the Displayconduit class, where i have to have the proper code in the e.g. postdrawobjects override.
How to simplify this to the point where i can have a drawpoint() method in my main class / other classes, without having to change things in the override?

My only idea now is to have a static class that collects all the draw calls across the program, and then dumps them in the displayconduit - that would work, but i guess there has to be a better method?

thanks!

Hi atair,

Am I correct in thinking that you want to have one conduit running, and every time you call DrawPoint(), you want some point to be drawn in addition to what is already there?
If so, I would set up a class derived from DisplayConduit, that has a) a list of points as a property, and b) an override of one of the draw commands that draws all the points in the list.
Then in my command class, I would have a function DrawPoint() which adds a point to that list, and refreshes the view. I’ve added some snippets below to clarify. You will have to instantiate the conduit before calling the function, as it is one of the arguments for the DrawPoint() sub.

Hope that helps, let me know if it isn’t clear/doesn’t work.


Class DrawPointConduit
Inherits DisplayConduit

Private Points As List(Of Point3d)
Public Property PointsForDrawing() As List(Of Point3d)
    Get
        Return Points
    End Get
    Set(ByVal value As List(Of Point3d))
        Points = value
    End Set
End Property

Protected Overrides Sub DrawOverlay(e As DrawEventArgs)
    '(change the function arguments to draw the points differently)
    e.Display.DrawPoints(Me.PointsForDrawing, 1, 1, Color.Black)
End Sub

End Class


Class Command1

Sub DrawPoint(ByVal doc As RhinoDoc, ByVal SomePoint As Point3d, ByVal ActiveConduit As DrawPointConduit)
    ActiveConduit.PointsForDrawing.Add(SomePoint)
    ActiveConduit.Enabled = True
    doc.Views.Redraw()
End Sub

End Class


the next days i am overloaded with work, so i don’t have the time to test it,
but it very much looks like what i was searching for!
thanks!

After the weekend i will post my findings