I hope someone could help me with this.
I'm developing a tool similar to Insert command.
All I need is to get the thumbnail (image preview) from blocks in my drawing with vb.net application.
I'm Using VS2010, and API.COM to develop this.
I found how to do this with an external dwg file, but in this case i want to show the thumbnail from blocks in a drawing opened.
Thanks in advance.
Thanks for reply AubelecBE
I didn't know that command, but that command just updates the thumbnails blocks, but I want to show the thumbnail in a pictureBox.
I could do it from a file.
For example suppose you have a dwg file calls "c:\work\01.dwg"
I have a function call GetThumbnail it creates a bmp Object and I can use that bmp to shows in a picturebox
Dim bmp AsBitmap
bmp = dibujo.GetThumbnail("c:\work\01.dwg", True)
pictureBox.Image = bmp
Now I want to do it from the same dwg file that I have opened.
If you mean a BlockTableRecord(BlockDefinition) then use BlockTableRecord.PreviewIcon property.
As Aubelec mentioned you might still need to use BLOCKICON if BlockTableRecord.PreviewIcon is null or needs to be updated
The BlockTableRecord looks like it has the "GetThumbnailimage" property you need, if you look an an example of how to iterate the block attriibutes property, and change it to get the thumbnail image for each block that should get you started in the right direction. You would need to define a bitmap for each block and then display the bitmap in a userform using a standard Visual Studio PictureBox control.
Found the link below which looks even easier
Hello every body.
I've been searching how to use BlockTableRecord, but I haven't found more information, but I think it is used with API.NET, and I'm just use API.COM because I have learned from VBA and it was easier than API.NET for me.
Is there a way to create thumbnails using API.COM???
I hope his help.
Thanks in advance.
Hello I want to share the way that momentarily I have solved how to get the thumbnail
1. I fill the combobox with all blocks in the drawing
2. When I select the block I make a dwgFile using Wblock
thisdrawing.SendCommand("-wblock c:/work/01.dwg" & Chr(13) & nomBloque & Chr(13))
3. Call a function that makes a thumbnail and I keep it and show it in the pictureBox.
Each time that I select a block from the comboBox I have to create a wblock and replace the file.
Is a little slow.
I hope their comments and help
If you are using API.com try using dwgThumbnail.ocx , the preview looks better than a picture box.
Remane the file with an .OCX extension
Search dwgThumbnail in the VBA section for more info.
Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register