Content uploaded by Sorin Popescu

Author content

All content in this area was uploaded by Sorin Popescu on Sep 25, 2015

Content may be subject to copyright.

Available via license: CC BY-NC-ND 3.0

Content may be subject to copyright.

Procedia CIRP 25 ( 2014 ) 75 – 80

Available online at www.sciencedirect.com

2212-8271 © 2014 The Authors. Published by Elsevier B.V. This is an open access article under the CC BY-NC-ND license

(http://creativecommons.org/licenses/by-nc-nd/3.0/).

Peer-review under responsibility of The International Scientific Committee of the 8th International Conference on Digital Enterprise Technology - DET

2014 – “Disruptive Innovation in Manufacturing Engineering towards the 4th Industrial Revolution”

doi: 10.1016/j.procir.2014.10.013

ScienceDirect

8th International Conference on Digital Enterprise Technology - DET 2014 – “Disruptive Innovation in

Manufacturing Engineering towards the 4th Industrial Revolution

Direct toolpath generation based on graph theory for milling roughing

Daniela Popescua, Florin Popistera*, Sorin Popescua, Calin Neamtua, Mircia Gurzaua

Technical University of Cluj-Napoca, Blvd. Muncii 103-105, Cluj-Napoca, 400641, Romania

* Corresponding author. Tel.: +40 742 394980. E-mail address: florin.popister@muri.utcluj.ro

Abstract

The paper presents a tool path generation methodology for roughing operation based on the oriented graph theory. The cutting areas are

identified using an original method that is based on a bicolor and binary map. The toolpath is generated using the searching Dijkstra algorithm

inside a graph in order to find the single-source shortest path. The method was employed in order to be applied on ordered and/or unordered

point clouds. The entire algorithm was implemented into a mathematic calculus solution which allows the import of point clouds and its

processing until the final NC code is generated.

© 2014 The Authors. Published by Elsevier B.V.

Peer-review under responsibility of the Scientific Committee of the “8th International Conference on Digital Enterprise Technology - DET

2014.

Keywords: direct toolpath, graph theory, cloud points, roughing

1. Introduction

More and more researchers are studying the problem of

direct tool path generation from point clouds because the

devices capable of creating such geometry are becoming more

efficient. These point clouds can be generated by 3D scanning

of a real object (contact or non-contact) using Computer

Tomography (CT) or by using photogrammetry.

Machining toolpath generation directly on point cloud

shortens the reverse engineering cycle of a component and

can reduce costs by eliminating the scan processing costs.

Thus, the filtering stage, the mesh generation stage and the

surface generation stage can be completely eliminated.

Usually the software of the scanning equipment (either by

palpation, or laser, or optical) allows a primary processing of

the point cloud so that it can be filtered or cropped to remove

unwanted points.

As show in [1], rapid generation of contour from massive

point cloud data is the crucial step for feature-based model

reconstruction. Based on the outline of a point cloud a clear

distinction can be made between the area where the material

is to be chipped and the area where it must remain intact.

In [2] the authors propose an algorithm for generating

roughing and finishing tool paths on measured data directly

by using Moving Least-Squares (MLS) method. In their

algorithm the roughing is performed in a slice-by-slice

manner to remove material rapidly. They generate an offset

point cloud for machining allowance, and slicing data points

were fitted by using MLS method to generate offset curve for

ball-end cutter.

Using the same technique for slicing the cloud point in

order to extract the machining regions (contour curves and

their inclusion relationships), [3] uses a boundary extraction

algorithm for determining the machining region. To avoid the

computational difficulties, they develop an algorithm to

calculate the finishing tool-path based on well-known 2D

geometric algorithms, such as 2D curve offsetting and

polygonal chain intersection algorithms.

In [4] the authors present a strategy for direct tool path

generation based on B-spline surfaces constructed using

extracted point data form initial cloud as control points. They

generate the adaptive (region-based) tool paths that overcome

the inherent drawback (redundant tool paths).

© 2014 The Authors. Published by Elsevier B.V. This is an open access article under the CC BY-NC-ND license

(http://creativecommons.org/licenses/by-nc-nd/3.0/).

Peer-review under responsibility of The International Scientiﬁ c Committee of the 8th International Conference on Digital Enterprise

Technology - DET 2014 – “Disruptive Innovation in Manufacturing Engineering towards the 4th Industrial Revolution”

76 Daniela Popescu et al. / Procedia CIRP 25 ( 2014 ) 75 – 80

In [5] the authors present a method based on generating

iso-planar piecewise. The primary direction of the generated

iso-planar tool paths is derived from the projected boundary

of the discrete points. A projected cutter location net (CL-net)

is then created, which groups the data points according to the

intended machining error and surface finish requirements.

In [6] a point-based conformal map is employed to build

the parameterization cloud point based on discrete Laplace

equation. They use also Iso-parametric curve determined in

base of normal curvature.

Surfel is the term used by [7] to describe the association of

“surface” and “element” in an entity which is used for

rendering the scanned data. Direct tool path generation is

made using a point-based model which is created using an

elliptical Gaussian re-sampling filter that is based on a signal

re-sampling algorithm. They use a re-sampling filter based on

Nyquist criterion to transform the input data (random cloud

point) into a continuous surface and then re-sample the

continuous surface. Because the re-sampled data can

accurately represent the original surface, tool paths can be

generated using CL. The CL point is found by lowering the

cutter in the direction normal to the projection plane until

contacts with the re-sampled points are made.

Using an algorithm based on 3D biarc fitting technique it is

possible to generate a 5-axis machining tool-path as shown in

[8]. They construct a three-dimensional (3D) triangular mesh

from the digitizing data with the mesh points considered as

the tool contact locations. The tool axis orientations which

must be determined in 5-axis tool-path are calculated using

3D biarc fitting.

[9] Since such planning falls into the iso-parametric

category, it intrinsically depends on the parameterization of

point clouds. Accordingly, a point-based conformal map is

employed to build the parameterization. Based on it, formulas

of computing path parameters are derived, which are much

simpler than the conventional ones. By regularizing parameter

domain and on the basis of the previous formulas, boundary

conformed tool-path can be generated with forward and side

step calculated against specified chord deviation and scallop

height, respectively. Experimental results are given to

illustrate the effectiveness of the proposed methods.

As shown in the literature, it has not been reported yet any

research aimed directly at tool path generation based on graph

theory. The majority of developed methodologies use slicing

and various algorithms and methods to reduce the number of

points and to generate the tool path.

2. Methodology for Direct tool path generation in case of

roughing

Current digitization technology allows scanning free form

type surfaces and directly obtaining the point cloud, Fig. 1, or

in some cases directly obtaining the 3D meshes [10, 11].

The algorithm presented in this paper can be applied in

case of roughing and finishing with commercial milling tools

in case of both ordered point clouds and unordered point

clouds.

Fig. 1. Ordered point cloud (top) and unordered (bottom)

Fig. 2. General algorithm

Starting from the point cloud direct tool path generation is

done by following the steps below (Fig. 2):

1. Alignment of the point cloud: its orientation in space,

establishing the axes system and determining the upper

and lower limits on the Z axis.

2. Cloud segmentation on Z axis: it is done by slicing on

perpendicular planes to the Z axis, the slicing pitch is

determined taking into account the parameters of the

cutting operation (tool geometry, material, feed rates,

etc.) and the geometry of the component that will be

cut.

3. Point recovery: beginning with the second segmentation

plane all points that are found above the sectioning

plane in which the tool path is calculated are projected

on that plane from top to bottom. This operation aims to

77

Daniela Popescu et al. / Procedia CIRP 25 ( 2014 ) 75 – 80

use all points to generate the tool path correctly and to

avoid collisions with already chipped areas

4. Cloud segmentation on XY plane: for each layer

obtained from the previous operation a grid is made. It

will be generated starting from the x=0 and y=0 point.

The lines and columns of the grid that bound the point

cloud contour are doubled in order to generate a

trajectory that allows correct processing of the contour.

5. Identify the milling area: the grid defined at 3 is

individually analyzed and each unit is assigned a value

of 1 if it contains points (red color) and 0 if it doesn’t

contain points (white color). This step takes into

account both points belonging to the slicing plane and

those obtained at 4 – point recovery.

6. Direct tool path generation: using the properties of

oriented graphs the toolpath is generated.

To illustrate the mathematical apparatus and the

implementation of the processing algorithms, a free form type

Bèzier surface was generated, Figure 3, which was later

physically materialized and scanned to obtain ordered and

unordered point clouds. The surface was generated using the

equation:

ܾሺݑǡݒሻൌσσ൫ଵଶ

൯ቀଵଶ

ቁ

ଵଶ

ୀ

ଵଶ

ୀ ݑሺͳെݑሻଵଶିݒሺͳെݒሻଵଶିܽାଵǡାଵ (1)

where ݑאሾͲǡͳሿǡݒאሾͲǡͳሿ

The points’ coordinate matrix was generated to obtain a

Bézier surface having a complex free form type geometry

which contains peaks and valleys and a caldera. According to

the methodology, which is focused on processing complex

surfaces using three – axes milling machines, the surface was

mathematically modelled so that it does not contain

overhangs, i.e. a line parallel to the Z axis must intersect the

surface at one point. The set of parameters was chosen so that

the generated surface fits into a 50 mm side square.

Fig. 3. Bèzier surface used as a standard

The surface was machined on a milling machine and then

scanned using contact and non–contact scanning equipment to

obtain ordered (47817 points) and unordered point clouds

(196057 points).

When machining complex surfaces using 3-axes CNC

machines, the tool path can be described generally as a

function of two variables:

ݖൌ݂ሺݔǡݕሻ (2)

The point cloud can be described by the equation:

ܽൌอݔଵݕଵݖଵ

ݔଶݕଶݖଶ

ݔݕݖอ (3)

If we make the following notations:

ܾݔൌอݔଵ

ݔଶ

ݔอǢܾݕൌอݕଵ

ݕଶ

ݕอǢܾൌอݖଵ

ݖଶ

ݖอ (4)

Then, to determine the workspace, we will determine the

maximum values of the vectors bx, by and bz.

In order to optimize the trajectory calculation, the first step

is to create segmentation on the Z axis, thus obtaining planes

parallel to the XOY plane as shown in Figure 4.

Fig. 4. Sectioning the cloud point

Setting then slicing pitch is based on quality of the

geometry of the machined surface, quality of the point cloud

(density, ordered, etc.), milling speed, quality of the milled

material, etc. For proper results the authors recommend that

the distance between the sectioning planes (dz) is not greater

than:

݀ݖൌ݀כͲǤ͵Ͷ

Τ (5)

where d is the diameter of the mill.

To determine the number of planes with which the cloud

point is sectioned on the Z axis, it must not be a fractionary or

mixed number, thus the integer will be extracted from the

following mathematical expression:

݊ൌ௭ೌೣି௭

ௗ (6)

where, zmax, zmin – represent the minimum and maximum

values of the matrix b, dz – represents the distance (depth of

cut) between the planes determined with formula 5.

If the result of equation 5 is not an integer then it is

rounded positively, the counting of the section planes begins

with zmin. The section planes are denoted with zi where ziܰכ .

Point recovery

The third step of the algorithm is the point recovery, Figure

5, it involves the projection of all points that are found above

78 Daniela Popescu et al. / Procedia CIRP 25 ( 2014 ) 75 – 80

a sectioning plane. The projection of the points from the upper

layers (from Zmax to Zmin) enables rapid determination of tool

paths through the oriented graphs method taking into account

the upper layers already machined. This operation is done by

changing the Z coordinate of the points that are above the

current sectioning plane. The projection is done on the

sectioning planes beginning with the sectioning plane at zmax.

Fig. 5. Point recovery

The identification of the points is made by comparing the

point’s Z coordinate with the height of the sectioning plane.

The index function for each layer is defined, which is 0 if

the layer doesn’t have any points and it receives the value 1 if

there are points in the layer.

For each point a[[j]] ( j gets values from 1 to Np = number

of points) is calculated (i = the smallest integer higher or

equal to (the difference between the maximum value z1 and

the value of the point a[[j,3]]) divided at the height of a layer

(dz) and if this number is 0, then the value 1 is assigned:

݅ൌቒ௭ଵିሾሾǡଷሿሿ

ௗ௭ ቓǢܫ݂ሾ݅ൌͲǡ݅ൌͳሿ; (7)

Cloud segmentation on XY plane

To determine the milling area, the oriented graph theory is

used. In the first phase a constant pitch grid, Figure 6, is

generated on both axes (x and y), the size of two grid lines

can be approximated as being equal to the radius of the mill.

In the second phase it identifies the areas of the grid where

points are found. This is done by comparing each point in that

layer with a series of discrete values representing the grid

Fig. 6. Creating the grid

nodes. In this operation are taken into account all the points

obtained after the recovery operation as can be seen in the

figure below.

Each space in the grid that contains at least one point is

numbered 1 (red) and will be part of the area that will not be

machined for that layer. Spaces containing no points are

numbered 0 (white) and will be part of the area for which the

milling trajectory will be determined as shown below.

Using tandem numbering and coloring enables the creation

of a binary and bi-color map, Figure 7, whose nodes are used

to generate the trajectory.

Fig. 7. Binary and bi-color map

Direct tool path generation

Trajectory calculation is made based on the contact point,

CC point, which can be found on the grid. The distance

between the grid lines was chosen to be ½ of the milling

tool’s diameter, thus allowing the use of different milling

geometries using a single algorithm: oriented graphs theory.

Define the following oriented graph:

ܩൌሺܺǡܷሻ (8)

where X is the set of vertices, in our case represented by

the set of grid nodes, and U is the set of arcs, represented in

our case by the set of points.

Thus any arc u Є U will be represented through

ݑൌሺݔǡݕሻݓ݄݁ݎ݁ݔǡݕאܺݏ݅ݔ്ݕ (9)

To determine the trajectory of the milling tool the chain

sequence of arcs:

ܥൌሾݑଵǡݑଶǡڮݑሿ (10)

With the condition that any arc ui from this array shares an

extremity with ui-1 , and the other extremity is shared with ui+1

for any i=1,...,n-1.

If all the arcs from the same L chain have the same

orientation that is given by direction from x0 to x

n then the

chain is called a road.

The road in an oriented graph G(X,Y) is an array of peaks:

ܶൌሾݔଵǡݔଶǡڮݔሿ (11)

With the property that (x0, x1), (x1, x2), ….,(xn-1, xn) Є U

(are arcs of the graph G).

The peaks x0 and xr are called extremities of the road D. If

the peaks x0 ,x1 , ... , xr are distinct, the road D is called

elementary. Thus, an oriented graph G is called connected if

79

Daniela Popescu et al. / Procedia CIRP 25 ( 2014 ) 75 – 80

for any two distinct peaks x and y there is a chain of

extremities x and y in G.

In order to determine the shortest path in an oriented graph,

one can use Dijkstra’s algorithm or the Roy-Floyd algorithm.

Dijkstra’s algorithm is a search in a graph algorithm that

solves the single-source shortest path problem for a graph

with non-negative edge path costs, producing a shortest path

tree [12].

Generating the peaks, v, of the grid using the resulted grid

is achieved determining the indexes of the points that can be

touched by the milling tool generating minimal paths in order

of increasing lengths.

After determining the shortest path to the area that will be

machined (the graph that contains type 0 or white nodes) the

scallop area between two successive passes of spherical

geometry mills is calculated based on the formula below:

ܰሾሼʹܥݏሾݐሿǡʹʹܵ݅݊ሾݐሿሽȀǤݐ ՜െܲ݅ ͵

Τሿ

(12)

ሾሼʹܥݏሾݐሿǡʹʹܵ݅݊ሾݐሿሽൌ

ൌሼʹʹܥݏሾ߬ሿǡʹʹܵ݅݊ሾ߬ሿሽǡሼݐǡ߬ሽሿ

where N-forms the spherical profile

results

ሼሼݐ՜െగ

ଷǡ߬՜െଶగ

ଷሽǡሼݐ ՜గ

ଷǡ߬՜ଶగ

ଷሽሽ (13)

3. Validation

The surface of Figure 8 was machined on CNC equipment

and it was validated in terms of shape deviations by point by

point measuring and comparing with the CAD model using a

multisensor CMM. After the validation, the surface was

digitized, Figure 9, using the contact and non-contact methods

in order to obtain ordered and unordered point clouds (Figure

1).

Fig. 8. Machined standard surface

After the digitization the ordered cloud point contains

47817 points while the unordered one contains196057 points.

For the segmentation on the Z axis a pitch of 0.5 mm was

chosen, that corresponds to the depth of cut, thus resulting 25

layers.

The distance between two consecutive trajectories is ½ of

the milling tool’s diameter, for validation two types of milling

tools were used: ball mill and end mill having diameters of 4

mm with two cutting areas (flutes).

After calculating the trajectory, the NC program is

generated directly in Mathematica according to the

requirements of ISO 6983-1 regarding program format and

definitions of address words.

Using the same parameters for segmentation (both Z axis

and the plane XOY) 36763 program lines were obtained in

case of the ordered point cloud and 38411 lines in case of the

unordered point cloud.

Fig. 9. Equipment used to digitize the master part: contact scanning

equipment (up) and multisensor measuring and scanning equipment (down)

The Figure 10 shows the result of machining with two

different mills (a, b, c and d) in case of using a distance of ½

of the milling tool’s diameter between the trajectories and

constant machining allowance.

Ball end mill

End mill

Roughing based on an ordered cloud using

a) using ball end mill

b)using end mill

Roughing based on an unordered cloud using

c) using ball end mill

