Processing a Solidworks CAD file in 3-D Volumetric Image Processing toolbox

10 visualizaciones (últimos 30 días)
Hege
Hege el 22 de Jul. de 2022
Editada: DGM el 11 de Jul. de 2025
Hi All,
I would like to process a Solidworks CAD file in 3-D Volumetric Image Processing toolbox (https://uk.mathworks.com/help/images/3d-volumetric-image-processing.html).
Appreciate if somebody can give me a clue how to do it. Attachement is my CAD file. Thank you

Respuestas (2)

T.Nikhil kumar
T.Nikhil kumar el 26 de Oct. de 2023
Hello,
I understand that you want to perform image processing operations on 3D volumetric data obtained from a SolidWorks CAD file.
I would suggest you to try following the below mentioned procedure:
  1. You can import the geometry from the CAD file using ‘importGeometry’ function for which the file must be of type ‘stl’ or ‘step’. You can export your CAD file in this format directly from SolidWorks.
  2. Most 3D image processing operations in MATLAB are designed to work on binary volumetric images. You will need to convert your geometry into a 3D binary voxel grid, where '1' represents the object and '0' represents the background.
  3. You can decide suitable dimensions for the voxel grid that will encompass the cube and initialise it.
  4. Iterate over each voxel in the grid and determine whether it lies inside or outside the cube. You can try using the ‘inpolygon’ function to determine voxel occupancy inside or on the edge of the cube and populate the voxel grid accordingly (1 for occupied and 0 for free). You can also define custom functions to determine voxel occupancy if the cube is hollow or a collection of cylinders on edges.
  5. You can use the resulting voxel grid for image processing operations. For example: volshow(voxelGrid);
Refer to the following documentation:
Refer to the following question on MATLAB Answers forum where similar workflow is discussed:
Hope this helps!
  1 comentario
DGM
DGM el 11 de Jul. de 2025
Editada: DGM el 11 de Jul. de 2025
The inpolygon() function does not work the way you describe. It doesn't work on discretegeometry objects. It doesn't work on a tetrahedral mesh. It doesn't work on a closed triangulated surface. It works on 2D polygons and query points -- it's right there in the name. I don't have PDE toolbox; otherwise, I'd probably find out that there's something even more ridiculous about the suggestion.
But wait! If we had a triangulated closed surface, couldn't we just do inpolygon() on the projection of each triangle? No, not in general, and not without a bunch of extra steps which haven't even been mentioned -- steps involving information which hasn't even been mentioned. Example: Given a solid model of a hollow object, find whether the point is inside the solid based only on inpolygon() without inspecting face normals or any other effort describing stacking order along the projection axis.
Even simpler: Given a simple, convex, axis-aligned right tetrahedron, can you tell if these points are inside the tetrahedron based on these three projections?
When tested for any one projected triangle, inpolygon() will return true for both points. If the two triangles in any projection are tested simultaneously, inpolygon() will return false for both points. In this case, only one pont is inside the tetrahedron, so both testing methods give different wrong answers.
#779207 has nothing to do with using PDE toolbox tools or inpolygon(). It suggests stlread() and alphashape(). It does not provide any working example, and using alphashape() as suggested on any nonconvex model will likely lead to a wildly wrong representation unless a lot of extra work is done to enforce the actual geometry that's being imported. In other words, in our quest to transform a triangulated solid model into a reduced-accuracy discretized volumetric image for unknown and questionable reasons, we're bound to blindly ruin the model first.
If you don't know the answer, then you don't know the answer.

Iniciar sesión para comentar.


DGM
DGM el 11 de Jul. de 2025
Editada: DGM el 11 de Jul. de 2025
A thumbnail of a screenshot is not "a CAD file".
Given that there is no usable file, nobody knows what type of file is being used, or why you want to take a triangulated solid model and reduce it to volumetric image, I'm just going to guess. I'm going to guess that the file is an STL and there's actually some good reason for voxelization. If so, then there's a tool for that:
It comes with an example, but here's another:
If you want to calculate area or volume or calculate cross-sectional information, then no, it's not necessary to convert it to a volumetric image. If you want to do it anyway, feel free.

Categorías

Más información sobre Model Import en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by