.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Create a thumbnail from a block inside AutoCAD

8 REPLIES 8
Reply
Message 1 of 9
celsoven
6601 Views, 8 Replies

Create a thumbnail from a block inside AutoCAD

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.

 

 

8 REPLIES 8
Message 2 of 9
AubelecBE
in reply to: celsoven

You can use the command : BLOCKICON

 

it generate the preview of each BlockDef in your dwg.

 

Message 3 of 9
celsoven
in reply to: AubelecBE

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?

Message 4 of 9
jeff
in reply to: celsoven

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
in reply to: celsoven

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

 

Message 6 of 9
celsoven
in reply to: fxcastil

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.

Message 7 of 9
celsoven
in reply to: celsoven

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

Message 8 of 9
fxcastil
in reply to: celsoven

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.

 

 

 

Message 9 of 9
56545454
in reply to: celsoven

  • this image programme creat high quality thumnail into their VB.NET application. i hope it helps.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost