STL file-based 3D printing support structure design method

文档序号:839977 发布日期:2021-04-02 浏览:2次 中文

阅读说明:本技术 一种基于stl文件的3d打印支撑结构设计方法 (STL file-based 3D printing support structure design method ) 是由 史廷春 葛啸 于 2020-12-31 设计创作,主要内容包括:一种基于STL文件的3D打印支撑结构设计方法,包括以下步骤:利用3D建模软件对模型进行三维建模,并导出STL文件,读取STL文件,读取其中的三角面片顶点及法向量信息,定义临界角,将所读取的三角面片信息进行整合,将待支撑区域向工作平面投影成二维投影区域,得到需要支撑的部分,进行采样点采样,生成支撑结构,将所有的顶点坐标、法向量坐标写入STL文件;与现有技术相比,弥补传统的支撑结构存在用量过多,浪费材料,支撑结构难以去除,包含悬吊边,悬吊点等尖角模型的待支撑区域不能检测等问题,基于STL文件的3D打印支撑结构的设计方法,在保证模型嫩巩固稳定打印的前提下,提高了计算效率,节省了打印成本,支撑结构去除更加容易。(A3D printing support structure design method based on STL files comprises the following steps: carrying out three-dimensional modeling on the model by using 3D modeling software, exporting an STL file, reading the vertex and normal vector information of a triangular patch, defining a critical angle, integrating the read triangular patch information, projecting a region to be supported to a working plane into a two-dimensional projection region, obtaining a part to be supported, sampling a sampling point, generating a support structure, and writing all vertex coordinates and normal vector coordinates into the STL file; compared with the prior art, compensate traditional bearing structure and have the quantity too much, extravagant material, bearing structure is difficult to get rid of, contains the suspension limit, and the support region can not detect the scheduling problem of treating of closed angle models such as point of suspending in midair, and the design method of printing bearing structure based on the 3D of STL file has improved computational efficiency under the prerequisite of guaranteeing that the model is tender consolidated and stably prints, has saved and has printed the cost, and bearing structure gets rid of more easily.)

1. A3D printing support structure design method based on STL files is characterized by comprising the following steps:

s1, carrying out three-dimensional modeling on the model by using 3D modeling software, and exporting an STL file;

s2, reading the STL file, and reading the vertex of the triangular patch and the normal vector information;

s3, defining a critical angle, comparing an included angle between an external normal vector of the triangular patch and the positive direction of the Z axis with the critical angle, judging whether the triangular patch is a triangular patch to be supported, sequentially traversing all the triangular patches, and finally obtaining all areas to be supported of the STL model;

s4, integrating the read triangular patch information, detecting a region to be supported, and detecting whether the supporting structure is a suspension surface, a suspension edge or a suspension point;

s5, projecting the region to be supported to a working plane into a two-dimensional projection region to obtain a part to be supported;

s6, sampling points of the to-be-supported area after the two-dimensional projection area of the to-be-supported area is obtained;

s7, checking the position relation between the sampling points and the model to obtain support top space coordinate points corresponding to the sampling points, sequentially traversing to finally obtain a top layer support point matrix set of the region to be supported;

s8, generating a support structure;

and S9, writing all the vertex coordinates and normal vector coordinates into an STL file.

2. The STL-file-based 3D printing support structure design method according to claim 1, wherein the calculation formula of the included angle information of the outer normal vector of the triangular patch and the positive direction of the Z axis in S3 is as follows: n · v ═ n | · | v | cos θ.

3. The method for designing a 3D printing support structure based on an STL file of claim 1, wherein in S4, the suspended edge is detected according to its property, so as to ensure that two triangular patches of the suspended edge are not to-be-supported areas, and the normal vectors are added and then downward, and the included angle between the suspended edge and the bottom surface is smaller than a critical angle.

4. The method of claim 1, wherein in step S4, the suspension point is detected according to its attribute, and the Z-coordinate value of the suspension point is lower than the Z-coordinate values of other points collinear with the suspension point, so as to ensure that the edge containing the suspension point is not a suspension edge, the surface containing the suspension point is not a suspension surface, and all triangle patch normal vectors where the suspension point is located are added and directed downward.

5. The STL file-based 3D printing support structure design method according to claim 1, wherein the sampling point calculation in S6 is performed by using an equidistant sampling method, and the formula is as follows:

Nx=(Xmax-Xmin)/d

Ny=(Ymax-Ymin)/d。

