Main Content

importGeometry

Import 2-D or 3-D geometry from STL data

Description

example

gm= importgeemetry(geometryfile)creates a geometry object from the specified STL geometry file.

example

importGeometry(model,geometryfile)creates a geometry object from the specified STL geometry file and includes the geometry in themodelcontainer.

gm= importgeemetry(model,geometryfile)includes the geometry in themodelcontainer and also returns the geometrygmto the MATLAB®workspace.

Examples

collapse all

创建一个geometry object from an STL geometry file.

gm = importGeometry('ForearmLink.stl');

Plot the geometry.

pdegplot(gm)

Figure contains an axes. The axes contains 3 objects of type quiver, patch, line.

Import a planar STL geometry and include it in a PDE model. When importing a planar geometry,importGeometryconverts it to a 2-D geometry by mapping it to the X-Y plane.

创建一个PDEModelcontainer.

model = createpde;

Import a geometry into the container.

importGeometry(model,'PlateHolePlanar.stl')
ans = DiscreteGeometry with properties: NumCells: 0 NumFaces: 1 NumEdges: 5 NumVertices: 5 Vertices: [5x3 double]

用边缘标签绘制几何形状。

pdegplot(model,'EdgeLabels','on')

Figure contains an axes. The axes contains an object of type line.

Input Arguments

collapse all

Model object, specified as aPDEModel目的,ThermalModel目的,StructuralModel目的,或者ElectromagneticModelobject.

Example:model = createpde(3)

Example:thermalmodel = createpde('thermal','steadystate')

Example:structuralModel = createpde('structural','static-solid')

Example:emagmodel = createpde('electromagnetic','electrostatic')

Path to STL file, specified as a character vector or a string scalar ending with the file extension'.stl'或者'.stl'.

Example:'../geometries/Carburetor.stl'

Data Types:char|string

Output Arguments

collapse all

Geometry, returned as aDiscreteGeometryobject. SeeDiscreteGeometry Propertiesfor details.

Limitations

  • importGeometrydoes not allow you to import a multidomain 2-D or 3-D geometry where subdomains have any common points. If the subdomains of the geometry have common points, the toolbox still treats these subdomains as disconnected, without any common interface between them. Each subdomain has its own mesh.

    Because of this limitation, you cannot import nested 3-D geometries directly. As a workaround, you can import a mesh and then create a multidomain geometry from the mesh by using thegeometryFromMesh功能。看Multidomain Geometry Reconstructed from Mesh.

Tips

  • STL格式通过三角形的集合近似CAD几何形状的边界,importGeometry功能从此数据重建面部和边缘。来自STL数据的重建并不精确,可能导致边缘损失,因此可以合并相邻面孔。通常,丢失的边缘是两个相邻面之间以小角度遇到的边缘,或者边界平滑边缘。通常,这种边缘的损失不会影响分析工作流程。

  • Because STL geometries are only approximations of the original CAD geometries, the areas and volumes of the STL and CAD geometries can differ.

在R2015a中引入