d) using end mill

Fig. 10. Results of milling with different cutting tools

80 Daniela Popescu et al. / Procedia CIRP 25 ( 2014 ) 75 – 80

To validate the algorithm and the work method, the

machining process was continued in order to obtain the

finished masterpart. Thus, based on the roughing algorithm,

the finishing methodology was developed using broadly the

same concept and tool support (Mathematica).

The differences between the two procedures (roughing and

finishing) are described below.

To obtain the trajectory for the finishing operation in case

of using the ordered point clouds, the procedure is the

following:

1. The alignment of the point cloud: see roughing

operation

2. Cloud segmentation on Y axis – the point cloud is

sliced in the plane XOZ with a minimum pitch of 0.1 mm

3. Establishment of Control Points: the identification of

which points will be taken into account when generating the

toolpath

4. Direct tool path generation: generating the offset

trajectory using Bezier curves and using CL (Cutter Location)

In case of the unordered cloud points, Control points are

established using the following algorithm:

• Dividing the machined area into 0.2 mm side

squares, the intersection of each of the squares’ diagonals will

be a control point for the Bezier curve

• Check that in the set of points within the square there

is a point which coincides with the intersection of the

diagonals: if there is, it becomes a control point; if there isn’t,

the Z coordinate of the intersection of the diagonals is