6. the STL file-based 3D printing support structure design method as claimed in claim 1, wherein the center of gravity method is adopted in S7 to determine whether a point is inside a triangle, and then the coordinates of the sampling point are substituted into the plane equation of the triangle to obtain the support headspace coordinate point corresponding to the sampling point.

7. The STL file-based 3D printing support structure design method of claim 1, wherein the supporting points are projected onto the XOY plane in S8, and then a supporting point matrix (x, y,0) of the XOY plane is obtained through step S6.

8. The method of designing a support structure for 3D printing based on STL files of claim 1, wherein the top layer supporting point matrix set P (x, y, z) of the region to be supported is obtained by calculation in step S7 in S8, and the support structure is constructed by using points in two matrices of the supporting point matrix (x, y,0) and the top layer supporting point matrix set P (x, y, z) as center points of the upper and lower surfaces of the support structure, and each point having a length a from the center point.

9. The STL-document-based 3D printing support structure design method of claim 1, wherein in S9, according to right-hand rule, the normal vector of each face must point to the outside of the entity, the upper and lower surfaces of each support, each vertex and the central point respectively are constructed as triangular patches, each side surface is divided into two triangular faces, and the normal vector of each triangular face must point to the outside of the entity.

10. The STL-file-based 3D printing support structure design method of claim 1, wherein a normal vector of each triangle is calculated in S9, and the calculation formula is n-v 1 v 2.

Technical Field

The invention belongs to the technical field of 3D printing, and particularly relates to a method for designing a 3D printing support structure based on an STL file.

Background

Fused Deposition Modeling (FDM) is a common technique in 3D printing, and is a technique for manufacturing a product by printing layer by layer using a thermoplastic material as a printing material. The printing material is heated and melted during printing, and is extruded into a filament shape under the spray head, the spray head continuously moves along a certain path in the printing process, and the filament material is extruded on a printing platform through the spray head and is rapidly cooled, solidified and molded. With the advent of fused deposition manufacturing technology, STL file-based support structure design and optimization has gradually become a hotspot.

Currently, most support structures rely on commercial slicing software, such as Cura, which judges whether a support structure needs to be added or not by comparing the outer normal vector of a triangular patch with the included angle in the positive direction of the Z axis, and then extrudes the support structure below the required surface, and the support structure is usually a grid with sparse density. Although this method can provide a stable support structure, it is wasteful of material and, after the mold is formed, the support structure is difficult to remove, which can be a significant inconvenience to the post-processing stage. Furthermore, some models have pointed shaped areas to be supported, and the software does not perform 100% inspection.

Disclosure of Invention

The invention aims to overcome the defects in the prior art and provides a method for designing a 3D printing support structure based on an STL file, which saves materials, is convenient for removing the support structure and improves the calculation efficiency.

In order to achieve the above purposes, the technical scheme adopted by the invention is as follows: A3D printing support structure design method based on STL files comprises the following steps:

s1, carrying out three-dimensional modeling on the model by using 3D modeling software, and exporting an STL file;

s2, reading the STL file, and reading the vertex of the triangular patch and the normal vector information;

s3, defining a critical angle, comparing an included angle between an external normal vector of the triangular patch and the positive direction of the Z axis with the critical angle, judging whether the triangular patch is a triangular patch to be supported, sequentially traversing all the triangular patches, and finally obtaining all areas to be supported of the STL model;

and S4, integrating the read triangular patch information, and detecting a region to be supported, wherein the region to be supported is divided into three types, namely a suspension surface, a suspension edge and a suspension point.

S5, projecting the region to be supported to a working plane into a two-dimensional projection region to obtain a part to be supported;

s6, sampling points of the to-be-supported area after the two-dimensional projection area of the to-be-supported area is obtained;

s7, checking the position relation between the sampling points and the model to obtain support top space coordinate points corresponding to the sampling points, sequentially traversing to finally obtain a top layer support point matrix set of the region to be supported;

s8, generating a support structure;

and S9, writing all the vertex coordinates and normal vector coordinates into an STL file.

As a preferable scheme of the present invention, a calculation formula of information of an included angle between an external normal vector of the triangular patch and a positive direction of the Z axis in S3 is as follows: n · v ═ n | · | v | cos θ.

As a preferable scheme of the present invention, in S4, the suspension edge is detected according to the attribute of the suspension edge, it is ensured that both triangular patches of the suspension edge are non-to-be-supported areas, and the normal vectors are added and then downward, and the included angle between the suspension edge and the bottom surface is smaller than the critical angle.

