Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to convert SLDPRT Solids to voxels 6

Status
Not open for further replies.

maniachalengineer

Mechanical
Dec 23, 2008
19
0
0
US
Has anybody worked with a program that conceivably would take a solid model (organic shapes with complex surfaces) from Solidworks and output or convert to voxels? I have a customer who has some very sophisticated simulation software that relies on voxel input. My goal is to re-define the separate models into 1mm cubes or "voxels".
From some recent reading I've deduced that voxels are "cubes" that have a number of associated properties for each cube- thus enabling things like anisotropy or optical properties, even time constraints on each cube or groups of cubes. Anyway, I assume there must be a pathway to render SLDPRT files into "slices" or other intermediate topologies that may be a step towards voxels. I've spent more than a day so far looking online for solutions to no avail. Any ideas?
Thanks in advance!
 
Replies continue below

Recommended for you

From what I read, some voxel formats include data for surface normal. This would go a long way toward improving analysis results without excessively high resolution.
 
Whatever you end up doing, I doubt a SW document made up of a bunch of cubes will be an intermediate format you want to mess with. The sheer number of 1mm cubes in a volume will blow SW up. Think about it - there are 1,000,000 cubes of 1mm side in a 100mm cube. SW struggles to generate a 100x100 pattern of 1mm cubes (10,000 cubes) in an assembly pattern feature. Patterning that square into a 1,000,000 piece cube brings it to its knees.

Multibody parts don't even perform as well as assemblies.



-handleman, CSWP (The new, easy test)
 
Just for completeness and educational value, here is the best macro I could come up with for voxelization. It's much, much faster than the one posted above, but still pretty slow, and will run out of memory if you try to do too big a model. Instead of solid bodies within the part, it creates a new assembly with a bunch instances of a voxel part, which is also automatically created. For reference, a part which voxelized to 15,344 elements took 54 seconds to analyze and 160 seconds to create the assembly. SW runs out of memory during voxel calculation somewhere around 100,000 voxels.

-handleman, CSWP (The new, easy test)
 
 http://files.engineering.com/getfile.aspx?folder=9f36a84f-76ff-40b0-b518-1479b3a72b4a&file=Voxelizer.swp
handleman,

I expect that a cloud of points at the centers of the cubes that you are currently creating would be as useful as an array of cubes as a starting point for voxelization.

Eric
 
Handleman:
HOLY COW! The macro you provided works really well! I ran it on a 0.5in dia hemisphere with 1mm voxels and 50% fill settings, the results are shown in the attached pictorial.The 50% setting appears to produce a "3D circumscribed" voxel arrangement. This is a great start towards my goals on voxels! The macro ran about 2.1 secs generating the voxels, and about 4secs creating the assembly with 798 voxels. When I created a more complex "organic" part measuring about 5in x 2in x 1in and asked for 1mm voxels it generated about 75,000 voxels in about 5 minutes and I stopped the assembly sequence after 30 minutes. It was obviously struggling with the task too much. But I believe this has convinced me that there is a decent solution using this or a similar strategy. I've asked my customer to provide a sample format for the voxels he can use, I'll try to proceed from there. I really appreciate this invaluable and enlightening glimpse into the macros with SolidWorks- I'd never used macros with SW before and it is awesome! Thank you very much!!
 
 http://files.engineering.com/getfile.aspx?folder=a1e1fe8e-cd5f-48e5-bc6d-3d9a2832f02d&file=hemisphere_P5_dia_voxelized.jpg
Glad you liked the macro.... It's got an error.

Not a huge one, but I never reset the body volume summation to zero. Meaning that once it found one voxel that was full enough, the percentage was essentially anything over zero for all subsequent voxels.

Attached are two versions, one that's similar to the earlier posted one except that you can set a max number of voxels per assembly. Once that number is reached, the assembly is saved, closed, and another picks up where that one left off. Once the macro finishes, you can easily assemble the different subassemblies into one main assembly. If SW will do it, that is.

The other version incorporates Eric's suggestion of a 3D sketch point cloud. It's much simpler.



-handleman, CSWP (The new, easy test)
 
Handleman;
You are really outstanding! I certainly appreciate your creative and useful macros. I'm definitely looking forward to exercising these newer versions to see how they work. I also enjoy "dissecting" these macros so I can use them as a teaching tool for myself. Truly awesome!
Thank you very much!
 
Hi all heres a software link for voxel sculpting instrutions .plus a link
Also blender 3d has a developer designing a plugin or script for future addition to its core functions.
it is still very much at alpha testing stage but could be a valuable conversion tool for you later on save sw part out as as iges or sat and import it in to blender and save out as voxel format .
just something to keep an eye on
Cheers
 
KevinDeSmet;
The information gathered from this thread has been very useful for my goal of converting Solidworks models to Voxels. The primary work I'm doing now is learning to write and adapt some of the initial Solidworks macro conversion programs provided by Handleman in this thread... This has opened my eyes to a whole new world of powerful functionality within SolidWorks that I'd never used before. I was unsure about whether the initial thread was more likely to solicit meaningful replies in the computer programming forums or the Solidworks forum (I actually double posted the intial query- a no-no)- now I'm glad that I chose the SolidWorks forum because I'll use these newfound skills on many varied problems in SolidWorks!
 
Status
Not open for further replies.
Back
Top