Pass Reference to WPFelementHost

rhino5

#1

Hi, in the Example given by Dale Fugier (https://github.com/dalefugier/SampleCsWpfPanel) to add a Wpf window to a Plugin, how do you pass the RhinoDoc reference to the WpfWindow?
could you give an implemented version please?
you take from the class SampleCsWpfPanelCommand the RhinoDoc doc reference from the RunCommand and it has to be given to the SampleCsWpfUserControl.xaml .
How to Implement It?


(Dale Fugier) #2

Hi Markus,

Anytime your panel needs the active document, it can just call Rhino.RhinoDoc.ActiveDoc. Does this help?

– Dale


#3

SWEET! I was just posting the exact same question!

    Bgr col = new Bgr(System.Drawing.Color.Red);        
    foreach(CircleF circ in circles){
        Img.Draw(circ, col, 3);
        Circle circle = new Circle(new Point3d(circ.Center.X, circ.Center.Y, 0), circ.Radius);
        RhinoDoc.ActiveDoc.Objects.AddCircle(circle);
    }
    RhinoDoc.ActiveDoc.Views.Redraw();