Drag from dialog - drop onto scene object


#1

Hello

How I can implement in RhinoCommon dragging something from my dialog and dropping it onto some scene object?
and of cause process dropping somehow - i.e. assign some custom data to attributes


(Dale Fugier) #2

Sorry, no. But the older Rhino.NET SDK does via the RMA.Rhino.MRhinoDropTarget class.

Here is an example of its usage:

To use Rhino.NET in a RhinoCommon plug-in, just add a reference to Rhino_DotNet.dll, which is found in Rhino’s SYSTEM folder. Make sure to set the reference’s Copy Local property to False.

More on Rhino.NET:

http://wiki.mcneel.com/developer/dotnetplugins

Note, adding drag & drop support to RhinoCommon is on the V6 list.

http://mcneel.myjetbrains.com/youtrack/issue/RH-27795


#3

great, will try it, thanks!


#4

It works:)

but how can I convert IRhinoObjRef here
OnDropOnObject(IRhinoObjRef objRef, MRhinoView rhinoView, DataObject data, DragDropEffects dropEffect, Point point)
to RhinoObject?


(Dale Fugier) #5

Instead of “converting”, you might just lookup the object by it’s runtime serial number.

For example:

void OnDropOnObject(
  IRhinoObjRef objRef, 
  MRhinoView rhinoView, 
  DataObject data, 
  DragDropEffects dropEffect, 
  Point point
  )
{
  IRhinoObject rh_obj = objRef.Object();
  if (null != rh_obj)
  {
    Rhino.RhinoDoc doc = Rhino.RhinoDoc.ActiveDoc;
    if (null != doc)
    {
      Rhino.DocObjects.RhinoObject obj = doc.Objects.Find(rh_obj.m_runtime_object_serial_number);
      if (null != obj)
      {
        // TODO...
      }
    }
  }
}

#6

thnaks! will try it