This example shows how to add a geometry to your PDE model by importing an STL file, and then plot the geometry. Generally, you create the STL file by exporting from a CAD system, such as SolidWorks®. For best results, export a fine (not coarse) STL file in binary (not ASCII) format. After importing, view the geometry using the pdegplot
function. To see the face IDs, set the FaceLabels
name-value pair to 'on'
.
View the geometry examples included with Partial Differential Equation Toolbox™.
model = createpde; importGeometry(model,'Torus.stl'); pdegplot(model,'FaceLabels','on')
model = createpde; importGeometry(model,'Block.stl'); pdegplot(model,'FaceLabels','on')
model = createpde; importGeometry(model,'Plate10x10x1.stl'); pdegplot(model,'FaceLabels','on')
model = createpde; importGeometry(model,'Tetrahedron.stl'); pdegplot(model,'FaceLabels','on')
model = createpde; importGeometry(model,'BracketWithHole.stl'); pdegplot(model,'FaceLabels','on')
model = createpde; importGeometry(model,'BracketTwoHoles.stl'); pdegplot(model,'FaceLabels','on')
To see hidden portions of the geometry, rotate the figure using Rotate 3D button or the
view
function. You can rotate the angle bracket to obtain the following view.
pdegplot(model,'FaceLabels','on') view([-24 -19])
model = createpde; importGeometry(model,'ForearmLink.stl'); pdegplot(model,'FaceLabels','on');
pdegplot(model,'FaceLabels','on','FaceAlpha',0.5)
When you import a planar STL geometry, the toolbox converts it to a 2-D geometry by mapping it to the X-Y plane.
model = createpde; importGeometry(model,'PlateHolePlanar.stl'); pdegplot(model,'EdgeLabels','on')