Drag-drop from add on to model

I want to implement drag and drop functionality from my Add-on into into the world of Visual components (similar to the ecatalog functionality)
Is there any information available how to implement this?
Thanks in advance!

Hy,

I would start here:

Regards

Thank you. Looks very promising.
Do you know were to find this object in code?

Hy,

help says:

Regards

Sorry, My question was not clear.
I want to catch the event if something is dragged from my addon to the main VC viewport.
Creating a new object from this class, is not linked to the main viewport.

Do you know where I can find the object of this class, where the event for the drop is raised.
image
The first options (var m) does not provide the ‘drop’ methods.
The second options is not triggered when I drop something in the main view.

Hy,

hmmm and what happens if you set:
HelperViewport.ActiveViewport = m;
before subscribe to event?

If this is also not working may a VC member could give a hint?

Regards

This gives an error as the types are not compatible. Even explicit casting to the correct type is not possible.

Regards

Hy,

which Type ist expected?

Regards

It expects a Viewport3D
And I don’t have the ActiveViewport in the Helper class

Not sure if it works, haven’t tested, but you could try something like this:

var viewport = IoC.Get<IViewport>();
if (viewport != null)
{
    var frameworkElement = (viewport as Screen).GetView() as System.Windows.FrameworkElement;
    HelperViewport viewportHelper = frameworkElement.FindChild<HelperViewport>();
    // use the viewportHelper here
}
2 Likes

Thank you.
This works perfectly!