Get Part Thumbnails for my Dockable Window in Add-In

Get Part Thumbnails for my Dockable Window in Add-In

Dev_rim
Advocate Advocate
431 Views
2 Replies
Message 1 of 3

Get Part Thumbnails for my Dockable Window in Add-In

Dev_rim
Advocate
Advocate

Hi,

I want to view my parts in my library folder in my dockable window. I use User Control(WPF) for my dockable window. I can't use Apprentice because Apprentice do not work in Add-Ins. How can i import thumbnails from specific folder to the dockable window. Thanks for attention.

I'm working on Inventor 2020 Professional, Visual Studio 2019, FrameWork 4.5

 

If my answer is solved your problem, please mark it as Solution

Freundliche Grüße / Kind Regards
0 Likes
432 Views
2 Replies
Replies (2)
Message 2 of 3

JelteDeJong
Mentor
Mentor

i use this code in my addon for showing tumbernails in my wpf form.

Inventor.Camera camera = inventorApp.TransientObjects.CreateCamera();
if (selectedRow.inventorDoc is Inventor.PartDocument)
{
	camera.SceneObject = MyDocument.ComponentDefinition;
}
else
{
	camera.SceneObject = MyDocument.ComponentDefinition;
}
camera.ViewOrientationType = Inventor.ViewOrientationTypeEnum.kIsoTopRightViewOrientation;
camera.Fit();

// get color for background Inventor.Color topClr = inventorApp.TransientObjects.CreateColor(255, 255, 180); camera.ApplyWithoutTransition(); // save image from camer. (you probaly dont want to see the view cub in the tumbernail there for hide it.) ExportToSap.m_inventorApp.DisplayOptions.Show3DIndicator = false; string imgPath = System.IO.Path.GetTempPath() + "SapExportTumbernail.bmp"; camera.SaveAsBitmap(imgPath, 500, 500 , topClr); ExportToSap.m_inventorApp.DisplayOptions.Show3DIndicator = true; // https://stackoverflow.com/questions/16908383/how-to-release-image-from-image-source-in-wpf System.Windows.Media.Imaging.BitmapImage image = new System.Windows.Media.Imaging.BitmapImage(); image.BeginInit(); image.CacheOption = System.Windows.Media.Imaging.BitmapCacheOption.OnLoad; image.CreateOptions = System.Windows.Media.Imaging.BitmapCreateOptions.IgnoreImageCache; image.UriSource = new Uri(imgPath); image.EndInit(); MyImageControl.Source = null; MyImageControl.Source = image;

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

0 Likes