Filter löschen
Filter löschen

How to generate voxel model using Gcode tool path in MATLAB ?

29 Ansichten (letzte 30 Tage)
TEKEE SURYA SAI
TEKEE SURYA SAI am 8 Jan. 2022
I am working on a project where i need to simulate the 3D Printed part which has stair steps and voids inherently when fabircated. To get the accurate simulation results i need to include the effects in the model to be simulated. I thought voxel model would meet my need. But i dont know how to generate it in MATLAB. Can anyone help me with sources to be followed to get my job done?
The voxel model is to be generated in MATLAB using Gcode tool path information(or STL ). The model that is generated must be look like the fabricated one.

Antworten (2)

Hari
Hari am 27 Dez. 2023
Hi TEKEE SURYA SAI,
I understand that you are looking to simulate a 3D printed part with inherent stair steps and voids for accurate results, and you want to use a voxel model would be suitable for this purpose.
To generate a voxel model in MATLAB from G-code or STL files, you would typically:
  1. Parse the G-code or STL file to obtain the geometry of the 3D printed part.
  2. Convert the geometry into a voxel representation, where each voxel represents a volume element of the part.
  3. Apply any additional transformations or adjustments to represent the stair steps and voids characteristic of 3D printing.
For G-code, MATLAB does not have built-in functions for directly parsing and converting to a voxel model, so you might need to write custom code or use third-party tools to interpret the G-code and create the voxel model.
For STL files, you can use MATLAB's built-in functions to read the file and create a patch object. Then, you can use the "voxelize" function from the File Exchange to convert the patch object to a voxel model.
For reading STL files in MATLAB, refer to the documentation of "stlread":
For voxelization of geometries, refer to the documentation of "voxelize":
Hope this helps!

Maneet Kaur Bagga
Maneet Kaur Bagga am 28 Dez. 2023
Hi TEKEE SURYA SAI,
As per my understanding to generate a voxel model from an STL file in MATLAB please refer to the following steps below:
  • Use "stlread" to import the STL file, which will give you the vertices and faces of the mesh. Define the size of the voxel grid based on the desired resolution and the size of the printed part.
  • Discretize the STL geometry into the voxel grid using a ray intersection method where you check if each voxel's center point is inside the geometry defined by the STL.
  • Using the"geometryFromMesh" function create a geometry representation that can be used with MATLAB's PDE Toolbox.
  • Create a PDE model and import the geometry. Use the voxel data to define the material properties, boundary conditions that reflects the voxelized structure.
  • Generate a mesh for the geometry, apply boundary conditons, material properties, and solve the PDE. During simulation, the voxel grid will be used to modify the properties of the mesh elements or nodes to account for the stair-stepping and voids.
Please refer to the following code snippet below for better understanding of the steps abovs:
% Using stlread to import STL mesh data
[vertices, faces] = stlread('your_model.stl');
% Conceptual voxelization function
voxelGrid = voxelizationFunction(vertices, faces, resolution);
% Initialize PDE model
model = createpde();
% Import the geometry (this will not create a voxel-based geometry but is necessary for meshing and simulation setup)
geometry = importGeometry(model, 'your_model.stl');
% Generate mesh
generateMesh(model);
% Apply boundary conditions, material properties, etc.
% ...
% Solve PDE
result = solvepde(model);
% Post-process results
pdeplot3D(model, 'ColorMapData', result.NodalSolution);
% Additional analysis and visualization code...
For better understanding of generating model using "stlread" please refer to the MATLAB File exchange link below:
Hope this helps!

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by