How to create a preview of families

Hello,

i wanna start to create a family browser. where a user can see what he selects…

i got this 2 links, but how can i create that ?
2024-05-22_10h48_53

grafik

# 🦺 class
class FamilyPreview(forms.WPFWindow):
    def __init__(self):
        forms.WPFWindow.__init__(self, 'FamilyPreview.xaml')
        for el_id in uidoc.Selection.GetElementIds():
            el = doc.GetElement(el_id)
            ftype = doc.GetElement(el.GetTypeId())
            image = ftype.GetPreviewImage(System.Drawing.Size(96, 96))
            self.preview_img.Source = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(
            image.GetHbitmap(),
            System.IntPtr.Zero,
            System.Windows.Int32Rect.Empty,
            System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions()
        )


FamilyPreview().show_dialog()

how can i implement this class ? does anyone have an example ?

i want to “replicate” this button:

1 Like