In a preferred embodiment of the present invention, in S4, the hanging point is detected based on the attribute of the hanging point, the Z-coordinate value of the hanging point is lower than the Z-coordinate values of other points collinear with the hanging point, it is ensured that the side including the hanging point is not a hanging side, the plane including the hanging point is not a hanging plane, and the normal vectors of all triangle patches where the hanging point is located are added and then directed downward.

As a preferred embodiment of the present invention, in S6, an equidistant sampling method is adopted to calculate sampling points, and the formula is as follows:

Nx=(Xmax-Xmin)/d

Ny=(Ymax-Ymin)/d。

as a preferable scheme of the present invention, in S7, a gravity center method is used to determine whether a point is inside a triangle, and then the coordinates of the sampling point are substituted into a plane equation where the triangle is located to obtain a support headspace coordinate point corresponding to the sampling point.

As a preferred embodiment of the present invention, the supporting points are projected onto the XOY plane in S8, and then a supporting point matrix (x, y,0) of the XOY plane is obtained through step S6.

As a preferred embodiment of the present invention, in S8, the top layer supporting point matrix set P (x, y, z) of the region to be supported is obtained through the calculation in step S7, and points in the two matrices, i.e., the supporting point matrix (x, y,0) and the top layer supporting point matrix set P (x, y, z), are used as center points of the upper and lower surfaces of the supporting structure, and the length of each point from the center point is a, so as to form the supporting structure.

As a preferred aspect of the present invention, in S9, according to the right-hand rule, the normal vector of each face must point to the outside of the entity, the top and bottom surfaces of each support, each vertex and the center point are respectively configured as triangular patches, each side surface is divided into two triangular surfaces, and the normal vector of each triangular surface must point to the outside of the entity.

In a preferred embodiment of the present invention, in S9, a normal vector of each triangle is calculated, and the calculation formula is n-v 1-v 2.

Compared with the prior art, the invention has the beneficial effects that:

(1) the problems that the traditional supporting structure has too much consumption, wastes materials, is difficult to remove, contains hanging edges, and can not detect the to-be-supported area of sharp-angle models such as hanging points and the like are solved.

(2) According to the design method of the 3D printing support structure based on the STL file, on the premise that the model is tender, firm and stable to print, the calculation efficiency is improved, the printing time is saved, the printing cost is saved, and the support structure is easier to remove.

(3) By adopting the support structure design method based on the STL file, a new thought is provided for the optimization of the support structure for additive manufacturing, the calculation efficiency is improved, and the application of STL file analysis in the field of structure optimization design is promoted.

Drawings

FIG. 1 is a flow chart of the present invention;

FIG. 2 is a schematic diagram of extraction of a triangular patch to be supported by a model;

FIG. 3 is a two-dimensional projection of a triangular patch to be supported;

FIG. 4 is a schematic diagram of an isometric sampling method;

FIG. 5 is a graph of sample point and model position relationships;

FIG. 6 is a schematic view of a suspended edge feature;

fig. 7 is a schematic view of a suspension point feature;

FIG. 8 is a schematic view of support structure triangularization;

FIG. 9 is a print mockup comparison structure;

Detailed Description

The following describes embodiments of the present invention in detail with reference to the accompanying drawings.

As shown in fig. 1 to 9, a method for designing a 3D printing support structure based on STL files includes the steps of:

s1, carrying out three-dimensional modeling on the model by using 3D modeling software, and exporting an STL file, wherein the used 3D modeling software can provide any 3D modeling software in an STL format for UG, Solidworks and the like.

And S2, reading the STL file through reading the STL file in Matlab, reading the vertex and normal vector information of the triangular patch, and storing all the vertex and normal vector information of the triangular patch into a rectangular variable.

S3, defining a critical angle, comparing an included angle between the external normal vector of the triangular patch and the positive direction of the Z axis with the critical angle, and according to a formula: n · v ═ n | · | v | cos θ, where the Z-axis forward vector is v (0, 0, 1), and the outer normal vector of the triangular patch is n.

And judging whether the triangular patch is a triangular patch to be supported, and sequentially traversing all the triangular patches to finally obtain all the areas to be supported of the STL model.

Whether the mold requires the addition of support structures during the molding process depends on the angle of inclination of the mold molding surface. Since the molding material has a certain line width when extruded from the nozzle in a molten state, the bonding characteristics of the molten material allow the newly formed outer profile to be larger than the previous layer, which results in a self-supporting tilt angle, i.e., a critical angle, and the region outside the self-supporting range is the region to be supported.

