CN104239400A - Method for converting DXF (Drawing Exchange File) file format into STL (STereoLithography) file format of primitive solid - Google Patents

Method for converting DXF (Drawing Exchange File) file format into STL (STereoLithography) file format of primitive solid Download PDF

Info

Publication number
CN104239400A
CN104239400A CN201410339375.0A CN201410339375A CN104239400A CN 104239400 A CN104239400 A CN 104239400A CN 201410339375 A CN201410339375 A CN 201410339375A CN 104239400 A CN104239400 A CN 104239400A
Authority
CN
China
Prior art keywords
file
value
max
point
dxf
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201410339375.0A
Other languages
Chinese (zh)
Inventor
张滢
石鑫
庞凯民
赵文杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenyang Aerospace University
Original Assignee
Shenyang Aerospace University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenyang Aerospace University filed Critical Shenyang Aerospace University
Priority to CN201410339375.0A priority Critical patent/CN104239400A/en
Publication of CN104239400A publication Critical patent/CN104239400A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/11File system administration, e.g. details of archiving or snapshots
    • G06F16/116Details of conversion of file system types or formats

Abstract

The invention relates to a method for converting a DXF (Drawing Exchange File) file format into an STL (STereoLithography) file format of a primitive solid and belongs to the technical field of document processing. The method can realize the conversion of a DXF file into an STL file and comprises the following steps: conducting language programming by using VC++, reading and displaying DXF file content information of a solid drawing and converting the information into STL file content information; calling an OnFileOpen function to open the DXF file, reading maximum coordinates xmax, ymax and zmax and minimum coordinates xmin, ymin and zmin of the primitive solid in the file content information, and determining geometric information of the primitive solid; according to the geometric information of the primitive solid and by calling an OnFileTran function, spatially partitioning the primitive solid by using triangles, finding vertex coordinates of each triangular surface, generating data information expressed by triangle vertexes and writing the data information into the STL file. Through the conversion from the DXF file format to the STL file format, the design period of the product is shortened, the application range of software is widened, the working efficiency is improved and the storage space is saved.

Description