determined using all the points belonging to the cloud point

which can be found in a 5x5 matrix centered on the square for

which the z coordinate is determined.

After the final machining operation, the master part was

scanned and compared to the initial 3D model. The

differences are highlighted in the color map, Figure 11.

Fig. 11. Deviation analysis between CAD model and machined surface in

case of: ordered cloud point (up) and unordered cloud point (bottom)

4. Conclusions

Direct tool path generation using the oriented graphs’

properties is the first approach in literature as was shown in

the introduction to this article and allows rapid generation of

machining trajectories based on an algorithm that computes

the shortest path between two vertices.

The presented working methodology has been

implemented in a mathematical program for general use and

has been validated on the surface of a master part generated

by a mathematical equation (1). For the validation process

even the finishing operation was done using a methodology

derived from the roughing process in order to be able to

compare the master part with the CAD model using a

multisensory CMM.

The presented methodology can be used both for ordered

and unordered cloud points. Even though between the number

of points there is a difference of four times, the number of

lines of the NC program is about equal, however at this time

the NC program has quite many lines. Using the oriented

graph proprieties the interference that can appear during tool

path generation process directly from measured or scanned

data points allows generating the shortest path provides a

trajectory optimization to minimize air movement of the

milling tool. The method for identifying the area to be

machined is original and highlights for the first time in binary