And S4, integrating the read triangular patch information, and detecting a region to be supported, wherein the region to be supported is divided into three types, namely a suspension surface, a suspension edge and a suspension point.

After the critical angle is defined, the region to be supported containing the suspension edge can be detected, in addition, the suspension edge is detected according to the attribute of the suspension edge, firstly, two triangular surface patches containing the suspension edge are non-to-be-supported surfaces, the normal vectors are added and then the normal vectors are downward, and the included angle between the suspension edge and the bottom surface is smaller than the critical angle.

And detecting the suspension point according to the attribute of the suspension point, wherein the Z coordinate value of the suspension point is lower than the Z coordinate values of other points collinear with the suspension point, the side containing the suspension point is ensured not to be a suspension side, the surface containing the suspension point is ensured not to be a suspension surface, and normal vectors of all triangular patch where the suspension point is located are added and then are downward.

And S5, projecting the region to be supported to the working plane to form a two-dimensional projection region, and calculating to obtain the maximum value and the minimum value of X and Y in the projection region to obtain the part to be supported.

And (2) two-dimensional area projection, if all three patches to be supported are additionally supported, the problem of excessive support is caused, and the difficulty in removal is also caused, so that the area to be supported is very necessary to be sampled, and the efficiency of an algorithm is seriously reduced in consideration of the fact that the three-dimensional space resampling needs a large amount of calculation, so that the area to be supported is projected to a working plane to form a two-dimensional projection area, and a part to be supported is obtained.

S6, X, Y values according to step S5, and formula Nx=(Xmax-Xmin) D and Ny=(Ymax-Ymin) D, where d is the sampling interval, NxIs a distance in the X direction, NyFor Y-direction spacing to define sampling area and sampling at sampling interval dAnd sampling points of the area to be supported after the two-dimensional projection area of the area to be supported is obtained.

S7, checking the position relation between the sampling points and the model to obtain support top space coordinate points corresponding to the sampling points, traversing in sequence to finally obtain a top layer support point matrix set of the to-be-supported area, judging whether one point is in the triangle by adopting a gravity center method, discharging unnecessary sampling points, bringing the coordinates of the sampling points into a plane equation where the triangle is located to obtain the support top space coordinate points corresponding to the sampling points, and traversing in sequence to finally obtain a top layer support point matrix set P (x, y, z) of the to-be-supported area.

If the two-dimensional projection area of the area to be supported is not a rectangle, after sampling, whether the sampling point is in the projection area needs to be judged.

And substituting the x and y values of the sampling points into a plane equation of the triangular patch above to obtain Z coordinate values corresponding to the sampling points in the triangular patch, and traversing in sequence to obtain the heights Z of all the sampling points.

S8, generating a supporting structure, projecting the supporting points onto the XOY plane, then obtaining a supporting point matrix (x, y,0) of the XOY plane through the step S6, and generating a columnar supporting structure according to the coordinates of the sampling points and the corresponding heights of the sampling points.

And S7, calculating to obtain a top layer supporting point matrix set P (x, y, z) of the region to be supported, taking points in the two matrixes of the supporting point matrix (x, y,0) and the top layer supporting point matrix set P (x, y, z) as central points of the upper surface and the lower surface of the supporting structure, and setting the length of each point from the central point to be a to form the supporting structure.

Triangularization of the support structure, triangularization of each plane of the support structure, according to right-hand rules, the normal vector of each plane must point to the outside of the entity, the normal vector being derived from equation (4). And storing the triangulated vertex information and normal vector information into a matrix variable.

S9, writing an STL file, when constructing a support structure, coordinates and normal vectors of all triangles must be comprehensively given, according to the right-hand rule, the normal vector of each face must point to the outside of the entity, the upper surface and the lower surface of each support, each vertex and the center point are respectively constructed into triangular patches, each side face is divided into two triangular faces, and the normal vector of each triangular face must point to the outside of the entity.

In S9, a normal vector of each triangle is calculated, and the calculation formula is n-v 1-v 2.

Where n is the normal vector of the triangle and v1, v2 are the two vectors of the triangle.

And traversing all the support structures, and storing all the vertex coordinates and normal vector coordinates. And finally writing all the stored vertex coordinates and normal vector coordinates into the STL file.

The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention; thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

12页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种光固化三维打印方法

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!