The DXF file layout of basic body is converted to the method for stl file form
Technical field
The DXF file layout that the present invention relates to a kind of basic body is converted to the method for stl file form, and it belongs to document processing technology field.
Background technology
21 century is the New Times that information is highly developed, science and technology is constantly updated.Cad technique is widely applied at multiple industry field, and the category of its application technology also breaks the constraint of graphics software already, comprises generation of Rapid Prototype Design, Parametric designing and system etc.Particularly in the last few years, rapid shaping (Rapid Prototyping the is called for short RP) technology supported by file layout obtains fast development, enjoys the favor of manufacturing.The combination high as Integration ofTechnology degree and production degree of flexibility is good, rapid shaping technique is closely connected with cad technique, fast-developing.U.S. president Obama proposes the development manufacturing industry plan of the development U.S. on March 9th, 2012, and start first " increasing material manufacture " project, i.e. rapid shaping project (in development process, the transmission of information mainly adopts stl file form), this indicate rapid shaping technique using as national development of manufacturing Primary Strategies and give governmental support.
The development of various new technology, be unable to do without the process of file data certainly.In general, the removal process of all rapid shapings and numerical control material all needs to extract data message from CAD system.Research about AutoCAD graphic file is applied, and as contents such as digital independent, figure display and file managements, caused the great attention of countries in the world, external experts and scholars have also made huge contribution, achieve excellent scientific payoffs.Ferreira.Jose Carvalho develops an integrated CAD/RP/ finite element analysing system by computer-aided engineering (CAE), in order to improve die casting manufacturing process, assist to reduce the design time of die casting and the fabrication process parameters of optimization and upgrading die casting, thus support that CAD/RP/FEA technology and NC control.The people such as Hur.S-M adopt delaunay triangulation methodology, using leg-of-mutton angle, triangle reduces speed and admissible region builds triangle data structure as foundation, to reverse-engineering (Reserve Engineering, be called for short RE) in stl file data carry out light-weight technologg, decrease through the data volume measured by 3D laser scanner, greatly save the processing time in modeling process middle data, accelerate the model slice process of stl file.The people such as Rahmati.Sadegh have been placed on the precision of 3D printer model, top layer and quality of colour aspect focus, and the model skin depth created, between 25-150um, makes work appear to Reparameterization design 3D printer.The people such as Hayasi.Mohamad T are extracted by the feature pixel of intersection algorithm to DXF file model, characteristic information is changed into manufacturing information, again by the identification of manufacturing information, for RP and CNC generates processing route code, for CAPP provides database support.The people such as EmadS.Abouel Nasr it is also proposed the method reading graphic element according to manufacturing feature from CAD system, the people such as Navangul.Gaurav propose based on stl file coordinates transformation method etc. in Layered manufacturing, and above-mentioned research makes DXF all directly or indirectly, stl file form becomes the graphics memory form benefited from the most.Sakao.Tomohiko indicates that CAD system modelling is at S/PE, the application namely in service/product engineering and future developing trend.Because rapid shaping technique is strict for the processing requirements of cad model, particularly for the cad model of surface modeling, the disappearance of the topology information of its surface model always can cause it to dock the problems such as difficulty with RP interface.For this reason, the people such as Meier.Ingo R propose a kind of new algorithm for Modling model topological structure, and the topological model after this algorithm process meets stl file self summit and limits to the condition on summit, alleviate the problem of above-mentioned interface docking difficulty.The people such as Galantucci.L.M utilize the method for useful volume to export stl file from the product that 3D scans, thus provide technical support for reverse-engineering and rapid shaping.The people such as Sukimin analyze based on DXF file layout, automatically extract geometric model operation, the Realistic representation of final implementation model to DXF file.In architectural CAD field, Japanese scholars takes the lead in using stl file model at 3D design aspect, and have developed complete architectural design CAD/CAM system software subsequently, 3D printing technique and computer aided design cad is tied up, acting in conjunction.
The 3D printing technique of stl file form support have also been obtained widespread use at aviation field.The Boeing of the U.S. can utilize the about 300 kinds of different airplane components of three-dimensional printing technology manufacture, comprise complex-shaped conduit cold air being imported electronic equipment, the larger product such as wing is just printed at research and utilization 3D printing technique in current Boeing.Europe Air Passenger airline also accomplishes something in this respect, and the luggage carrier that Air Passenger uses 3D to print in A380 main cabin also using the air-conditioning system that 3D prints in " typhoon " fighter plane.Plan that Air Passenger company also been proposed recently " transparent aircraft concept ", has formulated a " roadmap ", namely from printing the widget of aircraft, develops step by step, finally about the year two thousand fifty, prints whole airplane with 3D printer.
DXF file is a kind of general graphics interchange format that CAD system software popular at present provides.Wherein, all graphic file of AutoCAD is all managed by database, but these databases store with packed data form, is very complicated by the high-level language programs information directly obtained wherein.For this reason, if carry out secondary development to AutoCAD, usually reading DXF file.
Store the rule of figure by usual DXF file, the three-dimensional picture information in DXF file also should be stored in entity joint.But when opening one and comprising the DXF file of three-dimensional picture information, find a large amount of encrypted messages.Therefore, only have and indirectly read from other parts.Other division format of further Study document, can find in header section, have one group of group code to include some useful information.They are used to maximum, the min coordinates variable $ EXTMAX and $ EXTMIN of presentation graphic spreading range.Respectively with 10 after each variable, 20,30 guide the graphic extension coordinate x in figure, y, z.Therefore, as long as read xmin, ymin, zmin, xmax, ymax and zmax value, whole geological informations of the entity that will change can be determined.
Summary of the invention
In view of the defect that prior art exists, the DXF file layout that the object of this invention is to provide a kind of basic body is converted to the method for stl file form, by analysing in depth DXF and STL two kinds of file layouts, VC++ is utilized to carry out Programming with Pascal Language, can read and show the DXF document content information of basic body and they can be converted into corresponding stl file, the development for CAD/CAM provides new technical support.
For achieving the above object, the present invention is achieved through the following technical solutions:
The method realizes DXF Drawing Interchange File and converts stl file to; Utilize VC++ to carry out Programming with Pascal Language, read the DXF document content information of also display entity figure and be converted into stl file content information; The solid pattern information of DXF file is stored in entity section, there is maximum coordinates variable and the min coordinates variable of presentation-entity graphic extension scope in the header segment of DXF file; Call OnFileOpen function and open DXF file, the maximum coordinate value among xmax of basic body in file reading content information, ymax, zmax and min coordinates value xmin, ymin, zmin, determine the geological information of basic body; The data of STL model are made up of the normal vector of triangle surface and 3 apex coordinates of triangle surface, and stl file describes normal vector and the vertex coordinates data information of all triangle surfaces forming basic body; According to the geological information of basic body by calling OnFileTran function, judge the value of what in switch (what), call corresponding function according to the value of what and carry out data processing, compartition is carried out with triangle pair basic body, obtain the apex coordinate of each gore, generate the data message represented with triangular apex, and write stl file.
Basic body is right cylinder, and in switch (what), the value of what is 3, right cylinder maximum coordinate value among xmax in file reading content information, ymax, zmax and min coordinates value xmin, ymin, zmin, makes cylindrical circumference cutting density N, then cylindrical radius trying to achieve triangular apex coordinate is:
When generating stl file, be divided into two parts to export, output vertex order is:
1. upper and lower bottom surface: a upper central point → i (on) → i+1 (on)
A lower central point → i+1 (under) → i (under)
2. side: some i (on) → i (under) → i+1 (under)
Point i (on) → i+1 (under) → i+1 (on).
Basic body is spheroid, in switch (what), the value of what is 5, spheroid maximum coordinate value among xmax in file reading content information, ymax, zmax and min coordinates value xmin, ymin, zmin, make the cut capacity M in both direction, N, wherein M is longitudinal cut capacity, corresponding j value change; N is transverse cuts density, corresponding i value change; Trying to achieve spheroid sphere centre coordinate (cx, cy, cz) is:
cx = x max + x min 2 cy = y max + y min 2 cz = z max + z min 2
According to space geometry relation, obtaining spheroid vertex of surface coordinate algorithm is:
rt [ i ] = r × sin ( π × i N ) ;
x [ i ] [ j ] = rt [ i ] × sin ( 2 π × j M ) + cx ;
y [ i ] [ j ] = rt [ i ] × sin ( 2 π × j M ) + cy ;
z [ i ] [ j ] = r × cos ( π × i N ) + cz ;
When generating stl file, be divided into two parts to export, output vertex order is:
Face around upper and lower summit:
Upper summit → point [i] [j] → point [i] [j+1]
Lower summit → point [i-1] [j+1] → point [i-1] [j]
Other face:
Point [i] [j] → point [i+1] [j] → point [i+1] [j+1]
Point [i] [j] → point [i+1] [j+1] → point [i] [j+1].
Basic body is torus, in switch (what), the value of what is 6, torus maximum coordinate value among xmax in file reading content information, ymax, zmax and min coordinates value xmin, ymin, zmin, make the cut capacity M in both direction, N, wherein M is longitudinal cut capacity, corresponding j value change; N is transverse cuts density, corresponding i value change, and trying to achieve ring heart coordinate (cx, cy, cz) is:
cx = x max + x min 2 cy = y max + y min 2 cz = z max + z min 2
Ring radius r=(xmax-xmin)/2, cutting radius of circle b=(zmax-zmin)/2, scanning radius of circle rT=r-b;
According to space geometry relation, obtaining apex coordinate algorithm is:
xTc [ i ] = rT × sin ( 2 π × i N ) + cx ;
yTc [ i ] = rT × cos ( 2 π × i N ) + cy ;
yT [ i ] [ j ] = b × cos ( 2 π × j N ) + yTc [ i ] ;
zT [ i ] [ j ] = b × sin ( 2 π × j N ) + cz ;
x [ i ] [ j ] = b × cos ( 2 π × j M ) × sin ( 2 π × i N ) + xTc [ i ] ;
y [ i ] [ j ] = b × cos ( 2 π × j M ) × cos ( 2 π × i N ) + yTc [ i ] ;
z [i][j]=zT [i][j]
When generating stl file, output vertex order is:
Point i, a j → i+1, a j → i, j+1
Point i, a j+1 → i+1, a j → i+1, j+1.
Basic body is cone, and in switch (what), the value of what is 4, cone maximum coordinate value among xmax in file reading content information, ymax, zmax and min coordinates value xmin, ymin, zmin, makes the circumference cutting density N of cone, then the radius of cone: order trying to achieve ring heart coordinate (cx, cy, cz) is:
cx = x max + x min 2 cy = y max + y min 2 cz = z max + z min 2
According to space geometry relation, obtaining apex coordinate algorithm is:
x [ i ] = r × sin ( 2 π × i N ) + cx ;
y [ i ] = r × cos ( 2 π × i N ) + cy ;
When generating stl file, output vertex order is:
Side: a upper summit → i (under) → i+1 (under)
A upper summit → i+1 (under) → i+2 (under)
Bottom surface: some i (under) → lower central point → i+1 (under)
Point i+1 (under) → lower central point → i+2 (under).
Basic body is rectangular parallelepiped, and in switch (what), the value of what is 1, rectangular parallelepiped maximum coordinate value among xmax, ymax in file reading content information, zmax and min coordinates value xmin, ymin, zmin, its center point coordinate (cx, cy, cz) is:
cx = x max + x min 2 cy = y max + y min 2 cz = z max + z min 2
The half length of side value (lx, ly, lz) on its each limit is:
lx = x max - x min 2 ly = y max - y min 2 lz = z max - z min 2
Try to achieve normal vector and the summit value of 12 gores,
When generating stl file, output vertex order is:
Point 1 → 2 → 3, point 1 → 3 → 5; Remainder output order is identical.
Basic body is wedge, and in switch (what), the value of what is 2, wedge maximum coordinate value among xmax in file reading content information, ymax, zmax and min coordinates value xmin, ymin, zmin, and its center point coordinate (cx, cy, cz) is:
cx = x max + x min 2 cy = y max + y min 2 cz = z max + z min 2
The half length of side value (lx, ly, lz) on its each limit is:
lx = x max - x min 2 ly = y max - y min 2 lz = z max - z min 2
Try to achieve normal vector and the summit value of 8 gores,
When generating stl file, output vertex order is:
Point 1 → 2 → 4, point 1 → 4 → 3; Remainder output order is identical.
Realization of the present invention is through following step:
One, DXF file layout is analyzed, is read:
DXF file comprises title variable, table, block and entity section geological information and non-geometry information, end mark.Essentially, " data to " structure that DXF file is made up of a lot " group code " and " class value " forms.Here data are to being exactly usually said " group ".Often group appears on two lines, and group code, front, as drawing row, represent the title of data type, and class value is at rear row, capable as actual content, represents concrete data message.The general format of entity section is as follows:
0 // group code (section starts to indicate)
SECTION//class value (section name)
2 // group code (segment type)
ENTITIES//class value (entity section)
(independent geometry entity information)
0
ENDSEC // (section terminates)
In practice, containing all geological informations of parts pattern due to the entity section in DXF file and insert block message, is the main source of data message.Therefore, for the research of DXF file, mainly entity section data message is analysed in depth.
The three-dimensional picture information of DXF file is stored in entity section, but when opening one and comprising the DXF file of three-dimensional information, the information content of the inside is encrypted, directly can not carry out reading to it and utilize.But, with further reference to other partial contents of contrast, be not difficult to find, in the header segment of DXF file, there is some useful informations about solid pattern, the i.e. maximum and min coordinates variable of presentation-entity graphic extension scope, so only need read its maximum coordinate value among Max (x, y, z) and min coordinates value Min (x, y, z), whole geological informations that will transform entity can just be determined.
Two, stl file format analysis:
The essence of STL data layout is that discrete approaches with many tiny spatial triangle dough sheets for base unit, and the surface of approximate description three-dimensional entity model, is similar to the FEM meshing on entity data model surface.Fig. 2 represents that a rib length is the cube STL partitioning model of 100, can find out, the data of STL model are made up of the normal vector of triangle surface and 3 apex coordinates of triangle surface.Stl file describes normal vector and the vertex coordinates data information of all triangle surfaces forming solid model.
In the stl file of ASCII fromat, mainly contain 7 row key sentence, must also separate with other with space by small letter.They are solid (entity component name), facet normal (triangle surface normal vector), outer loop (an Atria summit describes opening flag), vertex (apex coordinate), Endloop (mark of an Atria summit description end), endfacet (triangle surface describes the mark terminated), endsolid (mark that entity description terminates) successively.The stl file structure of ASCII fromat is as follows:
solid?filename
facet?normal?x?y?z
outer?loop
vertex?x?y?z
vertex?x?y?z
vertex?x?y?z
endloop
endfacet
……
Corresponding with Fig. 2, the stl file of the cube ASCII fromat of rib long 100 stores schematic diagram as shown in Figure 3.Here a triangle surface in stl file ASCII fromat (text) has only been taken.
As shown in Figure 3, square is hereof altogether by 12 facet normal ... endfacet structure represents, each structure is for representing a spatial triangle dough sheet.At a facet normal ... in endfacet structure, to illustrate triangle surface, represent the valid data four lines altogether of triangle surface:
Row (1) facet normal0.000000e+00 1.000000e+00 0.000000e+00
Row (2) vertex1.000000e+02 1.000000e+02 0.000000e+00
Row (3) vertex0.000000e+00 1.000000e+02 1.000000e+02
Row (4) vertex1.000000e+02 1.000000e+02 1.000000e+02
What wherein go that (1) describe is the normal vector of this gore, and three numerical value below represent the resolute of X, Y, Z-direction respectively; The coordinate figure on what row (2), (3), (4) described is triangle surface three summits.Putting in order of three summits meets the right-hand rule with normal vector direction.
Three, data processing algorithm:
Generate the stl file represented with triangular apex, be actually the process of being carried out compartition by triangle pair entity.Like this, after reading (xmax, ymax, the zmax) and (xmin, ymin, zmin) of entity, the apex coordinate of each gore just can be obtained, and by it with certain form write stl file.
Four, program runs display result.
According to specific embodiment provided by the invention, the invention discloses following technique effect: STL, DXF file is extensively carried out application in different field, if the conversion of DXF to stl file form can be realized, great convenience is provided by the process of graphic file, greatly shorten the design cycle of product, the usable range of software can be widened again, increase work efficiency, storage area can be saved greatly by the information storage of DXF file to stl file simultaneously.
Accompanying drawing explanation
Fig. 1 is document format conversion system chart;
Fig. 2 is the cube STL partitioning model of rib long 100;
Fig. 3 is that the cube STL (ASCII) of rib long 100 stores schematic diagram;
Fig. 4 is right cylinder segmentation figure;
Fig. 5 is right cylinder program flow diagram;
Fig. 6 is segmentation of spheres figure;
Fig. 7 is segmentation of spheres program flow diagram;
Fig. 8 is torus segmentation figure;
Fig. 9 is torus segmentation procedure process flow diagram;
Figure 10 is cone segmentation figure;
Figure 11 is cone segmentation procedure process flow diagram;
Figure 12 is rectangular parallelepiped segmentation figure;
Figure 13 is rectangular parallelepiped program flow diagram;
Figure 14 is wedge segmentation figure;
Figure 15 is wedge segmentation process flow diagram;
Figure 16 is the cube graph of box;
Figure 17 is the dxf content information display interface of box;
Figure 18 is the stl content information display interface of box;
Embodiment
Embodiment one
Basic body is right cylinder, and right cylinder segmentation procedure process flow diagram as shown in Figure 5.Call OnFileOpen () function and open DXF file, right cylinder maximum coordinate value among xmax in file reading content information, ymax, zmax and min coordinates value xmin, ymin, zmin, according to the geological information of solid pattern by calling OnFileTran () function, judge that the value of what is 3 in switch (what), makes cylindrical circumference cutting density N, then cylindrical radius: order trying to achieve triangular apex coordinate is:
When generating stl file, be divided into two parts to export, output vertex order is:
1. upper and lower bottom surface: a upper central point → i (on) → i+1 (on)
A lower central point → i+1 (under) → i (under)
2. side: some i (on) → i (under) → i+1 (under)
Point i (on) → i+1 (under) → i+1 (on).
Embodiment two
Basic body is spheroid, and spheroid program flow diagram as shown in Figure 7.Call OnFileOpen () function and open DXF file, spheroid maximum coordinate value among xmax in file reading content information, ymax, zmax and min coordinates value xmin, ymin, zmin, according to the geological information of solid pattern by calling OnFileTran () function, judge that the value of what in switch (what) is make the cut capacity M in both direction, N, wherein M is longitudinal cut capacity, corresponding j value change; N is transverse cuts density, corresponding i value change; Trying to achieve spheroid sphere centre coordinate (cx, cy, cz) is:
cx = x max + x min 2 cy = y max + y min 2 cz = z max + z min 2
According to space geometry relation, obtaining spheroid vertex of surface coordinate algorithm is:
rt [ i ] = r × sin ( π × i N ) ;
x [ i ] [ j ] = rt [ i ] × sin ( 2 π × j M ) + cx ;
y [ i ] [ j ] = rt [ i ] × sin ( 2 π × j M ) + cy ;
z [ i ] [ j ] = r × cos ( π × i N ) + cz ;
The code of program is:
for(inti=0;i<=N;i++)
{rt[i]=r*sin(PI*i/n);
for(intj=0;j<=M;j++)
{x[i][j]=rt[i]*sin(2*PI*j/M)+cx
y[i][j]=rt[i]*sin(2*PI*j/M)+cy;
z[i][j]=r*cos(PI*i/N)+cz;}}
When generating stl file, be divided into two parts to export, output vertex order is:
Face around upper and lower summit:
Upper summit → point [i] [j] → point [i] [j+1]
Lower summit → point [i-1] [j+1] → point [i-1] [j]
Other face:
Point [i] [j] → point [i+1] [j] → point [i+1] [j+1]
Point [i] [j] → point [i+1] [j+1] → point [i] [j+1].
Embodiment three
Basic body is torus, and torus program flow diagram as shown in Figure 9.Call OnFileOpen () function and open DXF file, torus maximum coordinate value among xmax in file reading content information, ymax, zmax and min coordinates value xmin, ymin, zmin, according to the geological information of solid pattern by calling OnFileTran () function, judging that the value of what in switch (what) is 6, making the cut capacity M in both direction, N, wherein M is longitudinal cut capacity, corresponding j value change; N is transverse cuts density, corresponding i value change, and trying to achieve ring heart coordinate (cx, cy, cz) is:
cx = x max + x min 2 cy = y max + y min 2 cz = z max + z min 2
Ring radius r=(xmax-xmin)/2, cutting radius of circle b=(zmax-zmin)/2, scanning radius of circle rT=r-b;
According to space geometry relation, obtaining apex coordinate algorithm is:
xTc [ i ] = rT &times; sin ( 2 &pi; &times; i N ) + cx ;
yTc [ i ] = rT &times; cos ( 2 &pi; &times; i N ) + cy ;
yT [ i ] [ j ] = b &times; cos ( 2 &pi; &times; j N ) + yTc [ i ] ;
zT [ i ] [ j ] = b &times; sin ( 2 &pi; &times; j N ) + cz ;
x [ i ] [ j ] = b &times; cos ( 2 &pi; &times; j M ) &times; sin ( 2 &pi; &times; i N ) + xTc [ i ] ;
y [ i ] [ j ] = b &times; cos ( 2 &pi; &times; j M ) &times; cos ( 2 &pi; &times; i N ) + yTc [ i ] ;
z [i][j]=zT [i][j]
The code of program is:
for(inti=0;i<=N;i++)
{xTc[i]=rT*sin(2*PI*i/N)+cx;
yTc[i]=rT*cos(2*PI*i/N)+cy;
for(intj=0;j<=M;j++)
{yT[i][j]=b*cos(2*PI*j/M)+yTc[i];
zT[i][j]=b*sin(2*PI*j/M)+cz;
x[i][j]=b*cos(2*PI*j/M)*sin(2*PI*i/N)+xTc[i];
y[i][j]=b*cos(2*PI*j/M)*cos(2*PI*i/N)+yTc[i];
z[i][j]=zT[i][j];}}
When generating stl file, output vertex order is:
Point i, a j → i+1, a j → i, j+1
Point i, a j+1 → i+1, a j → i+1, j+1.
Embodiment four
Basic body is cone, and cone segmentation procedure process flow diagram as shown in figure 11.Call OnFileOpen () function and open DXF file, cone maximum coordinate value among xmax in file reading content information, ymax, zmax and min coordinates value xmin, ymin, zmin, according to the geological information of solid pattern by calling OnFileTran () function, judge that the value of what is 4 in switch (what), makes the circumference cutting density N of cone, then the radius of cone: order trying to achieve ring heart coordinate (cx, cy, cz) is:
cx = x max + x min 2 cy = y max + y min 2 cz = z max + z min 2
According to space geometry relation, obtaining apex coordinate algorithm is:
x [ i ] = r &times; sin ( 2 &pi; &times; i N ) + cx ;
y [ i ] = r &times; cos ( 2 &pi; &times; i N ) + cy ;
The code of program is:
for(inti=0;i<=N;i++)
{x[i]=r*sin(2*PI*i/N)+cx;
y[i]=r*cos(2*PI*i/N)+cy;}
When generating stl file, output vertex order is:
Side: a upper summit → i (under) → i+1 (under)
A upper summit → i+1 (under) → i+2 (under)
Bottom surface: some i (under) → lower central point → i+1 (under)
Point i+1 (under) → lower central point → i+2 (under).
Embodiment five
Basic body is rectangular parallelepiped, and rectangular parallelepiped program flow diagram as shown in figure 13.Call OnFileOpen () function and open DXF file, rectangular parallelepiped maximum coordinate value among xmax in file reading content information, ymax, zmax and min coordinates value xmin, ymin, zmin, according to the geological information of solid pattern by calling OnFileTran () function, judge that the value of what in switch (what) is 1, its center point coordinate (cx, cy, cz) be:
cx = x max + x min 2 cy = y max + y min 2 cz = z max + z min 2
The half length of side value (lx, ly, lz) on its each limit is:
lx = x max - x min 2 ly = y max - y min 2 lz = z max - z min 2
Try to achieve normal vector and the summit value of 12 gores.
When generating stl file, output vertex order is:
Point 1 → 2 → 3, point 1 → 3 → 5; Remainder output order is identical.
Embodiment six
Basic body is wedge, and the segmentation procedure process flow diagram of wedge is as Figure 15.Call OnFileOpen () function and open DXF file, wedge maximum coordinate value among xmax in file reading content information, ymax, zmax and min coordinates value xmin, ymin, zmin, according to the geological information of solid pattern by calling OnFileTran () function, judge that the value of what in switch (what) is 2, its center point coordinate (cx, cy, cz) be:
cx = x max + x min 2 cy = y max + y min 2 cz = z max + z min 2
The half length of side value (lx, ly, lz) on its each limit is:
lx = x max - x min 2 ly = y max - y min 2 lz = z max - z min 2
Try to achieve normal vector and the summit value of 8 gores.
When generating stl file, output vertex order is:
Point 1 → 2 → 4, point 1 → 4 → 3, remainder output order is identical.
For cube, working procedure runs and result, and the solid pattern (name box) of DXF as shown in figure 16.
Open box.dxf file, the interface display of its content information as shown in figure 17.
Carry out conversion operations, generate box.stl file, the interface display of its content information as shown in figure 18.