and bicolor map the areas that will generate the toolpath. Even

if the implementation in Mathematica enables automatic

generation of NC code, the number of program lines is very

large; this should be optimized in future.

5. REFERENCES

[1]. Cheng, X., D. Jia, and Y. Liu, A fast contour generation algorithm of

massive point cloud data. Tongji Daxue Xuebao/Journal of Tongji

University, 2012. 40(10): p. 1559-1563.

[2]. Han, Y.A. and Y.J. Zhang, Tool path generation on measured data using

moving least squares method. Jisuanji Jicheng Zhizao Xitong/Computer

Integrated Manufacturing Systems, CIMS, 2011. 17(3): p. 638-642.

[3]. Park, S.C. and Y.C. Chung, Tool-path generation from measured data.

Computer-Aided Design, 2003. 35(5): p. 467-475.

[4]. Yin, Z., Adaptive tool path generation from measured data. Proceedings

of the Institution of Mechanical Engineers Part B-Journal of Engineering

Manufacture, 2004. 218(1): p. 103-111.

[5]. Feng, H.Y. and Z.J. Teng, Iso-planar piecewise linear NC tool path

generation from discrete measured data points. Computer-Aided

Design, 2005. 37(1): p. 55-64.

[6]. Zou, Q. and J.B. Zhao, Iso-parametric tool-path planning for point

