Create a thumbnail from a block inside AutoCAD

Create a thumbnail from a block inside AutoCAD

Anonymous
Not applicable
8,893 Views
8 Replies
Message 1 of 9

Create a thumbnail from a block inside AutoCAD

Anonymous
Not applicable

Hello.

 

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.

 

 

0 Likes
8,894 Views
8 Replies
Replies (8)
Message 2 of 9

Anonymous
Not applicable

You can use the command : BLOCKICON

 

it generate the preview of each BlockDef in your dwg.

 

0 Likes
Message 3 of 9

Anonymous
Not applicable

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.

 

Any suggestions?

0 Likes
Message 4 of 9

jeff
Collaborator
Collaborator

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

You can also find your answers @ TheSwamp
Message 5 of 9

fxcastil
Advocate
Advocate

Imports Autodesk.AutoCAD.DatabaseServices.BlockTableRecord

 

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.

 

BlockTableRecord.PreviewIcon.GetThumbnailImage

 

**********************************

Found the link below which looks even easier

 

http://www.theswamp.org/index.php?topic=32746.msg382467#msg382467

 

0 Likes
Message 6 of 9

Anonymous
Not applicable

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.

0 Likes
Message 7 of 9

Anonymous
Not applicable

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.

 

Inconvenience.

 

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

 

Thanks

0 Likes
Message 8 of 9

fxcastil
Advocate
Advocate

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.

 

 

 

0 Likes
Message 9 of 9

Anonymous
Not applicable
  • this image programme creat high quality thumnail into their VB.NET application. i hope it helps.
0 Likes