VBA
Discuss AutoCAD ActiveX and VBA (Visual Basic for Applications) questions here.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Show Preview Block on Form

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
seabrahenrique
2745 Views, 6 Replies

Show Preview Block on Form

Hi Guys,

 

I would like to show the preview of a block in a form, using an object of type image, is this possible?

 

It would be something very similar to what autocad does in its block insertion menu:

 

img.png

 

Note that: The block is not an external file from which I can extract the thumbnail, it is only in the drawing itself.

 

I thought I would easily find a .preview or .icon property in Acadblock, but I didn't find ...

 

Any idea?

 

Thanks in advance

6 REPLIES 6
Message 2 of 7
grobnik
in reply to: seabrahenrique

Hi, seems somebody in the past already solved your issue if I understood well.

https://forums.autodesk.com/t5/net/how-to-get-a-block-s-preview-image/m-p/5611510#M44292

Message 3 of 7
norman.yuan
in reply to: grobnik

@grobnik , The OP did not say whether he/she uses VB.NET with AutoCAD .NET API, or VBA. the solution you referred to only works with .NET API. If the OP is meant for VBA (that is this forum for), he/she would be out of luck: there is no viable way to do it with 64-bit VBA.

 

Norman Yuan

Drive CAD With Code

EESignature

Message 4 of 7
leipengshang
in reply to: norman.yuan

how about extract block img to temp location.and then do something .
Message 5 of 7

Guys, i didn't even remeber this post, but i finded a class library tath can make this possible even in VBA.

 

Placed here in attachment.

 

Remeber to change the local file "mvarFileName = "???" to another folder in your computer, after tath, all u need to do is declare and call the class, like this:


Set obj = New ImageView
obj.GetDrawingPreview "PATH OF DWG FILE HERE"
Image1.Picture = obj.Picture

 

Something else to work is save drawing in AutoCAD 2010 format.

 

Example of use and prove tath it works:

 

henriqueseabra_0-1622994996438.png

 

It was very dificult to finded this solution, i hope help anoher people.

Message 6 of 7

its nice of u to share this. 

Message 7 of 7
capuano3d
in reply to: seabrahenrique

@seabrahenrique you're a truly generous soul indeed

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

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report