Claims (7)

1. the DXF file layout of basic body is converted to the method for stl file form, it is characterized in that: the method realizes DXF Drawing Interchange File and converts stl file to; Read the DXF document content information of also display entity figure and be converted into stl file content information; The solid pattern information of DXF file is stored in entity section, there is maximum coordinates variable and the min coordinates variable of presentation-entity graphic extension scope in the header segment of DXF file; Call OnFileOpen function and open DXF file, the maximum coordinate value among xmax of basic body in file reading content information, ymax, zmax and min coordinates value xmin, ymin, zmin, determine the geological information of basic body; The data of STL model are made up of the normal vector of triangle surface and 3 apex coordinates of triangle surface, and stl file describes normal vector and the vertex coordinates data information of all triangle surfaces forming basic body; According to the geological information of basic body by calling OnFileTran function, judge the value of what in switch (what), call corresponding function according to the value of what and carry out data processing, compartition is carried out with triangle pair basic body, obtain the apex coordinate of each gore, generate the data message represented with triangular apex, and write stl file.
2. the DXF file layout of basic body according to claim 1 is converted to the method for stl file form, it is characterized in that: described basic body is right cylinder, in switch (what), the value of what is 3, right cylinder maximum coordinate value among xmax in file reading content information, ymax, zmax and min coordinates value xmin, ymin, zmin, makes cylindrical circumference cutting density N, then cylindrical radius: trying to achieve triangular apex coordinate is:
When generating stl file, be divided into two parts to export, output vertex order is:
1. upper and lower bottom surface: a upper central point → i (on) → i+1 (on)
A lower central point → i+1 (under) → i (under)
2. side: some i (on) → i (under) → i+1 (under)
Point i (on) → i+1 (under) → i+1 (on).
3. the DXF file layout of basic body according to claim 1 is converted to the method for stl file form, it is characterized in that: described basic body is spheroid, in switch (what), the value of what is 5, spheroid maximum coordinate value among xmax, ymax in file reading content information, zmax and min coordinates value xmin, ymin, zmin, make the cut capacity M in both direction, N, wherein M is longitudinal cut capacity, corresponding j value change; N is transverse cuts density, corresponding i value change; Trying to achieve spheroid sphere centre coordinate (cx, cy, cz) is:
cx = x max + x min 2 cy = y max + y min 2 cz = z max + z min 2
According to space geometry relation, obtaining spheroid vertex of surface coordinate algorithm is:
rt [ i ] = r &times; sin ( &pi; &times; i N ) ;
x [ i ] [ j ] = rt [ i ] &times; sin ( 2 &pi; &times; j M ) + cx ;
y [ i ] [ j ] = rt [ i ] &times; sin ( 2 &pi; &times; j M ) + cy ;
z [ i ] [ j ] = r &times; cos ( &pi; &times; i N ) + cz ;
When generating stl file, be divided into two parts to export, output vertex order is:
Face around upper and lower summit:
Upper summit → point [i] [j] → point [i] [j+1]
Lower summit → point [i-1] [j+1] → point [i-1] [j]
Other face:
Point [i] [j] → point [i+1] [j] → point [i+1] [j+1]
Point [i] [j] → point [i+1] [j+1] → point [i] [j+1].
4. the DXF file layout of basic body according to claim 1 is converted to the method for stl file form, it is characterized in that: described basic body is torus, in switch (what), the value of what is 6, torus maximum coordinate value among xmax, ymax in file reading content information, zmax and min coordinates value xmin, ymin, zmin, make the cut capacity M in both direction, N, wherein M is longitudinal cut capacity, corresponding j value change; N is transverse cuts density, corresponding i value change, and trying to achieve ring heart coordinate (cx, cy, cz) is:
cx = x max + x min 2 cy = y max + y min 2 cz = z max + z min 2
Ring radius r=(xmax-xmin)/2, cutting radius of circle b=(zmax-zmin)/2, scanning radius of circle rT=r-b;
According to space geometry relation, obtaining apex coordinate algorithm is:
xTc [ i ] = rT &times; sin ( 2 &pi; &times; i N ) + cx ;
yTc [ i ] = rT &times; cos ( 2 &pi; &times; i N ) + cy ;
yT [ i ] [ j ] = b &times; cos ( 2 &pi; &times; j N ) + yTc [ i ] ;
zT [ i ] [ j ] = b &times; sin ( 2 &pi; &times; j N ) + cz ;
x [ i ] [ j ] = b &times; cos ( 2 &pi; &times; j M ) &times; sin ( 2 &pi; &times; i N ) + xTc [ i ] ;
y [ i ] [ j ] = b &times; cos ( 2 &pi; &times; j M ) &times; cos ( 2 &pi; &times; i N ) + yTc [ i ] ;
z [i][j]=zT [i][j]
When generating stl file, output vertex order is:
Point i, a j → i+1, a j → i, j+1
Point i, a j+1 → i+1, a j → i+1, j+1.
5. the DXF file layout of basic body according to claim 1 is converted to the method for stl file form, it is characterized in that: described basic body is cone, in switch (what), the value of what is 4, cone maximum coordinate value among xmax in file reading content information, ymax, zmax and min coordinates value xmin, ymin, zmin, makes the circumference cutting density N of cone, then the radius of cone: order trying to achieve ring heart coordinate (cx, cy, cz) is:
cx = x max + x min 2 cy = y max + y min 2 cz = z max + z min 2
According to space geometry relation, obtaining apex coordinate algorithm is:
x [ i ] = r &times; sin ( 2 &pi; &times; i N ) + cx ;
y [ i ] = r &times; cos ( 2 &pi; &times; i N ) + cy ;
When generating stl file, output vertex order is:
Side: a upper summit → i (under) → i+1 (under)
A upper summit → i+1 (under) → i+2 (under)
Bottom surface: some i (under) → lower central point → i+1 (under)
Point i+1 (under) → lower central point → i+2 (under).
6. the DXF file layout of basic body according to claim 1 is converted to the method for stl file form, it is characterized in that: described basic body is rectangular parallelepiped, in switch (what), the value of what is 1, rectangular parallelepiped maximum coordinate value among xmax, ymax in file reading content information, zmax and min coordinates value xmin, ymin, zmin, its center point coordinate (cx, cy, cz) be:
cx = x max + x min 2 cy = y max + y min 2 cz = z max + z min 2
The half length of side value (lx, ly, lz) on its each limit is:
lx = x max - x min 2 ly = y max - y min 2 lz = z max - z min 2
Try to achieve normal vector and the summit value of 12 gores,
When generating stl file, output vertex order is:
Point 1 → 2 → 3, point 1 → 3 → 5.
7. the DXF file layout of basic body according to claim 1 is converted to the method for stl file form, it is characterized in that: described basic body is wedge, in switch (what), the value of what is 2, wedge maximum coordinate value among xmax, ymax in file reading content information, zmax and min coordinates value xmin, ymin, zmin, its center point coordinate (cx, cy, cz) be:
cx = x max + x min 2 cy = y max + y min 2 cz = z max + z min 2
The half length of side value (lx, ly, lz) on its each limit is:
lx = x max - x min 2 ly = y max - y min 2 lz = z max - z min 2
Try to achieve normal vector and the summit value of 8 gores,
When generating stl file, output vertex order is:
Point 1 → 2 → 4, point 1 → 4 → 3.
CN201410339375.0A 2014-07-16 2014-07-16 Method for converting DXF (Drawing Exchange File) file format into STL (STereoLithography) file format of primitive solid Pending CN104239400A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410339375.0A CN104239400A (en) 2014-07-16 2014-07-16 Method for converting DXF (Drawing Exchange File) file format into STL (STereoLithography) file format of primitive solid

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410339375.0A CN104239400A (en) 2014-07-16 2014-07-16 Method for converting DXF (Drawing Exchange File) file format into STL (STereoLithography) file format of primitive solid

