How to create a solid from a binary image?

How to create a solid from a binary image?

Anonymous
Not applicable
7,448 Views
41 Replies
Message 1 of 42

How to create a solid from a binary image?

Anonymous
Not applicable

I have an image with only black and white regions and would like to create a solid which is an extrusion of only the black part.

 

I am aware that I can insert an image into a sketch; however, Inventor does not recognize that there are two distinct regions, and there does not appear to be a "magic wand" type tool that can identify contours within an image.

 

Does anyone know a workaround to this?

 

Sincere thanks,

 

Gary C

0 Likes
Accepted solutions (1)
7,449 Views
41 Replies
Replies (41)
Message 2 of 42

Anonymous
Not applicable

Hi,

 

Have a look at the below link, which shows how to get create a solid from a image.

Please note that you'll need to use AutoCAD for this workaround.

 

https://www.cadlinecommunity.co.uk/hc/en-us/articles/201894752-Convert-Image-to-DWG-and-Extrude-in-I...

 

Regards,

Anite

Message 3 of 42

vladimir_michl
Advisor
Advisor
Message 4 of 42

Anonymous
Not applicable

Hi Mr. Michl,

 

Thank you for your response.

 

However, I am having some difficulty using ZSurf. When I try to open my file (24-bit Bitmap, 24MB), it says "Failure - Can't Load Bitmap."

 

It seems to be because of a file size limitation because I was able to open a 2MB file in ZSurf, but not my 24MB file.

 

I'm guessing I'll have to split it into parts and do them separately, but do you have any other suggestions?

 

Best Regards,

 

Gary C 

 

0 Likes
Message 5 of 42

Anonymous
Not applicable

Hi Anite,

 

Thanks for your response.

 

I see that this method involves tracing the outlines of the desired regions. This would be a bit tedious for my very intricate image; however, I'll definitely use this method if I'm not able to use vladimir.michl's suggestion.

 

Best Regards,

 

Gary C

 

 

0 Likes
Message 6 of 42

vladimir_michl
Advisor
Advisor

I am not aware of this size limitation but you may try a different raster format - convert your file first - using e.g. Irfanview.

 

Vladimir Michl, www.cadstudio.cz  www.cadforum.cz

 

0 Likes
Message 7 of 42

Anonymous
Not applicable
Interesting. I did actually try all of the different bitmap formats available in Microsoft Paint. Out of all of them (Monochrome, 16 Color, 256 Color, and 24-bit) only the 24-bit is able to open in ZSurf (I tried the 2MB file in all the other formats and it gave the same error).

So are you saying there are some other bitmap types available in Irfanview that may work?
0 Likes
Message 8 of 42

Anonymous
Not applicable

If file size is the issue then monochrome bitmap is the smallest bitmap possible. Only 1 or 0 stored, meaning 1 bit. Color bitmap in 24-bit color is - you guess it - 24 times larger.

 

Depending on the complexity of the bitmap you could also try to resize the bitmap with a fixed value and run the bitmap-to-vector translation on the smaller bitmap. Scaling the vector drawing up to the original scale should be easy then.

Message 9 of 42

Anonymous
Not applicable

Hi Alex,

 

Thanks for your response.

 

Unfortunately, it appears that it is not only an issue of file size, but also of bitmap type.

 

By that, I mean that while the 2MB file worked when the 24MB file didn't, the 2MB file only worked as a 24-bit Bitmap. It did not work as a smaller file type (Monochrome, 16 Color, or 256 Color) (Obviously the file size was different for each bitmap type, but I'm just referring to the simpler file as the 2MB file since that was its size as a 24-bit Bitmap).

 

However, your second idea may work. It seems that I'll either have to do that or break the image into parts. Either way, I need to reduce the size while keeping it a 24-bit Bitmap in order for ZSurf to be able to load it.

 

Best Regards,

 

Gary C

0 Likes
Message 10 of 42

SEANT61
Advisor
Advisor

Does your reference to the "Magic Wand" tool imply that you have access to Photoshop?  If so, would it's export Path functionality help in this endeavor?


************************************************************
May your cursor always snap to the location intended.
Message 11 of 42

mikejones
Collaborator
Collaborator

Hi Gary

 

