A generic error has occurred in GDI+

A generic error has occurred in GDI+

kelidesign
Enthusiast Enthusiast
1,073 Views
6 Replies
Message 1 of 7

A generic error has occurred in GDI+

kelidesign
Enthusiast
Enthusiast

I want to get a block inside an xref and the corresponding block preview, but I'm having a problem now. Before submitting, I updated a few things in another post. If you want to get some of the information above, you can get it from there.

0 Likes
Accepted solutions (2)
1,074 Views
6 Replies
Replies (6)
Message 3 of 7

kelidesign
Enthusiast
Enthusiast
0 Likes
Message 4 of 7

kelidesign
Enthusiast
Enthusiast
Accepted solution

It is necessary to determine the blank blocks and filter them out, otherwise errors will occur.

Message 5 of 7

kelidesign
Enthusiast
Enthusiast

However, when I run the AutoCAD 2014 version, new errors appear. Very annoying. I'm still figuring it out.

0 Likes
Message 6 of 7

norman.yuan
Mentor
Mentor

That is, maybe, because of the risk you are willing to take by using Autodesk.AutoCAD.Internal... namespace? I only tried the GetBlockImage() with AutoCAD 2021, but assumed it would work at least up to 2024. If you have any versions between 2014 to 2020, you may want to have a try.

 

Norman Yuan

Drive CAD With Code

EESignature

0 Likes
Message 7 of 7

kelidesign
Enthusiast
Enthusiast
Accepted solution
The problem has been solved. I forgot to reply to myself. Kean's blog has already explained how to do it, so I won't find the link here. The specific method is to send the BlockIcon command to solve it, and then you can get the preview image.

Before the 2018 version, I am not sure which version it will be missing. Anyway, it will be more troublesome to solve it this way, but it is effective.
0 Likes