Publications (1)

Publication Number Publication Date
CN104239400A true CN104239400A (en) 2014-12-24

Family

ID=52227464

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410339375.0A Pending CN104239400A (en) 2014-07-16 2014-07-16 Method for converting DXF (Drawing Exchange File) file format into STL (STereoLithography) file format of primitive solid

Country Status (1)

Country Link
CN (1) CN104239400A (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105260422A (en) * 2015-09-28 2016-01-20 西北核技术研究所 Multi-format waveform data file batch processing method
CN106202149A (en) * 2016-06-22 2016-12-07 南京南瑞继保电气有限公司 A kind of IEC61850 model file conversion method
CN107273543A (en) * 2017-07-06 2017-10-20 安徽省交通规划设计研究总院股份有限公司 A kind of conversion method of DGN data formats
CN108460056A (en) * 2017-02-22 2018-08-28 电子科技大学中山学院 Method for converting effective graphic elements of DXF file into JSON data
CN111506690A (en) * 2020-04-17 2020-08-07 河南省焦作地质勘察设计有限公司 Method for lossless conversion from southern CASS data to MapGis data
CN113190888A (en) * 2021-04-20 2021-07-30 东风柳州汽车有限公司 Process documentation method, device, equipment and storage medium
CN113282952A (en) * 2021-05-06 2021-08-20 范佳媛 Engineering system design file tampering detection positioning method and device

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101561838A (en) * 2009-05-25 2009-10-21 中国农业大学 Method for converting data between ADAMS software and Pro/E software
CN103761376A (en) * 2014-01-10 2014-04-30 沈阳航空航天大学 Two-dimensional DXF (drawing exchange file) format based three-dimensional realistic display method of parts

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101561838A (en) * 2009-05-25 2009-10-21 中国农业大学 Method for converting data between ADAMS software and Pro/E software
CN103761376A (en) * 2014-01-10 2014-04-30 沈阳航空航天大学 Two-dimensional DXF (drawing exchange file) format based three-dimensional realistic display method of parts

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
张滢 等: "关于基于形体的DXF与STL文件格式之间的转化", 《沈阳航空工业学院学报》 *

Cited By (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105260422A (en) * 2015-09-28 2016-01-20 西北核技术研究所 Multi-format waveform data file batch processing method
CN105260422B (en) * 2015-09-28 2018-10-26 西北核技术研究所 A kind of multi-format Wave data file batch processing method
CN106202149A (en) * 2016-06-22 2016-12-07 南京南瑞继保电气有限公司 A kind of IEC61850 model file conversion method
CN106202149B (en) * 2016-06-22 2019-07-23 南京南瑞继保电气有限公司 A kind of IEC61850 model file conversion method
CN108460056A (en) * 2017-02-22 2018-08-28 电子科技大学中山学院 Method for converting effective graphic elements of DXF file into JSON data
CN107273543A (en) * 2017-07-06 2017-10-20 安徽省交通规划设计研究总院股份有限公司 A kind of conversion method of DGN data formats
CN107273543B (en) * 2017-07-06 2020-06-05 安徽省交通规划设计研究总院股份有限公司 DGN data format conversion method
CN111506690A (en) * 2020-04-17 2020-08-07 河南省焦作地质勘察设计有限公司 Method for lossless conversion from southern CASS data to MapGis data
CN113190888A (en) * 2021-04-20 2021-07-30 东风柳州汽车有限公司 Process documentation method, device, equipment and storage medium
CN113190888B (en) * 2021-04-20 2022-10-28 东风柳州汽车有限公司 Process documentation method, device, equipment and storage medium
CN113282952A (en) * 2021-05-06 2021-08-20 范佳媛 Engineering system design file tampering detection positioning method and device
CN113282952B (en) * 2021-05-06 2023-06-23 范佳媛 Engineering system design file tampering detection positioning method and device

Similar Documents

Publication Publication Date Title
CN104239400A (en) Method for converting DXF (Drawing Exchange File) file format into STL (STereoLithography) file format of primitive solid
Qin et al. Status, comparison, and future of the representations of additive manufacturing data
Ito et al. Surface triangulation for polygonal models based on CAD data
Song et al. Function representation based slicer for 3D printing
US7372460B2 (en) Method and program for generating volume data from boundary representation data
WO2002023408A1 (en) Solid shape describing method and device therefor and solid shape design support system using them
Zhang et al. A surface based approach to recognition of geometric features for quality freeform surface machining
Feng et al. Direct slicing of T-spline surfaces for additive manufacturing
CN106445981A (en) Wavelet transform-based self-adaptive compression method for STL (Standard Template Library) grid model slicing data
Shin et al. Data enhancement for sharing of ship design models
Wang et al. Freeform extrusion by sketched input
KR102350267B1 (en) Mannequin split 3D printing method
CN111967066B (en) Modeling method for three-dimensional microscopic structure of polymorphic particle reinforced composite material
Agrawal et al. Conversion of a GIS surface data directly to a 3D STL part for terrain modeling
Pan et al. Development of rapid prototyping slicing software based on STL model
Inui et al. Quad Pillars and Delta Pillars: Algorithms for Converting Dexel Models to Polyhedral Models
Shi et al. Application software system based on direct slicing for rapid prototyping
Wu Application of AutoCAD in Graphic Art Design based on VBA
Roth-Koch Generating CAD models from sketches
CN100464335C (en) Transfer method from three-dimensional solid to standard technical layout in microelectromechanical system
CN110171139B (en) Method for unifying 3D printing and numerical calculation of thin-wall structure into grid
JPS62251965A (en) Solid model form defining system in cad/cam system
JP3895297B2 (en) Three-dimensional shape description method and engineering system using the same
Zhao Application Research in Computer Aided Development Modeling System of Art Design 3D Technology
JP2737126B2 (en) Method for creating cross-sectional image data of an object

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20141224