Question

I would like to create infobox functionality in AutoCAD. Same as you hover some feature in Google Earth, it shows you infobox with picture.

Something like this

I was thinking about using palette, but I'm not sure how to adjust it to looks like infobox.

I'm planning to create .NEt plugin.

Any suggestions?

Was it helpful?

Solution

**Well, I found I think the best approach, using AutoCAD tooltip. Here is the code snippet:

Autodesk.Windows.ComponentManager.ToolTipOpened +=
            (s, e) =>
            {       
                Autodesk.Internal.Windows.ToolTip tooltip =
                s as Autodesk.Internal.Windows.ToolTip;
                if (tooltip != null)
                {                     
                        var image = new System.Windows.Controls.Image();
                        var bitmapImage = new BitmapImage();
                        bitmapImage.BeginInit();
                        bitmapImage.UriSource = new Uri(@"C:/index.jpeg");
                        bitmapImage.EndInit();
                        image.Source = bitmapImage;
                        tooltip.Height = image.Height;
                        tooltip.Width = image.Width;
                        tooltip.Content = image;
                }
            };

It looks fine to me now. :)**

As I said in comment below here is the screen shot of this solution

enter image description here

As you can maybe note, tooltip is not positioned near geometry, I selected the pink one. That is my last problem. My flow is that when I select object, I got win form listBox that offers me several image files connected to this entity. When I choose one, it opens tootltip, but it seems relatively to listbox dialog. I was not able to find solution how to manually set tooltip position. Any suggestions?

OTHER TIPS

Using PointMonitor, detecting if an entity of your concern being under the cursor position, and popping up your own window when applicable holding the images in a listbox, combobox or like is more controllable and flexible. The window can be WPF or WinForm of your choice.

It's definitely doable and some applications already use these techniques quite maturely. Some coordination transforming stuffs have to be taken into account, such as from window pixels to AutoCAD display system, from DCS to WCS, back and forth.

Now, the only remaining thing may be performance. Hope the following tips are of a bit help.

  1. Caching the previous entity id. If the cursor is still hovering on it, do nothing but keeps the previous image there.
  2. If users move the cursor so quick from one entity to another, the previous window may not be necessary to be discarded and a new one created. Replacing the images should be enough and just good.
  3. Providing different resolutions of the same images, like thumbnail, preview or fine and display them at different times such as if the cursor hovering shorter than 1 second just the thumbnail and if longer than 5 sec showing the fine picture.
  4. Better give users some ways to configure these.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top