clouds. Computer-Aided Design, 2013. 45(11): p. 1459-1468.

[7]. Yau, H.T. and C.Y. Hsu, Generating NC tool paths from random

scanned data using point-based models. International Journal of

Advanced Manufacturing Technology, 2009. 41(9-10): p. 897-907.

[8]. Chui, K.L., W.K. Chiu, and K.M. Yu, Direct 5-axis tool-path generation

from point cloud input using 3D biarc fitting. Robotics and Computer-

Integrated Manufacturing, 2008. 24(2): p. 270-286.

[9]. Zou, Q. and J. Zhao, Iso-parametric tool-path planning for point clouds.

Computer-Aided Design, 2013. 45(11): p. 1459-1468.

[10].Popişter, F., D. Popescu, and D. Hurgoiu, A new method for using

reverse engineering in case of ceramic tiles. Quality - Access to Success,

2012. 13(SUPPL.5): p. 409-412.

[11].Morovic, L. and P. Pokorny, Optical 3D Scanning of Small Parts, in

Automation Equipment and Systems, Pts 1-4, W.Z. Chen, et al., Editors.

2012, Trans Tech Publications Ltd: Stafa-Zurich. p. 2269-2273.

[12].Mehlhorn, K. and P. Sanders, Algorithms and Data Structures: The

Basic Toolbox. 2008: Springer.