Basic CNC
Basic CNC
Abstract 1. Introduction
Keywords: NC milling simulation, dexel approach, in- cutter) are displayed. The cutter can be observed moving
homogeneous material properties along the toolpath, which is defined by the NC program.
As the cutter is removing material, intersection calculations
1
are used to determine the removed parts of the workpiece. 1.1. Accurate approaches to NC milling
The workpiece is updated for every frame in the image se-
Kawashima [13] used a special geometric modelling
quence. The geometric representations of workpiece and
method called Graftree to speed up his solid modeling ap-
cutter are displayed on the screen using more or less so-
proach. Using CSG modelling, their approach allowed ac-
phisticated computer graphics techniques.
curate and precise representation of the workpiece and the
tool, while an octtree helped to decrease the number of ray-
The most important aspect in NC milling simulation is
intersection calculations in rendering. NC milling was sim-
error assessment. The workpiece is compared to the desired
ulated by using a Boolean difference operator. Another ap-
design part. The local deviation can be used to map the
proach to find the exact representation of the envelope of a
error into color hue, which can easily be interpreted by the
swept volume was chosen by Sourin [1]. He described the
NC programmer. Special constraints to error simulation like
cutting tool analytically with the use of procedurally im-
cutter wear-out are usually not taken into account. An accu-
plemented time-dependent defining functions. Boolean set
rate simulation of this phenomenon would require detailed
operations are defined by Rvachevs R-functions [5]. The
knowledge about material properties of the workpiece like
milling process is visualized by ray tracing the analytically
density and heat coefficents.
defined scene, which is a very time-consuming process.
lawn mowing[2] mesh with normals polygons yes ball or cylinder no explicit as polygons 3/5
Table 1. Comparison of previous techniques. Abbrevations used for the table columns: ea. . . error
assessment, and vp. . . view point dependency.
0 x
~n 2 R3 is the height gradient vector for the dexel. It
z is precalculated by the central difference method using
the top values of the dexel set.
L 0 1
Cx B dexi+1 ;j :top ? dex i?1;j :top C
B@ dexi;j+1 :top ? dexi;j?1 :top CCA
dexi;j :~n = B (1)
Cy R ?1
y
Rx with dexi;j 2 D:X . The use of ~n singnificantly speeds
up the simulation of milling free form surfaces, which
Figure 1. Dexel data set for a cube shaped ob- is described in section 2.4. As 3-axis machining of
ject free form surfaces is most common in industrial NC
milling, this work will focus on improvements in this
field.
top is the top height-value of a dexel.
2.2. Workpiece and cutter representations
bottom is the bottom height-value. The number of as dexel data sets
bits used to describe these values determines the res-
olution which may be achieved in z -direction. If Two different objects modeled with the dexel representa-
top; bottom 2 [0::2m ? 1] where m is the number of tion are needed for our approach of simulating NC milling:
a workpiece DW and a cutting tool DC . Cylindrical cutters (as well as the cylindrical shaft of ball-
end cutters) may be defined in a similar way.
2.2.1 The workpiece
Ball-end cutters are the most common tools in milling free The dexels of the cutting tool DC:X are trans-
form surfaces. Therefore the geometry of a ball-end cutter formed into the coordinate system of the workpiece
is described. The geometric definition of a sphere is used i;j is within the
(DW:C; DW:L). If a transformed dexel dex
to describe the desired shape of the cutter DC . For every boundary of the workpiece dexel structure, then the nearest
location (i; j ) on the dexel grid of DC a ray is cast in direc- neighbour wx;y 2 DW:X is found. This discrete sampling
tion of DC:Cz . This ray is analytically intersected with the approach could lead to aliasing artefacts. A better solution
defining sphere. The intersection points define the geometry would be to take all dexels into account, which are covered
of the dexel dexi;j 2 DC:X . Three cases may occur: by the projected area of the cutter dexel. Cutting should
Two intersection points ((i; j; zb ) and (i; j; zt )) are then be applied to all of these dexels, weighting the influ-
found. dexi;j :bottom is set to zb , the smaller one of ence of the cutting operation by the fraction of the dexel
the calculated z values. dexi;j :top is set to zt . area which is common to both the workpiece and cutter
dexel. This approach is computationally much more expen-
One intersection point is found: (i; j; z ). Both
sive than chosing a single candidate dexel for cutting. As
dexi;j :bottom and dexi;j :top are set to z . the visual differences in results are neglegible (present, but
No intersection point is found. Both dexi;j :bottom not visible), the inexpensive approach can be chosen.
and dexi;j :top are set to 0. The cutting operation is simplified to comparing the top
and bottom values of these two corresponding dexels. The Converting the 3-axis milled dexel structure into a
following cases (depicted in figure 2) may occur: surface representation is straightforward. The top loca-
tions of four neighbouring dexels dexi;j :top, dexi+1;j :top,
wx;y :top < dex
i;j :bottom: The cutter dexel is above
dexi+1;j+1 :top, dexi;j+1 :top determine the vertices of two
the workpiece dexel. No intersection is found. (figure
triangles. Evaluting this for all dexels gives a representation
2a)
of the top surface without holes (see figure 3).
i;j :top:
dex The cutter removes the top part of the
workpiece dexel. wx;y :top is set to i;j :bottom.
dex Cy
surface
Cz
(figure 2b)
surface
wx;y :bottom: The cutter removes the workpiece dexel no surface, like in figure 4b the leftmost and rightmost dex-
completely (figure 2e). wx;y :top and wx;y :bottom are els). When only the top surface of the dexel structure has
surface surface
0 1 2 3
Xt = Xb = 0 vertical horizontal
Xt = Xb polygon polygon
Cx Cx
X (i,j) X (i,j)
a b
Cz Cz
Figure 5. Possible cases of border/hole dis-
surface surface
tribution among neighbouring dexels
Figure 4. The non trivial case of connecting Three dexels are classified as ”material“ (figure 5(2)).
top and bottom surfaces One horizontal polygon is created to close the top sur-
face, one vertical polygon along the diagonal is created
to close the side face.
2.4.1 Obtaining visually correct vertical edges
high frequency changes are eliminated from the image. We the dexels of the workpiece DW:X with the dexels of the
are using averaging on 3D vectors: the normal vectors of design part DD:X . Local error assessment compares single
neighbouring dexels and the normal vector of the dexel are dexels whereas global assessment compares all the dexels.
weighted and summed up to get the blurred normal vector Overcutting and undercutting may occur (see figure 8).
for the dexel. See figure 6 for a graphical representation Overcutting occurs at regions, where already too much ma-
of the process. When these antialiased normal vectors are terial has been removed. Undercutting means, that there is
still material in excess at some location.
Erel = P wE :top
wood or a block of compound material will not give the
(3)
i;j i;j same visual impression as milling a block of grey alu-
2.6. Material properties minium. Furthermore, color is a simple and intuitive exam-
ple of a varying property, which may change with high fre-
Nowadays often special metal alloyes, compound and quency. The next sections will focus on the usage of color
other syntethic materials are used for NC milling. There- for the simulation of NC milling processes.
Figure 10. Error assessment by color coding
subdivided
Different methods are possible to simulate the use of bad polygons
behaved
polygon
color. Color can be predefined by the user or it can be as-
sociated with special local properties and created on the fly
during isosurfacing. Predefining colors can also be done by
Figure 11. Bad behaved polygons have to be
simply painting them as 2D images or specifying them with
converted into well behave ones
the use of analytical functions.
not doing real texture mapping for all points in the interior part of the workpiece, the texture function will evaluate to
of a triangle. By only assigning color values to the vertices black, whereas it will be yellow if the desired point is be-
and using smooth shading, large polygons become clearly low half the height of the workpiece dexel set. An image
visible for the lack of color change in their interior. There- of a workpiece milled with this function is shown in figure
fore, large polygons (and especially the extremely thin and 12. More sophisticated procedural texturing functions in-
long (bad behaved) polygons of the side surfaces) have to clude the stochastic textures described in [3]. For images
be split into a set of smaller (well behaved) polygons. Refer rendered with these textures see figure 14 to 16.
instance, the local derivative of the dexel height could be ated with this prototype implementation.
mapped into color values. High frequency height changes
For high quality color versions of the images presented
could be emphasized, therefore accentuating edges. Other
here, please see our web page at
possibilities include the highlighting of regions where the
dexel set is very thin, e.g., the difference between dexel
height and bottom values is small. This knowledge is very http://www.cg.tuwien.ac.at
important for the NC programmer in order to treat fade-out /research/vis/VolVis/NC/nc.html
regions carefully, because they tend to produce cracks.
3.1. Statistics for the different workpieces. The tool path has been gen-
erated automatically. The geometry of the design part was
Table 2 gives a comparison of the processing times for
scanned for height in x-axis parallel stripes. When the scan-
three different workpieces. This test runs were investigated
ning process reached the edge of the design part, the in-
with our prototype implementation on a 200MHz Pentium
struction to lift the cutter was added to the NC programm.
Pro computer without any hardware graphics acceleration.
The cutter was instructed to return to the other edge without
The first row of table 2 gives the resolution of the dexel
milling, where scanning of the design part was continued.
data sets for the workpiece in x and y direction.
This kind of machining is called zig-milling [6]. As in our
The second row describes the resolution of the cutting
implementation the instances of motion calculation could
tool. All workpieces presented here were created by ball
not be turned off for the moving cutter, intersection calcu-
shaped cutters.
lations were also made on the parts of the tool path where
The third row gives the number of cutting operations,
the cutter just returned to the other edge of the design part
which are possible per second.
without milling. Therefore the number of instances of mo-
The fourth row of table 2 gives the time neccessary for
tion (given in the sixth row of table 2) is in general two times
the visualization of the complete dexel data structure of the
the minimal number of instances neccessary to produce the
workpiece. This has usually only to be done once at the
workpiece.
beginning of the simulation process. During the simulation,
when the cutter moves over the workpiece, only the local The last two rows of table 2 show the simulation time
part of the scene has to be recreated which is affected by for milling the three different workpieces. The row before
the cutter motion. The time for this local update operation is the last gives the overall simulation time for the different
given in the fifth row. As it can be seen by the small amounts workpieces. For the measurements given in the last row
of update time, a continuous real time display of about 10 (”cutting only“), the animated visualization of the milling
frames per second is possible. A smooth animation of the process has been turned off. In this case just the cutting
moving cutter can be observed. calculations were made without the continuous update of
The sixth row gives the number of instances of motion the graphical representation of the milling scenario.
4. Conclusions tute of Computer Graphics, University of Technology,
Vienna., 1997.
A new approach to the simulation of NC milling pro-
[5] Rvachev V. L. Methods of Logic Algebra in Mathe-
cesses was created. The well known dexel approach uses
matical Physics. Naukova Dumka Publishers, Kiev,
a high resolution data structure, which requires enormous
1974.
amounts of processing power. The dexel approach has been
adapted to the limited performance capabilities of low-end [6] Held M. A geometry-based investigation of the tool
graphics hardware by using a lower resolution of the data path generation for zigzag pocket machining. The Vi-
structure. Therefore a special visualization technique had sual Computer, 7:296–308, 1991.
to be developed, which produces renderings of low reso-
[7] Yang M. and Lee E. NC verfication for wire-EDM
lution dexel structures. Even on low end IBM compatible
using an r-map. Computer Aided Design, 28(9):733–
platforms, update rates are interactive.
740, 1996.
Another aim of this work was the integration of inho-
mogeneous material properties. As the dexel approach is [8] Takafumi S. and Takahashi T. NC machining with
a volumetric representation of data, various different data the G-buffer method. Computer Graphics, 25(4):207–
values can be stored and processed along with the geomet- 216, 1991.
ric information of the workpiece. Color was chosen as an
[9] Chappel I. T. The use of vectors to simulate material
intuitive example of a locally varying property. Using pro-
removed by numerically controlled milling. Computer
cedurally defined 3D textures, visually realistic results were
Aided Design, 15(3):156–158, 1983.
obtained.
[10] Hook T. van. Real time shaded NC milling display.
Figure 14. Free form surface milled from marble, cutter in red
Figure 15. Another example for a workpiece milled from two layers of marble