I've done something similar in the past to convert a company logo that was a jpg and convert it to a dxf file that I could then import into Inventor for extruding. I used some software called Inkscape, which was free to download, to convert the bitmap into a vector image and then saved the vector out as a dxf. The conversion is very simple; see the link below 

 

https://www.youtube.com/watch?v=i-xxhphybnE

 

Import the dxf file into an inventor part sketch and away you go.

 

Hope that works for you, I found it to be quite straight forward but it may depend on your original image quality.

 

Mike

Autodesk Certified Professional
Message 12 of 42

Anonymous
Not applicable

Hi Sean,

 

Thanks for your response.

 

I don't have Photoshop, but I have Paint.net, which also has a Magic Wand tool.

 

I did originally have the idea to use the Magic Wand to turn the white parts of the image transparent and then insert the image into an Inventor Drawing and then insert that into an Inventor Part Sketch and extrude it. However, unfortunately, this approach seems not to work because when I insert the image into an Inventor Drawing, the transparent parts get automatically filled in with white.

 

If this weren't the case, I assume I could then proceed by following this solution: https://forums.autodesk.com/t5/inventor-forum/cannot-extrude-dwg-imported-into-inventor-sketch-made-...

 

Best Regards,

 

Gary C

0 Likes
Message 13 of 42

Anonymous
Not applicable

Hi Mike,

 

Thanks for your response.

 

I just tried your method -- saving as a DXF in Inkscape and inserting into an Inventor Part Sketch -- and the attached image shows the result I get -- some strange "eDRAWINGS" image (the error message is from then attempting to extrude it) -- which indicates that Inventor cannot process the DXF file. This happens regardless of whether or not I use Inkscape's Trace Bitmap function before saving as a DXF, as suggested in your video tutorial. The same image appears if I insert the DXF into an Inventor Drawing.

 

Perhaps I missed a step or something?

 

Best Regards,

 

Gary C

0 Likes
Message 14 of 42

SEANT61
Advisor
Advisor

I don't know if Paint.Net has similar functionality.  Photoshop and Corel Photo-Paint both have a workflow/method that can produce vector outlines based on paths generated from a Magic Wand tool.  

Perhaps you can post the file to allow the responders a chance to try their various suggestions.


************************************************************
May your cursor always snap to the location intended.
Message 15 of 42

Anonymous
Not applicable

Ok. I've attached the original file in a few different formats as explained below.

 

"Top Layer Original": The original file, which was saved in PNG format in Microsoft Paint

 

"Top Layer Transparent": The above PNG file after deleting the white part in Paint.net

 

"TL24 from Scratch": A new identical file saved as a 24-bit Bitmap in Paint (It was made from scratch rather than simply saving the first PNG as a BMP in case that made a difference)

 

I know, it's actually red/other colors and white rather than black and white; I just said it was black and white to make the question easier to understand.

0 Likes
Message 16 of 42

Anonymous
Not applicable

And because you can apparently only attach three files at a time, here is the last format.

 

"TLMono from Scratch": A new identical file saved as a Monochrome Bitmap in Paint

0 Likes
Message 17 of 42

SEANT61
Advisor
Advisor

I played around with it a little bit - not a lot of feature recognition in the process.  In any event, here is the lower half of the image using Photo-Paint.


************************************************************
May your cursor always snap to the location intended.
Message 18 of 42

SEANT61
Advisor
Advisor

And Here's the top.  I should point out that I've only processes the Red bodies in the raster image.


************************************************************
May your cursor always snap to the location intended.
Message 19 of 42

Anonymous
Not applicable

Thanks, Sean.

 

I've attached a screenshot showing my sketch with Bottom.dwg inserted. However, I actually need the red shapes filled in rather than just their outlines. I tried using the Patch tool to fill them in, but it's not able to select an entire curve at once (and it would be tedious to select each part of each curve). Are you able to make them filled in or tell me how to do that?

 

Also, I just realized I actually just want the red part for now because not all of the vias go through the top layer. I'm not sure which file you used, so I revised all of them not to have the vias. Could you do the same thing as before (preferably with the red parts filled in if possible) with the revised files attached below or tell me how to do that?

 

 

0 Likes
Message 20 of 42

Anonymous
Not applicable

The rest of the revised files:

0 Likes