0% found this document useful (0 votes)
1K views73 pages

Class Notes CAD CAM

This document outlines the purpose, expected outcomes, and course outline for a computer-aided drawing course. The purpose is to enable students to understand and apply computer drawing skills to develop complex engineering drawings and designs. By the end of the course, students should be able to use CAD workstations to produce orthographic drawings and 3D models, and make electrical and piping drawings. The course outline covers the history and evolution of CAD and CAM, CAD hardware and software systems, computer graphics, geometric modeling, computer numerical controlled machine tools, and CAD/CAM approaches to part programming.

Uploaded by

Antony Njoroge
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1K views73 pages

Class Notes CAD CAM

This document outlines the purpose, expected outcomes, and course outline for a computer-aided drawing course. The purpose is to enable students to understand and apply computer drawing skills to develop complex engineering drawings and designs. By the end of the course, students should be able to use CAD workstations to produce orthographic drawings and 3D models, and make electrical and piping drawings. The course outline covers the history and evolution of CAD and CAM, CAD hardware and software systems, computer graphics, geometric modeling, computer numerical controlled machine tools, and CAD/CAM approaches to part programming.

Uploaded by

Antony Njoroge
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 73

Purpose

The purpose of this course is to enable the student to;


• understand simple computer-aided drawing

• apply computer drawing skills to develop complex engineering drawing and design

• integrate theory and practice of engineering drawing, using studio-based practical


sessions.

Expected Outcomes

At the end of this course, you should be able to;


• use an industry-standard Computer Aided Design (CAD) workstation to produce
accurate orthographic drawings of objects and assembled components

• use the basic functions of a solid modeller within the CAD system to draw 3-
dimensional objects

• use CAD system to make electrical circuit drawings and piping drawings

Course Outline

History and evolutions of CAD and CAM. Architecture of CAD: CAD hardware sys-
tems. CAD software systems: Types such as AutoCAD and Design CAD. 3-D computer
aided draughting. Mathematical elements of computer graphics: Derivatives, chain rule,
curves and fractals, curve generation, interpolation, B-splines, Bezier curves, fractal -
fractal lines. Computer graphics: Transformations, translations, rotations. Geometric
modeling: Wireframe, surface and solid modelling. Finite elements as a CAD tool:
Draughting, modelling and analysis. Advantages and disadvantages of CAD. Introduc-
tion to the types and applications of numerically controlled machine tools: Structure
of numerical control programs and programming for numerical control. Introduction to
a Computer Aided Part Programming system: Structure and elements of a program,
the creation of a programme for a given component, examination of post processors,
production of a component from a post processed file.

Reference Textbooks
1. Encanacao J. L., Linder R. & Schechtendahl E. G. (1990) Computer Aided Design:
Fundamentals and System Architectures, Springer-Verlag, Berlin

2. Tien-Chien Chang, Richard A. Wysk, Hsu-Pin Wang (2006) Computer Aided Man-
ufacturing Prentice Hall international 3rd Ed

i
Contents

Purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . i
Expected Outcomes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . i
Course Outline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . i
Reference Textbooks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . i

1 Fundamentals of CAD-CAM systems 1


1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Brief history of Computer Aided Design (CAD) . . . . . . . . . . . . . . 1
1.3 Brief history in CAM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.4 The architecture of CAD . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.5 CAD hardware systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.5.1 Input Devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.5.2 Output Devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.6 CAD software systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

2 Computer Graphics 8
2.1 Two-Dimensional Transformation . . . . . . . . . . . . . . . . . . . . . . 8
2.1.1 Basic modeling transformations . . . . . . . . . . . . . . . . . . . 8
2.2 Three-Dimensional Transformation . . . . . . . . . . . . . . . . . . . . . 18
2.2.1 Rotation Transformation . . . . . . . . . . . . . . . . . . . . . . . 18

3 Geometric modelling 20
3.1 Curves . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
3.1.1 Role of Curves in Geometric Modeling . . . . . . . . . . . . . . . 22
3.1.2 Parametric and Non-parametric Equations of a Curve . . . . . . . 23

ii
3.1.3 Fixed-Form or Analytical Curves . . . . . . . . . . . . . . . . . . 24
3.1.4 Interpolated Curves . . . . . . . . . . . . . . . . . . . . . . . . . . 28
3.1.5 Approximated Synthetic Curves . . . . . . . . . . . . . . . . . . . 33
3.2 Surfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
3.2.1 Analytical surfaces . . . . . . . . . . . . . . . . . . . . . . . . . . 37
3.2.2 Free-form surfaces: . . . . . . . . . . . . . . . . . . . . . . . . . . 40
3.3 Solid models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
3.4 Finite Element as CAD tool . . . . . . . . . . . . . . . . . . . . . . . . . 41

4 Computer numerical controlled (CNC) Machine Tools 42


4.1 Applications of numerical control . . . . . . . . . . . . . . . . . . . . . . 43
4.1.1 Machine tool applications . . . . . . . . . . . . . . . . . . . . . . 44
4.1.2 Non-Machine tool applications . . . . . . . . . . . . . . . . . . . . 44
4.2 Advantages of CNC machine tools . . . . . . . . . . . . . . . . . . . . . . 45
4.3 Hardware for numerical control . . . . . . . . . . . . . . . . . . . . . . . 47
4.4 Data for a typical CNC machine (3-axis vertical machining center) . . . . 48
4.5 Other functions of a CNC machine tool . . . . . . . . . . . . . . . . . . . 48
4.6 Control loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
4.6.1 Open loop control . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
4.6.2 Closed loop control . . . . . . . . . . . . . . . . . . . . . . . . . . 51
4.7 CNC Operational sequence . . . . . . . . . . . . . . . . . . . . . . . . . . 52
4.8 Types of programming and interpolation . . . . . . . . . . . . . . . . . . 53
4.9 Circular interpolation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
4.10 CNC Part programming . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
4.10.1 Word address format in numerical control . . . . . . . . . . . . . 58
4.10.2 Manual programming . . . . . . . . . . . . . . . . . . . . . . . . . 59
4.10.3 List of G and M codes . . . . . . . . . . . . . . . . . . . . . . . . 61
4.10.4 Computer assisted part programming using high level languages . 65
4.10.5 The APT language . . . . . . . . . . . . . . . . . . . . . . . . . . 65
4.11 CAD/CAM Approach to part programming . . . . . . . . . . . . . . . . 69

iii
Chapter 1

Fundamentals of CAD-CAM
systems
1.1 Introduction

Computer-aided design (CAD) is the process of utilizing computers to create and


edit design models and drawings or can be described as using a computer in a design
process whereas CAM can be described as application of computer in manufacturing.

1.2 Brief history of Computer Aided Design (CAD)


Computer Aided Design (CAD) is the process of utilizing computers to create and edit
design models and drawings. The concept of CAD and CAM is relatively new. The
usage is linked with the development of computers. The actual application of CAD/CAM
in industry, academia and government is only approximately 40 years old. Formal courses
in CAD and Finite Element Analysis (FEA) were introduced in 1970s. The major
application thrust of CAD came in 1980s, with the availability of PCs and workstations.
In its early stage of usage, very few engineering companies could afford the expense of
mainframe computers; however, PCs and workstations have evolved into affordable and
adequate platform to support comprehensive CAD packages that initially were designed
to run on the mainframe platform. A brief history of the evolution of CAD/CAM,
according to the decade and the major CAD/CAM developments, is outlined below.
1960
• Development in Interactive computer graphics research

• Sketchpad system developed by Ivan Sutherland in 1962

• CAD term coined

• First major commercial CAD/CAM software available: CADAM by Lockheed, in


1965

• Bell Telephones - Graphics 1 remote display system developed

1970
• Application of CAM in government, industry and academia

1
• National organization formed
• Beginning of usage of computer graphics
• Turnkey system available for drafting
• Wireframe and surface modeling software became available
• Mass property calculation and FEA software became available
• NC tape generating, verification, and integrated circuit software became available-
Beginning of usage of computer graphics
• Turnkey system available for drafting

1980
• CAD/CAM used for engineering research and development
• New CAD/CAM theories and algorithms developed
• Integration of CAD/CAM
• Solid modeling software became available
• Use of PCs and workstation began

1990
• Concept of concurrent engineering developed
• Increased use of CAD/CAM on PCs and worksations
• Improvements in hardware and software

Advantages of CAD
• A faster rate of producing drawing.
• Great accuracy in drawing-enhanced by zooming feature.
• Neat drawings.
• No repetitions of drawing.
• CAD system contain draughting features.
• They are faster in design calculations and analysis.
• Produce superior design forms which also allows for quick modifications.
• There is less development required in the design process (shortened by eliminating
prototype)
• Design in CAD can also be integrated with other disciplines (Computer aided
engineering, CAM, CIM FMS etc)

2
1.3 Brief history in CAM

CAM refers to any automated manufacturing process which is controlled by computer.


The origin of CAM can be traced to the back early 40’s and 50’s mainly in motor
vehicle industries in early 60’s the term CNC was adapted. Parallel development in
computer controlled robots and automated factories has lead to a complete evolution of
manufacturing system organized under a philosophy called Flexible Manufacturing
System. The important of CAM includes
1. CN manufacturing and production technology

2. Computer controlled robotic

3. Manufacturing and assembly

4. Computer aided engineering

5. Flexible manufacturing system

Advantages of CAM
• A higher production rate with low work force

• Increase in production reliability through the reduction of human errors

• Greater versatility of manufacturing form and assembly (Reduction in material


wastage)

• Space and energy optimization

• Repeatability of production process

• Superior products

The term CAD/CAM refers to the complete integration of CAD and CAM into one
complete process.

1.4 The architecture of CAD


A CAD system consists of three major parts
1. Hardware: Computer and input/output (I/O) devices

2. Operating system software

3. Application software: the CAD package

3
A wide range of hardware is used to support the software functions in CAD systems.
The operating system software is the interface between the CAD application software
and the hardware. It supervises the operation of the hardware and provide basic func-
tions, including creating and removing operating tasks, and providing access to software
resources such as files, editors, compilers, and utility programs. The operating system is
important not only for CAD software, but also for non-CAD software.
The application software is the heart of a CAD system. It consists of programs that do
2-D and 3-D modelling, drafting, and engineering analysis. The functionality of a CAD
system is built into the application software. It is the application software that makes
one CAD package different from another. Application software is usually operating sys-
tem dependent.
The general architecture of a CAD system is shown in Figure 1.1. The application
 
software is at the top level and is used to manipulate the CAD model database.

Application
Software

CAD
User Graphics Utility Model
Interface (GUI) Databas

Device Drivers

Printer

Figure 1.1: CAD system architecture

The graphic utility system performs coordinate transformation, windowing, and display
control. Because several different I/O devices may be used, device drivers translate the
data into and out of the specific data format utilized by each device. Device drivers also
control the physical devices. The operating system is run in the background to coordinate
the entire operation. Finally, a user interface links the human with the system.

1.5 CAD hardware systems


There are basically two types of devices that constitute CAD hardware: a) Input devices,
and b) Output devices. A brief description follows.

1.5.1 Input Devices

These are the devices that we use for communicating with computer, and providing our
input in the form of text and graphics. The text input is mainly provided through key-
board. For graphic input, there are several devices available and used according to the

4
work environment. A brief description of these devices is given here.
Mouse: This is a potentiometric device, which contains several variable resistors that
send signals to the computer. The functions of a mouse include locating a point on the
screen, sketching, dragging an object, entering values, accepting a software command,
etc. Joystick and trackballs are analogous to a mouse device, and operate on the same
principle.
Digitizers: Digitizers are used to trace a sketch or other 2-D entities by moving a cursor
over a flat surface (which contains the sketch). The position of the cursor provides a
feedback to the computer connected with the device. There are electrical wires embed-
ded in orthogonal directions that receive and pass signals between the device and the
computer. The device is basically a free moving puck or pen shaped stylus, connected
to a tablet.
Light Pens: Lockheeds CADAM software utilized this device to carry out the graphic
input. A light pen looks like a pen and contains a photocell, which emits an electronic
signal. When the pen is pointed at the monitor screen, it senses light, which is converted
to a signal. The signal is sent to the computer, for determination of the exact location
of the pen on the monitor screen.
Touch Sensitive Screens: This device is embedded in the monitor screens, usually,
in the form of an overlay. The screen senses the physical contact of the user. The new
generation of the Laptop computers is a good example of this device.
Other Graphic Input Devices: In addition to the devices described above, some CAD
software will accept input via Image Scanners, which can copy a drawing or schematic
with a camera and light beam assembly and convert it into a pictorial database. The
devices just described are, in general, independent of the CAD package being used. All
commercial CAD software packages contain the device drivers for the most commonly
used input devices. The device drivers facilitate a smooth interaction between our in-
put, the software, and the computer. An input device is evaluated on the basis of the
following factors:
• Resolution

• Accuracy

• Repeatability

• Linearity

1.5.2 Output Devices

After creating a CAD model, we often need a hard copy, using an output device. Plotters
and printers are used for this purpose. A plotter is often used to produce large size
drawings and assemblies, where as, a laser jet printer is adequate to provide a 3-D view
of a model. Most CAD software require a plotter for producing a shaded or a rendered
view.

5
1.6 CAD software systems
CAD software are written in FORTRAN and C languages. FORTRAN provides the
number crunching, where as, C language provides the visual images. Early CAD pack-
ages were turnkey systems, i.e., the CAD packages were sold as an integrated software
and hardware package, with no flexibility for using second vendor hardware (1970s and
80s). These systems were based on 16-bit word, and were incapable of networking. The
modern CAD software utilizes the open architecture system, i.e., software vendors do
not design and manufacture their own hardware. Third party software can be used to
augment the basic CAD package. Most popular CAD package will facilitate integration
of the Finite Element Analysis and other CAD software from more than one vendor. For
example, IDEAS preprocessor can work with almost all the FEA packages for pre and
post analyses.
Networking is an important consideration in applications of CAD software. A model
created by one engineer must be readily accessible to others in an organization, which
is linked by a LAN or other means. The designer, analyst, management, marketing,
vendor, and others generally share a model. This is the concurrent engineering in action,
mentioned earlier.
A good CAD package includes good software, as well as, a compatible hardware. Fol-
lowing is a brief description of the general criteria for evaluating a CAD package.
Hardware: Most desirable features in a good hardware are:
• Open architecture

• High speed, large storage

• Compact size

• Inexpensive components

• Inexpensive upgrading

Software: In general, the most comprehensive software are written to satisfy almost all
the modeling needs of a modeler, consequently, the software tend to be very complex
and hard to learn. To create a simple model, we go through several unnecessary steps,
and lack the intuitiveness of a simple, straightforward program. ProE is a good example,
where we have to go through several layers of menus to create a simple solid. On the
other hand, if we were to use a simpler CAD program, the same solid can be created by
only a few simple commands. There are several other factors that we should consider
when evaluating software. Following is a brief description of these factors.
• Operating System: Unix or Windows/NT. PCs in general use Microsoft Win-
dows, where as, operating system for Workstations is Unix. For a large organiza-
tion, Workstations are preferable.

• User Interface: Most popular CAD software have menu driven commands, which
is preferable to the old system of non-menu driven, where user interface was com-
pletely by responding to software commands. The most popular CAD programs
work with menu driven interface, with some input/action required through com-
mand prompts.

6
• Documentation and Support: Learning a software can be very difficult if the
software lacks good documentation. Documentation usually comes in the form
of a users manual, a tutorial book, commands manual, and on-line help. The
recent trend is to provide access to the above-mentioned documentation through
the Internet, or provide the manuals on a CD ROM. Some CAD vendors provide
additional technical support help through phone ProE is a very good example of
this type of support.

• Maintenance: Cost of the hardware and software upgrades can significantly im-
pact the small and medium size companies decision to choose one software over
the others. Most CAD vendors go through an upgrade, on the average, every two
years. Usually, hardware upgrade is not as frequent.

• Modeling Capabilities: In, general, a CAD software can be classified as either


a 2-D or a 3-D program. If we were basically involved in 2-D drawings, any well
established 2-D software, similar to AutoCAD would suffice our needs. On the
other hand, if we need to create 3-D models and assemblies, we will be better off
with a 3-D molder ProE, Solidworks, Autodesk Inventor etc.

• Ease of Modeling: As a rule-of-thumb, a general, all-purpose type CAD software


is much more complex and difficult to learn than a special purpose CAD package.

• Interface with other CAD Packages and Data Transferability: A CAD


package is used to create models that will be used for analysis, manufacturing, or
some other applications. Therefore, a CAD software should be capable of transfer-
ring and accepting files from other CAD or CAM programs, without this provision,
the CAD program has only a very limited use.

• Design Documentation: Besides creating a model, the software should be ca-


pable of creating drawings, assemblies, dimensioning, various views (isometric, or-
thogonal, etc.), labels and attributes, etc.

7
Chapter 2

Computer Graphics
2.1 Two-Dimensional Transformation
Geometric transformations have numerous applications in geometric modeling, e.g., ma-
nipulation of size, shape, and location of an object. In CAD, transformation is also used
to generate surfaces and solids by sweeping curves and surfaces, respectively. The term
sweeping refers to parametric transformations, which are utilized to generate surfaces
and solids. When we sweep a curve, it is transformed through several positions along or
around an axis, generating a surface. The appearance of the generated surface depends
on the number of instances of the transformation. A parameter t or s is varied from
0 to 1, with the interval value equal to the fraction of the parameter. For example, to
generate 10 instances, the parameter will have a value t/10 or s/10. To develop an easier
understanding of transformations, we will first study the two-dimensional transforma-
tions and then extend it to the study of three-dimensional transformations. Until we get
to the discussion of surfaces and solids, we will limit our discussion of transformation
to only the simple cases of scaling, translation, rotation, and the combinations of these.
Applications of transformations will become apparent when we discuss the surface and
solid modeling.
There are two types of transformations:
• Modeling Transformation: this transformation alters the coordinate values of
the object. Basic operations are scaling, translation, rotation and, combination of
one or more of these basic transformations. Examples of these transformations can
be easily found in any commercial CAD software. For instance, AutoCAD uses
SCALE, MOVE, and ROTATE commands for scaling, translation, and rotation
transformations, respectively.

• Visual Transformation: In this transformation there is no change in either the


geometry or the coordinates of the object. A copy of the object is placed at the
desired sight, without changing the coordinate values of the object. In AutoCAD,
the ZOOM and PAN commands are good examples of visual transformation.

2.1.1 Basic modeling transformations

There are three basic modeling transformations: Scaling, Translation, and Rotation.
Other transformations, which are modification or combination of any of the basic trans-
formations, are Shearing, Mirroring, copy, etc. Let us look at the procedure for carrying

8
out basic transformations, which are based on matrix operation. A transformation can
be expressed as
[P ∗] = [P ][T ]
where, [P ∗] is the new coordinates matrix
[P ] is the original coordinates matrix, or points matrix
[T ] is the transformation matrix With the z-terms set to zero, the P matrix can be
written as,  
x 1 y1 0
 x 2 y2 0 
 
 x 3 y3 0 
[P ] =   (2.1)
 .. .. .. 
 . . . 
xy xy 0

The size of this matrix depends on the geometry of the object, e.g., a point is defined
by a single set of coordinates (x1 , y1 , z1 ), a line is defined by two sets of coordinates
(x1 , y1 , z1 ) and (x2 , y2 , z2 ), etc. Thus a point matrix will have the size 1x3, line will be
2x3, etc.

A transformation matrix is always written as a 4x4 matrix, with a basic shape shown
below,  
1 0 0 0
 0 1 0 0 
[T ] = 
 0
 (2.2)
0 1 0 
0 0 0 1

Values of the elements in the matrix will change according to the type of transformation
being used, as we will see shortly. The transformation matrix changes the size, position,
and orientation of an object, by mathematically adding, or multiplying its coordinate
values. We will now discuss the mathematical procedure for scaling, translation, and
rotation transformations.

Scaling

In scaling transformation, the original coordinates of an object are multiplied by the


given scale factor. There are two types of scaling transformations: uniform and non-
uniform. In the uniform scaling, the coordinate values change uniformly along the x, y,
and z coordinates, where as, in non-uniform scaling, the change is not necessarily the
same in all the coordinate directions.
• Uniform Scaling:
For uniform scaling, the scaling transformation matrix is given as
 
s 0 0 0
 0 s 0 0 
[T ] = 
 0 0 s 0 
 (2.3)
0 0 0 1

Here, s is the scale factor.

9
• Non-Uniform Scaling:
Matrix equation of a non-uniform scaling has the form:
 
sx 0 0 0
 0 sy 0 0 
[T ] = 
 0 0 sz 0 
 (2.4)
0 0 0 1
where, sx , sx , sx are the scale factors for the x, y, and z coordinates of the object.

Homogeneous coordinates

Before proceeding further, we should review the concept of homogeneous coordinate


system. Since the points matrix has three columns for the x, y, and z values, and
a transformation matrix is always 4x4 matrix, the two matrices are incompatible for
multiplication. A matrix multiplication is compatible only if the number of columns in
the first matrix equals the number of row in the second matrix. For this reason, a points
matrix is written as,  
x1 y1 z1 0
 x2 y2 z2 0 
 
[P ] =  x3 y2 z3 0  (2.5)
 
 .. .. .. .. 
 . . . . 
xn yn zn 1
Here, we have converted the Cartesian coordinates into homogeneous coordinates by
adding a 4th column, with unit value in all rows. When a fourth column, with values
of 1 in each row, is added in the points matrix, the matrix multiplication between the
[P ] and [T ] becomes compatible. The values (x1 , y1 , z1 , 1) represent the coordinates of
the point (x1 , y1 , z1 ), and the coordinates are called as homogeneous coordinates. In
homogeneous coordinates, the points (2, 3, 1), (4, 6, 2), (6, 9, 3), (8, 12, 4), represent the
same point (2, 3, 1), along the plane z = 1, z = 2, z = 3, and z = 4, respectively. In our
subsequent discussion on transformation, we will use homogeneous coordinates.

Example

If the triangle A(1,1), B(2,1), C(1,3) is scaled by a factor 2, find the new coordinates of
the triangle.
Solution: Writing the points matrix in homogeneous coordinates, we have
 
1 1 0 1
[P ] =  2 1 0 1 
1 3 0 1

and the scaling transformation matrix is,


 
2 0 0 0
 0 2 0 0 
[Ts ] = 
 0

3 2 0 
0 0 0 1

10
The new points matrix can be evaluated by the equation

[P*] = [P] [T], and by substitution of the P and T values, we get


The new points matrix can be evaluated by the equation
[P ∗] = [P ][T ], and by substitution of the P and T values, we get
1 1 0 1 2 0 0 0  2 2 0 1
P* = 2 1 0 1  0 2 20 00 00 = 4 2 0  1

1 13 10 01 1 0 0 02 20 00  22 2 6 0 01 1
P∗ =  2 1 0 1  0 0 03 02 10  = 4 2 0 1
  
1 3 0 1 2 6 0 1
0 0 0 1

Transformed by scaling

Original

Note that Note that coordinates


the new the new coordinates represent
represent the original
the original value value
timestimes the scale
the scale factor.
factor. The The old and th
old and thenew
newpositions
positionsof of
thethe
triangle are shown
triangle in theinfigure.
are shown the figure.

Translation transformation

In translation, every point on an object translates exactly the same distance. The effect
of a translation transformation is that the original coordinate values increase or decrease
by the amount of the translation along the x, y, and z-axes. For example, if line A(2, 4),
B(5, 6) is translated 2 units along the positive x-axis and 3 units along the positive y-
axis, then the new coordinates of the line would be

A0 (2 + 2, 4 + 3), B 0 (5 + 2, 6 + 3) or
Lecture Notes © by R. B. Agarwal Computer Aided Design in Mechanical Engineering 2-6
0 0
A (4, 7), B (7, 9).

The transformation matrix has the form:


 
1 0 0 0
 0 1 0 0 
Tt = 
 0
 (2.6)
0 1 0 
x y 0 1

where, x and y are the values of translation in the x and y direction, respectively. For
translation transformation, the matrix equation is

[P ∗] = [P ][Tt ] (2.7)

where, [Tt ] is the translation transformation matrix.

11
Example

Translate the rectangle (2, 2), (2, 8), (10, 8), (10, 2) 2 units along x-axis and 3 units along
y-axis.

Solution:Using the matrix equation for translation, we have


[P ∗] = [P ][Tt ], substituting the numbers, we get

    
2 2 0 1 1 0 0 0 4 5 0 1
 2 8 0 1  0 1 0 0   Chapter 2 – Two Dimensional Transformation
 =  4 11 0 1 
  
[P ∗] = 
 10 8 0 1  0 0 1 0   12 11 0 1 
10 2 0 1 2 3 0 1 12 5 0 1
Note that the resultant coordinates are equal to the original x and y values plus the 2
2.73 Rotation
and units added to these values, respectively.

We will first consider rotation about the z-axis, which passes through the origin (0,0,0), since it
Rotation
is the simplest transformation for understanding the rotation transformation. Rotation about an
arbitrary axis, other than an axis passing through the origin, requires a combination of three or
Wemorewilltransformations, as we will
first consider rotation see later.
about the z-axis, which passes through the origin (0, 0, 0),
since it is the simplest transformation for understanding the rotation transformation.
When anabout
Rotation objectan
is rotated
arbitrary about theother
axis, z-axis, all the
than points
an axis on thethrough
passing object rotate in a circular
the origin, arc, and
requires
a the center of the
combination of arc liesorat more
three the origin. Similarly, rotation
transformations, as we of an see
will object about an arbitrary axis has
later.
the same relationship with the axis, i.e., all the points on the object rotate in a circular arc, and
When an object is rotated about the z-axis, all the points on the object rotate in a
the center of rotation lies at the given point through which the axis is passing.
circular arc, and the center of the arc lies at the origin. Similarly, rotation of an object
about an arbitrary axis has the same relationship with the axis, i.e., all the points on the
object rotate in a circular arc, and the center of rotation lies at the given point through
2.7.1 Derivation of the Rotation Transformation Matrix
which the axis is passing.
Using trigonometric relations, as given below, we can derive the rotation transformation
• Derivation
matrix. of P(x,
Let the point the y) Rotation
be on the Transformation
circle, located at an Matrix:
angle α, as shown. If the point
Using trigonometric
P is rotated relations,
an additional angle θ, the as
new given
pointbelow, we can
will have derive the rotation
the coordinates (x*, y*). transfor-
The
mation matrix. Let the point P (x, y) be on the
angle and the original coordinate relationship is found as follows. circle, located at an angle α, as
shown. If the point P is rotated an additional angle α, the new point will have the
coordinates (x∗ , y ∗ ). The angle and the original coordinate relationship is found as
follows.

x = r cos α
Original coordinates of point P.
y = r sin α

x* = rcos(α + θ)
The new coordinates.
*
y = rsin(α + θ)

where, α is the angle


between the line joining the initial position of
12the
point and the x-axis, and θ is the angle between
the original and the new position of the point.
where, α is the angle between the line joining the initial position of the point and
the x-axis, and θ is the angle between the original and the new position of the
point. Using the trigonometric relations, we get,

x∗ = r(cos α cos θ − sin α sin θ) = x cos θ − y sin θ


y ∗ = r(cos α sin θ + sin α cos θ) = x sin θ + y cos θ

In matrix form we can write these equations as


 
∗ ∗ cos θ sin θ
[x , y ] = [x, y] (2.8)
− sin θ cos θ
In general, the points matrix and the transformation matrix given in equation (2.8)
are re-written as
 
cos θ sin θ 0 0
 − sin θ cos θ 0 0 
[x ∗ y ∗ 01] = [xy01]   (2.9)
 0 0 1 0 
0 0 0 1

Thus, a point or any object can be rotated about the z-axis (in 2-D) and the
new coordinates of the object found by the product of the points matrix and the
rotation matrix, derived here.
• Rotation of an Object about an Arbitrary Axis: Rotation of a geometric
model about an arbitrary axis, other than any of the coordinate axes, involves sev-
eral rotational and translation transformations. When we rotate an object about
the origin (in 2-D), we in fact rotate it about the z-axis. Every point on the object
rotates along a circular path, with the center of rotation at the origin. If we wish
to rotate an object about an arbitrary axis, which is perpendicular to the xy-plane,
we will have to first translate the axis to the origin and then rotate the model, and
finally, translate so that the axis of rotation is restored to its initial position. If we
erroneously use the equation (2.9) directly, to rotate the object about a fixed axis,
and skip the translation of this point to the origin, we will in fact end up rotating
the object about the z-axis, and not about the fixed axis.

Thus, the rotation of an object about an arbitrary axis, involves three steps:
Step 1: Translate the fixed axis so that it coincides with the z-axis
Step 2: Rotate the object about the axis
Step 3: Translate the fixed axis back to the original position.

Note: When the fixed axis is translated, the object is also translated. The axis
and the object go through all the transformations simultaneously.

Example

Rotate the rectangle (0, 0), (2, 0), (2, 2), (0, 2) shown below, 300 ccw about its
centroid and find the new coordinates of the rectangle.
Solution: Centroid of the rectangle is at point (1, 1). We will first translate the
centroid to the origin, then rotate the rectangle, and finally, translate the rectangle

13
Example 3: Rotate the rectangle (0,0), (2,0), (2, 2), (0, 2) shown below, 30 ccw about
its centroid and find the new coordinates of the rectangle.

(0,2) (2,2)

(0,0) (2,0)

so that the centroid is restored to its original position.

1. Translate the centroid to the origin: The matrix equation for this step is
Solution: Centroid of the rectangle is at point(1, 1). We willfirst translate the centroid to th
0 0 the
origin, then rotate the rectangle, and finally, translate 0 rectangle
1 so that the centroid is rest
to its original 2 0 0 1
[P ∗position.
 
]1 = [P ][Tt ], where [P ] =   2 2 0 1 

1. Translate the centroid to the origin: The0 matrix


2 0 equation
1 for this step is

and  
1 0 0 0
 0
01 0 0 00  1

[Tt ] = 
[P*]1 = [P] [Tt], where [P] = 0 20 0 1 00 1
 
−1 2−1 2 0 01 1
0 2 0 1
2. Rotate the Rectangle 300 ccw About the z-axis: The matrix equation for
this step is given as
[P ∗ ]2 = [P ∗ ]1 [Tr ], where, [P∗ ]1 is the resultant points matrix obtained in step 1,
and [Tr ] is the rotation transformation, where θ = 300 ccw. The transformation
matrix is, 1 0 0 0
0  1 0 0
and cos θ [Ttsin
] θ= 0 0 0 0 1 00.866 0.5 0 0
 
 − sin θ cos θ 0 -10  -1 0 1−0.5 0.866 0 0 

[Tr ]θ =   =
 0 0 1 0   0 0 1 0 
0 0 0 1 0 0 0 1
Lecture Notes © by R. B. Agarwal Computer Aided Design in Mechanical Engineering 2-11
3. Translate the Rectangle so that the Centroid Lies at its Original Po-
sition: The matrix equation for this step is

[P ∗ ]3 = [P ∗ ]2 [T − t], where [T − t] is the reverse translation matrix, given as


 
1 0 0 0
 0 1 0 0 
[T − t] =  0 0 1

0 
1 1 0 1

Now we can write the entire matrix equation that combines all the three steps
outlined above. The equation is,

[P ∗ ] = [P ][Tt ][Tr ][T − t]

14
Substituting the values given earlier, we get,
    
0 0 0 1 1 0 0 0 0.866 0.5 0 0 1 0 0 0
2 0 0 1  0 1 0 0   −0.5 0.866 0 0  0 1 0 0 
[P ∗ ] = 
    
 
 2 2 0 1  0 0 1 0  0 0 1 0  0 0 1 0 
0 2 0 1 −1 −1 0 1 0 0 0 1 1 1 0 1
 
0.6340 −0.3660 0 1
 −0.3660 1.3660 0 1 
[P ∗ ] = 
 1.3660

2.3660 0 1 
−0.3660 1.3660 0 1
The first two columns represent the new coordinates of the rotated rectangle.

Combined transformations

Most applications require the use of more than one basic transformation to achieve de-
sired results. As stated earlier, scaling with an arbitrarily fixed point involves both
scaling and translation. And rotation around a given point, other than the origin, in-
volves rotation and translation. We will now consider these combined transformations.
• Scaling With an Arbitrary Point
In uniform scaling, all points and their coordinates are scaled by a factor s. There-
fore, unless the fixed point is located at (0, 0), it will be moved to a new location
with coordinates s-times x and s-times y. To scale an object about a fixed point,
the fixed point is first moved to the origin and then the object is scaled. Finally,
the object is translated or moved so that the fixed point is restored to its original
position. The transformation sequence is,

[P ∗ ] = [P ][Tt ][Ts ][T − t]

Where,
[Tt ] is the translation transformation matrix, for translation of the fixed point to
the origin,
[Ts ] is the scaling transformation matrix, and
[T − t] is the reverse translation matrix, to restore the fixed point to its original
position.

Note: The order of matrix multiplication progresses from left to right and the
order should not be changed.

The three transformation matrices [Tt ][Ts ][T − t] can be concatenated to produce
a single transformation matrix, which uniformly scales an object while keeping
the pivot point fixed. Thus, the resultant, concatenated transformation matrix for
scaling is,
     
1 0 0 0 s 0 0 0 1 0 0 0 s 0 0 0
 0 1 0 0  0 s 0 0  0 1 0 0  
      0 s 0 0 
[Ts ]R = 
 0 = 
0 1 0   0 0 s 0   0 0 1 0  0 0 s 0 
−x −y 0 1 0 0 0 1 x y 0 1 x − sx y − sy 0 1

15
The concatenated equation can be used directly instead of the step-by-step matrix
solution. This form is preferable when writing a CAD program.

• Rotation About an Arbitrary Point (in xy-plane)

[Tcond ] = [Tt ][Tr ][T − t] or


   
1 0 0 0 cos θ sin θ 0 0 1 0 0 0
 0 1 0 0   − sin θ cos θ 0 0  0 1 0 0 
[Tcond ] =  Chapter 2 – Two
0 1 0  Dimensional Transform
  
 0 0 1 0  0 0 1 0  0
−x −y 0 1 0 0 0 1 x y 0 1
where, θ is the angle of rotation and the point (x, y) lies in the x-y plane.
1 0 0 0 cosθ sinθ 0 0 1 0 0 0
0 1 0 0 -sinθ cosθ 0 0 0 1 0 0
Assignment
[Tcond] = 0 0 1 0 0 0 1 0 0 0 1 0 (2.11)
-x -y 0 1 0 0 0 1 x y 0 1
1.Given the triangle, described by the homogeneous points matrix below, scale it
by a factor 3/4, keeping the centroid in the same location. Use (a) separate matrix
operation and (b) condensed matrix for transformation.
 
2 2 0 1
where, θ is the angle of rotationand the point (x, y) lies in the xy plane.
[P ] = 2 5 0 1 
5 5 0 1
Example 5: Rotate the rectangle formed by points A(1,1), B(2,1), C(2,3), and D(1,3) 300 ccw
about
2. Rotate therectangle
the formed by points A(1, 1), B(2, 1), C(2, 3), and D(1, 3) 300
point (3,2).
ccw about the point (3, 2).

D(1,3) C C (2,3)

. . (3,2)

x
A(1,1) B(2,1)

Mirroring
Solution: We will first translate the point (3,2) to the origin, then rotate the rectangle about th
origin, and finally, translate the rectangle back so that the original point is restores to its origi
In modeling position
operations,
(3,2).one
Thefrequently used operation
new coordinates is mirroring
of the rectangle an object.
are found Mirroring
as follows.
is a convenient method used for copying an object while preserving its features. The
mirror transformation is a special case of a negative scaling, as will be explained below.
[P*] = [P] [Tt] [Tr] [T-t]
Let us say, we want to mirror the point A(2, 2) about the x-axis(i.e., xz-plane), as shown
in the figure.

1 1 0 1 1 0 0 0 .866 .5 0 0 1 0 0
2 1 0 1 0 1 0 0 -.5 .866 0 0 0 1 0
= 2 3 0 1 0 0 1 0 0 0 1 0 0 0 1
1 3 0 1 -3 16-2 0 1 0 0 0 1 3 2 0
ng operations, one frequently used operation is mirroring an object. Mirroring is a
nt method used for copying an object while preserving its features. The mirror
ation is a special case of a negative scaling, as will be explained below.

y, we want to mirror the point A(2,2) about the x-axis(i.e., xz-plane), as shown in the
The new location of the point, when reflected about the x-axis, will be at (2, −2). The
point matrix [P ∗ ] = [2 − 2] can be obtained with the matrix transformation given below.
location of the point, when reflected about the x-axis, willbe at (2, -2). The point
P*] = [2 -2] can be obtained with the matrix transformation 1given 0 below.
0 0
0 −1 0 0 
[P ∗ ] = [2201] 

 0 0 1 0  = [2 − 201]

0 0 0 1

y
1 0 0 0
0 -1 0 0 A(2, 2)
2 0 1] 0 0 1 0
0 0 0 1
x

A’(2, -2)
[2 -2 0 1]

The transformation matrix above is a special case of a non-uniform scaling with sx = 1


formation matrix above −1. We
and sisy a=special canofextend
case this concept
a non-uniform to with
scaling mirroring
sx =1 around
and the y, z, and any arbitrary
axis, astowill
We can extend this concept be explained
mirroring around in
thethe
y, z,following discussion.
and any arbitrary axis, as will be
• Mirroring About an Arbitrary Plane:
in the following discussion.
If mirroring is required about an arbitrary plane, other than one defined by the
coordinate axes, translation and/or rotation can be used to align the given plane
with one of the coordinate planes. After mirroring, translation or rotation must be
done in reverse order to restore the original geometry of the axis.
We will use the figure shown below, to illustrate the procedure for mirroring an
object about an arbitrary plane. We will mirror the given rectangle about a plane
passing through the line AB and perpendicular to the xy-plane. It should be noted
that in each of the transformations, the plane and the rectangle have a fixed rela-
tionship, i.e., when we move the plane (or line AB, the rectangle also moves with
it. A step-by-step procedure for mirroring the rectangle about the plane follows.
Note: We are using line AB to represent the plane, which passes through it. Mir-
roring can be done only about a plane, and not about a line.
Step 1: Translate the line AB (i.e., the plane) such that it passes through the
origin, as shown by the dashed line.
Step 2: Next, rotate the line about the origin (or the z-axis) such that it coincides
© by R. B. Agarwal Computer Aided Design in Mechanical Engineering 2-19
with x or y axes (we will use the x-axis).
Step 3: Mirror the rectangle about the x-axis.
Step 4: Rotate the line back to its original orientation.
Step 5: Translate the line back to its original position.

The new points matrix, in terms of the original points matrix and the five trans-
formation matrices is given as,

[P ∗ ] = [P ][Tt ][Tr ][Tm ][T − r][T − t]

17
nly about a plane, and not about a line.

Translate the line AB (i.e., the plane) such that it passes through the origin, as shown by
hed line.

Next, rotate the line about the origin (or the z-axis) such that it coincides with x or y
Where, the subscripts t, r, and m represent the translation, rotation, and mirror
axes (we will use the x-axis).
operations, respectively. Lecture
Mirror the rectangle about the x-axis.
(Note: A negative sign is used in the subscripts to indicate a reverse transfor-
Rotate the line back to itsmation).
original orientation.

Translate the line back to its original position.


2.2 Three-Dimensional Transformation

A three-dimensional object has a three-dimensional geometry, and therefore, it requires a


three-dimensional coordinate transformation. A right-handed coordinate system is used
to carry out a 3-D transformation. The scaling and translation transformations are es-
sentially the same as two-dimensional transformations. However, the points matrix will
tes © by R. B. Agarwal
haveComputer
a non-zero 3rd column. Additionally, the transformation
Aided Design in Mechanical Engineering 2-20
matrices contain some
non-zero values in the third row and third column, as shown below.

A general scaling transformation matrix is given as:


 
sx 0 0 0
 0 sy 0 0 
[Ts ] = 
 0 0 sz 0

 (2.10)
0 0 0 1
Where, sx , sy , sz are scale factors along x, y, and z-axes, respectively.

Translation Transformation matrix:


 
1 0 0 0
 0 1 0 0 
[Tt ] = 
 0
 (2.11)
0 1 0 
x y z 1

2.2.1 Rotation Transformation

The two-dimensional rotation transformation is in reality a special case of a three-


dimensional rotation about the z-axis. We will denote it by [Trz ], where, the second

18
subscript z indicates rotation about the z-axis. Similarly, rotation about the x and y-
axes are denoted as [Trx ], and [Try ], respectively. The transformation matrices are given
below.  
cos θ sin θ 0 0
 − sin θ cos θ 0 0 
[T rz] =   (2.12)
 0 0 1 0 
0 0 0 1
 
1 0 0 0
 0 cos θ sin θ 0 
[T rx] =  
 0 − sin θ cos θ 0  (2.13)
0 0 0 1
 
cos θ 0 − sin θ 0
 0 1 0 0 
[T ry] = 
 sin θ
 (2.14)
0 cos θ 0 
0 0 0 1

19
CHAPTER 4

CURVES

Chapter 3

Geometric modelling
4.1 Introduction
3.1 Curves
In order to understand the significance of curves, we should look into the types of model
representations that are used in geometric modeling. Curves play a very significant role in CAD
In order to understand the significance
modeling, especially, of curves,
for generating we should
a wireframe look which
model, into the types
is the of model
simplest form for
representations that are aused
representing in geometric modeling. Curves play a very significant role
model.
in CAD modeling, especially, for generating a wireframe model, which is the simplest
form for representing a model.
We can display We on
an object cana monitor
display screen
an object on different
in three a monitor screen in three
computer-model forms:
x Wireframe forms:
different computer-model model
x Surface
• Wireframe model Model
x Solid model
• Surface Model
• Solid model
Wireframe model: A wireframe model consist of points and curves only, and looks as if its
made up with a bunch of wires. This is the simplest CAD model of an object. Advantages of th
Wireframe typemodel: A wireframe
of model include easemodel consist
of creation andoflow
points
level and curves
hardware andonly, and requirements.
software looks
as if its made up with a bunch
Additionally, the dataofstorage
wires.requirement
This is theis simplest
low. The CAD model of anofobject.
main disadvantage a wireframe model
Advantages isof that
thisittype
can beofvery
model includeto ease
confusing of creation
visualize. and low
For example, levelhole
a blind hardware
in a box and
may look like a
software requirements.
solid cylinder,Additionally, thefigure.
as shown in the data storage requirement is low. The main
disadvantage of a wireframe model is that it can be very confusing to visualize. For
example, a blind hole in a box may look like a solid cylinder, as shown in the figure 3.1.

A wireframe model – Model of a Solid object with a blind hole


Figure 3.1: A wireframe model Model of a Solid object with a blind hole

In spite of its ambiguity, a wireframe model is still the most preferred form, because
it can be created quickly and easily to verifyComputer
ME 165 Lecture Notes © by R. B. Agarwal
a concept of an object. The wireframe
Aided Design in Mechanical Engineering 4-1
model creation is somewhat similar to drawing a sketch by hand to communicate or
conceptualize an object. As stated earlier, a wireframe model is created using points and
curves only.The disadvantages of wireframe models are manifold.
• These models are usually ambiguous representations of real objects and rely heavily
on human interpretation. Models of complex designs having many edges become
very confusing and perhaps even impossible to interpret.

20
• The lack of visual coherence and information to determine the object profile. In
most systems, the holes are displayed as two parallel circles separated by the hole
length.
• Representations of the intersection of plane faces with cylinders and that of cylin-
ders with cylinders, or tangent surfaces in general is usually a problem in wireframe
modelling and requires user manipulations.

Despite its many disadvantages, the major advantages of wireframe modelling is its sim-
plicity to construct. Therefore, it does not require as much computerChapter time and memory
4 - Curves
as does surface or solid modelling. However, the user or terminal time needed to prepare
and/or input data is substantial and increases rapidly with the complexity of the object
In spite
being of its ambiguity,
modelled. a wireframe
Wireframe modellingmodel
is is still the most
considered preferredextension
a natural form, because it can be
of traditional
created quickly
methods of drafting.and easily to verify a concept of an object. The wireframe model creation is
somewhat similar to drawing a sketch by hand to communicate or conceptualize an object. As
Surface Model:In
stated earlier, an attempt
a wireframe model istocreated
solve the
usingdrawback
points andofcurves
wireframe
only. models, some mod-
elling schemes add information about the surfaces in the part. In these systems, the
user enters
Surface the vertices
Model: sweepingand edgesaround
a curve as inorwireframe models,
along an axis but in
can create an ordered
a surface model.manner,
The
outlining or bounding one face at a time. For example
figures below show two instances of generating a surface model. sweeping a curve around or along
an axis can create a surface model. The figures below show two instances of generating
a surface model.

Generating a cylinder by sweeping a circle generating a donut by sweeping a circle


in the direction of an axis around an axis

Figure 3.2: Surface model

Theappearance
The appearance ororresolution
resolution of of
a surface model
a surface depends
model on the on
depends number of sweeping
the number instances
of sweeping
we select.we
instances Forselect.
a realistic
Forlooking model,looking
a realistic we needmodel,
to selectwea large
neednumber of instances,
to select requiring
a large number
a large computer memory, or, opt for a not-so realistic model by selecting a
of instances, requiring a large computer memory, or, opt for a not-so realistic model small number of
instances, and save memory. In some commercial CAD packages we have the option of selecting
by selecting a small number of instances, and save memory. In some commercial CAD
the resolution of a model, other packages have a fixed value for resolution that cannot be
packages we have the option of selecting the resolution of a model, other packages have
changed by users.
a fixed value for resolution that cannot be changed by users.
Surfacemodels
Surface models are useful
usefulforforrepresenting
representingsurfaces such
surfaces as aas
such soft-drink bottle,bottle,
a soft-drink automobile
automo-
fender, aircraft wing, and in general, any complicated curved surface. One of
bile fender, aircraft wing, and in general, any complicated curved surface. One of the the limitations of a
surface model
limitations of aissurface
that there is no is
model geometric definition
that there of points that
is no geometric lie insideoforpoints
definition outsidethat
the lie
surface.
inside or outside the surface. There are many surface entities provided by CAD/CAM
such as Plane surface, Ruled surface, Surface of revolution, Tabulated cylinder, B-spline
surface among others.
Solid Model: Representation of an object by a solid model is
Surface models have considerable advantages over wireframe models. -6mm
relatively a new concept. There were only a couple of solids
modeling CAD programs available in late 1980s, and they
• They
required are less ambiguous.
mainframe computers to run on. However, in 1990s,
due to the low cost and high speed, PCs have become the
• They
most popularprovide hidden line
solid modeling and platform,
software surface algorithms
prompting to add realism to the displayed
geometry.
almost all the CAD vendors to introduce their 3-D solid
modeling software that will run on a PC.
21
Solid models represent objects in a very realistic and
unambiguous form; however, they require a large amount of
storage memory and high-end computer hardware. A solid
Chapter 4 - Curves

s ambiguity, a wireframe model is still the most preferred form, because it can be
kly and easily to verify a concept of an object. The wireframe model creation is
milar to drawing a sketch by hand to communicate or conceptualize an object. As
• Shading algorithms are only available for surface and solid models.
r, a wireframe model is created using points and curves only.
• From an application point of view, surface models can be utilised in volume and
del: sweeping a curve around
massorproperty
along an axis can create finite
calculations, a surface model.modelling,
element The NC path generation, cross
w show two instances of generating a surface model.
sectioning, and interference detections.

Despite the above-cited advantages, surface models have few disadvantages.


• Surface modelling does not lend itself to drafting background. It therefore requires
more training and mathematical background on the users end.
• Surface models are generally more complex and thus require more terminal and
CPU time and computer storage to create than wireframe models.
a cylinder by sweeping a circle generating a donut by sweeping a circle
ion of an axis • They are still around an axis
ambiguous in some applications, as in the case when determining
which of an objects surfaces define its volume.
• Surface models are sometimes awkward to create and may require unnecessary
manipulations of wireframe entities.
nce or resolution of a surface model depends on the number of sweeping instances
or a realistic looking model, we need to select a large number of instances, requiring
puter memory, or, opt Solid
for aModel: Representation
not-so realistic of an object
model by selecting bynumber
a small a solid of
model is relatively a new concept.
nd save memory. In some commercial CAD packages we have the option of selecting available in late 1980s, and
There were only a couple of solids modeling CAD programs
n of a model, otherthey required
packages have mainframe
a fixed valuecomputers to run
for resolution on. However,
that cannot be in 1990s, due to the low cost
users. and high speed, PCs have become the most popular solid modeling software platform,
prompting almost all the CAD vendors to introduce their 3-D solid modeling software
that will run
dels are useful for representing on a such
surfaces PC. as a soft-drink bottle, automobile
aft wing, and in general, any complicated
Solid models represent curved surface.
objects in a One
veryofrealistic
the limitations of a
and unambiguous form; however, they
el is that there is no geometric definition of points that lie inside or outside the
require a large amount of storage memory and high-end computer hardware. A solid
model can be shaded and rendered in desired colors to give it a more realist appearance.

l: Representation of an object by a solid model is


new concept. There were only a couple of solids
AD programs available in late 1980s, and they
inframe computers to run on. However, in 1990s,
w cost and high speed, PCs have become the
r solid modeling software platform, prompting
e CAD vendors to introduce their 3-D solid
ftware that will run on a PC.

s represent objects in a very realistic and


s form; however, they require a large amount of
mory and high-end computer hardware. A solid
e shaded and rendered in desired colors to give it a more realist3.3:
Figure appearance.
Solid model

otes © by R. B. Agarwal Computer Aided Design in Mechanical Engineering 4-2


3.1.1 Role of Curves in Geometric Modeling

Curves are used to draw a wireframe model, which consists of points and curves; the
curves are utilized to generate surfaces by performing parametric transformations on
them. A curve can be as simple as a line or as complex as a B-spline. In general, curves
can be classified as follows:
22
• Analytical Curves: This type of curve can be represented by a simple mathe-
matical equation, such as, a circle or an ellipse. They have a fixed form and cannot
be modified to achieve a shape that violates the mathematical equations.

• Interpolated curves: An interpolated curve is drawn by interpolating the given


data points and has a fixed form, dictated by the given data points. These curves
have some limited flexibility in shape creation, dictated by the data points.

• Free-form curves: These curves provide the most flexibility in drawing curves
of very complex shapes. The model of a curved automobile fender can be easily
created with the help of approximated curves and surfaces.

3.1.2 Parametric and Non-parametric Equations of a Curve

The mathematical representation of a curve can be classified as either parametric or


non-parametric (natural). A non-parametric equation has the form,

y = c1 + c2 x + c3 x 2 + c4 x 3 Explicit non-parametric equation

This is an example of an explicit non-parametric curve form. In this equation, there is a


unique single value of the dependent variable for each value of the independent variable.
The implicit non-parametric form of an equation is,

(x − xc )2 + (y − yc )2 = r2 Implicit non-parametric equation

In this equation, no distinction is made between the dependent and the independent
variables. Implicit curves have some convenient features. For example, it is simple to
determine whether a point P (x1 , y1 ) inside or outside of the region formed by the curve.
Thus, for the curve f (x, y) = 0, a point (x1 , y1 ) is inside the curve if f (x1 , y1 ) < 0 and
outside of the curve if f (x1 , y1 ) > 0. The tangent and normal of the curve are also easy
to find. The tangent line at P (x2 , y2 ) on the curve is

fx (x2 , y2 )(x − x2 ) + fy (x2 , y2 )(y − y2 ) = 0 (3.1)


∂f ∂f
where fx = ∂x
and fy = ∂y
. The normal line is

fy (x2 , y2 )(x − x2 ) − fx (x2 , y2 )(y − y2 ) = 0 (3.2)

Example

Find the tangent and normal lines of the following curve at P (1, 2)

f (x, y) = y 2 − 4x = 0

Parametric Equations: Parametric equations describe the dependent and independent


variables in terms of a parameter. The equation can be converted to a non-parametric
form, by eliminating the dependent and independent variables from the equation. Para-
metric equations allow great versatility in constructing space curves that are multi-
valued and easily manipulated. Parametric curves can be defined in a constrained period

23
(0 < t < 1); since curves are usually bounded in computer graphics, this characteristic
is of considerable importance. Therefore, parametric form is the most common form of
curve representation in geometric modeling. Examples of parametric and non-parametric
equations follow.
Non-Parametric Parametric
Circle: x2 + y 2 = r 2 x = r cos θ, y = r sin θ

Where, θ is the parameter.


CAD programs prefer a parametric equation for generating a curve. Parametric equa-
tions are converted into matrix equations to facilitate a computer solution, and then
varying a parameter from 0 to 1 creates the points or curves. In this course, we will use
the following parameters, with the range indicated,

0≤t≤1 0≤s≤1 0 ≤ θ ≤ 2πs 0 ≤ ϕ ≤ 2πs

3.1.3 Fixed-Form or Analytical Curves

Equation of a Straight Line:


Chapter 4 - Curves
The simplest fixed-form curve is a straight line. Parametric equation of a straight line
is given as,
Fixed-Form or Analytical Curves P (t) = A + (B − A)t (3.3)
The parametric equation of line AB can be derived as,
1 Equation of a Straight Line: The simplest fixed-form curve is a straight line.
metric equation of a straight line is given as, x = x1 + (x2 − x1 )t
y = (y2 − y1 )t
P(t) = A + (B-A) t (4.1)
where, 0 ≤ t ≤ 1
parametric equation of line AB can be derived as,
B (x2, y2)
x1 + (x2 - x1) t

1+ (y2 - y1) t
. P (x, y)

e, 0 d t d 1
A (x1, y1)

point P on the line is sweeped from A to B,


e value of t is variedThe
frompoint
0 to 1.
P on the line is sweeped from A to B, as the value of t is varied from 0 to 1.

2 Conic SectionsConic Sections


or Conic or Conic Curves:
Curves
nic curve is generated when a plane intersects a cone, as shown.
A conic curve is generated when a plane intersects a cone, as shown in figure 3.4. The
intersection of the plane PQ and the cone is a circle, where as, the intersection created by
the plane AB is an ellipse. Other curves that can be created are parabola and hyperbola.
B
24
4.4.2 Conic Sections or Conic Curves
A conic curve is generated when a plane intersects a cone, as shown.

P Q

A A

Figure 3.4:

Conic curves are used to create simple wireframe models of objects, which have edges
that can be represented by these analytical curves. The fixed-form or analytical curves
do not have inflection points, i.e., curves have slopes that are either positive or negative
and do not change their sign (positive slope will remain positive and negative slope
will remain
ME 165 negative). All
Lecture Notes © by R. B.conic
Agarwalcurves can be represented
Computer by a quadratic
Aided Design in Mechanical Engineering equation, for 4-5
example, circular and elliptical curves have quadratic polynomial equations.

Circular Curve:

The non-parametric equation of a circle is,

(x − xc )2 + (y − yc )2 = r2 (3.4)

where, xc , and yc are coordinates of the center, and r is radius of the circle.
If we were to use this form of the equation for plotting a circle or a circular curve, we
will first calculate several values of x and y along the circumference of the circle, and
then plot them. The curve thus generated will be of a poor quality, unless we plot a
very large number of data points, which will result in a significant demand for storage of
these data points. Therefore, as stated earlier, in CAD programs, we use a parametric
equation, which avoids the need for storage of the data points, and provides a smooth
curve. The parametric equation of the above circle can be written as,

xi = xc + r cos θ
yi = yc + r sin θ

This equation is converted into a matrix form so that a computer can solve it. We will
now convert this equation into a matrix form.
Let us assume that the plot starts at the point (xi , yi ), and the center lies at the origin.
We increment θ to (θ + ∆θ), giving us the new point on the circle (xi+1 , yi+1 ), or

xi+1 = r cos(θ + ∆θ)


yi+1 = r sin(θ + ∆θ)

25
Chapter 4 - Curves

(xi+1, yi+1)

’T (xi, yi)
T

xpanding it by the use of


gonometric identities, we get:

+1 = r cosT cos'T - r sinT sin'T

+1 = r sinT cos'T + r cosT sin'T


Expanding it by the use of trigonometric identities, we get:
ubstituting the values: xi = r cosT, and yi = r sinT, we get
xi+1 = r cos θ cos ∆θ − r sin θ sin ∆θ
xi+1 = xi cos'T - yi sin'T yi+1 = r sin θcos∆θ + r cos θ sin ∆θ

yi+1 = yi cos'T + Substituting


xi sin'T the values: xi = r cos θ and yi = r sin θ, we get

xi+1 = xi cos ∆θ − yi sin ∆θ


matrix form, these equations can be written as, yi+1 = yi cos ∆θ + xi sin ∆θ

In matrix form, these equations can be written as,


cos'T sin'T 0 0 
+1 yi+1 0 1] = [xi yi 0 1] - sin'T cos'T 0 0 cos ∆θ sin(4.4)
∆θ 0 0
− sin ∆θ cos ∆θ 0 0
[xi+1 yi+1 00 0] = [ 0xi yi 10 0 0] 
 
 (3.5)
0 0 0 1  0 0 1 0 
0 0 0 1

Equation (3.5) is valid for a circle that has center at the origin. To find the equation of
a circle that has center located at an arbitrary point (xc , yc ), we can use the translation
quation (4.4) is validtransformation.
for a circle that has
Notecenter
thatat the
the origin.
equationTo (3.5)
find the
canequation of a circleas rotational transfor-
be interpreted
at has center locatedmation
at an arbitrary
of pointspoint
xi (xc, yy
and c), we can the
i about use origin.
the translation transformation.
Now, instead of rotation about the origin,
ote that the equationwe (4.4) can be interpreted as rotational transformation of points
wish to rotate the point about the fixed point (xc , yc ). i and yix
out the origin. Now, instead of rotation about the origin, we wish to rotate the  point about the 
xed point (xc, yc). This can be accomplished by the three-step approach, discussed 1 in chapter
0 0 2,0
., first translate the fixed point to the origin, rotate the object, and finally translate
 0 it so1that0the0 
xi+1 yUsing
i+1 0 this0 procedure
] = [ xi ywe 0 0get: ×
xed point is restored to its original [position. i will ]
 0 0 1 0 
−xc −yc 0 1
    (3.6)
cos ∆θ sin ∆θ 0 0 1 0 0 0
 − sin ∆θ cos ∆θ 0 0   0 1 0 0 
 × 
 0 0 1 0   0 0 1 0 
0 0 0 1 xc yc 0 1

Simplifying theComputer
165 Lecture Notes © by R. B. Agarwal
equation we get,
Aided Design in Mechanical Engineering 4-7
xi+1 = xc + (xi − xc ) cos ∆θ − (yi − yc ) sin ∆θ
(3.7)
yi+1 = yc + (xi − xc ) sin ∆θ + (yi − yc ) cos ∆θ

26
Even though, equations (3.7) can be used as an iterative formula to plot a circle or a
circular curve, using the EXCEL or MATLAB, or any other plot routines, the matrix
equation (3.6) is the preferred form for a CAD program. The original CAD programs
used iterative formulas to generate curves.
Chapter 4 - Curves
Ellipse

Following the procedure outlined in the previous section, we can derive the parametric
lipse
equations
g the procedure outlined in the of an ellipse.
previous Parametric
section, equation
we can derive of an ellipse
the parametric is given by the equation
equations
pse. Parametric equation of an ellipse is given by
xi = a cos θ
ion (3.8)
yi = b sin θ

T
2b

nt on the ellipse, in general, the equation is

cos'T – (a/b) yi sin'T 2a


cos'T – (b/a) xi sin'T (4.7)

re general case, when Forthea axes


pointofon
thethe ellipse,
ellipse in general,
are not parallel tothe
theequation
coordinateis axes, and
r of the ellipse is at a distance xc, yc from the origin, the equation of the ellipse is given
a
et D be the angle that the major axis makes with thexhorizontal
i+1 = xi cos ∆θ − (as )y
(x-axis), shown. The
i sin ∆θ
of the ellipse can be derived as b (3.9)
a
yi+1 = yi cos ∆θ − ( )xi sin ∆θ
b
x’i cosD – y’i sinD
For a more general case, when the axes of the ellipse are not parallel to the coordinate
x’i sinD + y’i cosD axes, and the center
(4.8) of the ellipse is at a distance xc yc from the origin, the equation
of the ellipse is given below. Let α be the angle that the major axis makes with the
horizontal (x-axis), as shown. The equation of the ellipse can be derived as
’ and y’ are the coordinate values of a
the ellipse, in term of the rotated axes xi = xc + x0i cos α − yi0 sin α
(3.10)
. yi = yc + x0i sin α + yi0 cos α

s (4.8) can be used to write either as an


formula or as a matrix equation
Where, for creating
x0 and y 0 are the coordinate values of a Point on the ellipse, in term of the rotated
cal curve. axes x0 and y 0 .
Equations (3.10) can be used to write either as an iterative formula or as a matrix
equation for creating an elliptical curve.

27

re Notes © by R. B. Agarwal Computer Aided Design in Mechanical Engineering 4-9


D be the angle that the major axis makes with the horizontal (x-axis), as shown. The
the ellipse can be derived as

cosD – y’i sinD

sinD + y’i cosD (4.8)

nd y’ are the coordinate values of a


ellipse, in term of the rotated axes

4.8) can be used to write either as an


mula or as a matrix equation for creating
curve.

3.1.4 Interpolated Curves

Interpolation method can be applied to draw curves that pass through a set of the given
data points. The resulting curve can be a straight line, quadratic, cubic, or higher order
curve. We are quite familiar, and have used, the linear interpolation of a straight line,
given by the formula

otes © by R. B. Agarwal f (x)


Computer Aided Design = f (xi )Engineering
in Mechanical + [f (xi+1 ) − f (xi )][(x −4-9
xi )/(xi+1 − xi )] (3.11)

Now, we will discuss the higher order curves, which are represented by higher order poly-
nomials. Lagrange polynomial is a popular polynomial function used for interpolation
of high order polynomials.

Lagrange Polynomial

When a sequence of planar points (x0 , y0 ), (x1 , y1 ), (x2 , y2 ), . . . (xn , yn ) is given, the
nth degree of interpolated polynomial can be calculated by the Lagrange Polynomial
equation, X
fn (x) = yi Li,n (x) (3.12)
where
[(x − x0 ) . . . (x − xi−1 )(x − xi+1 ) . . . (x − xn )]
Li,n (x) =
[(xi − x0 ) . . . (xi − xi−1 )(xi − xi+1 ) . . . (xi − xn )]
To understand the above expression better, note that
• The term (x − xi ) is skipped in the numerator, and

• The denominator starts with the term (xi − x0 ) and skips the term (xi − xi−1 ),
which will make the expression equal to infinity.

Example

Using the Lagrange polynomial, find the expression of the curve containing the points,
P0 (1, 1), P1 (2, 2), P2 (3, 1)
Solution

28
Here, n = 2 and x0 = 1, y0 = 1, x1 = 2, y1 = 2, etc. The polynomial
Chapter 4 is of a second
- Curves
degree. Expanding the Lagrange equation, we get,

f2 (x)==(1) [(x −
y0 [(x – 2) (x –−
x1 )(x 3)]x2/ )]/[(x
[(1 – 2) (1 – 3)] + (2) [(x-1) (x – 3)] / [(2 – 1) (2 – 3)] +
0 − x1 )(x0 − x2 )] + y1 [(x − x0 )(x − x2 )]/[(x1 − x0 )(x1 − x2 )]+
(1) [(x – 1) (x - 2)] / [(3 – 1) (3- 2)]
y2 [(x − x0 )(x − x1 )]/[(x2 − x0 )(x2 − x1)]
= ½ (x2 – 5x + 6) – 2 (x2 – 4 x + 3) + ½ (x2 – 3 x + 2) or
= (1)[(x − 2)(x − 3)]/[(1 − 2)(1 − 3)] + (2)[(x − 1)(x − 3)]/[(2 − 1)(2 − 3)] +
f2 (x) = - x2 + 4 x – 2
(1)[(x1)(x − 2)]/[(31)(3 − 2)]
1 1
= (x2 − 5x + 6) − 2(x2 − 4x + 3) + (x2 − 3x + 2) or
This is the explicit
2 non-parametric equation of a circle;
2 the given points lie on the circumference.
2
f2 (x) = −x + 4x − 2

4.5.2 Parametric Cubic Curve or Cubic Spline – Synthetic Curves


Parametric
The Cubic
analytical and Curvecurves,
interpolated or Cubic Spline
discussed in theSynthetic Curves
previous section (4.4) and (4.5) are
insufficient to meet the requirements of mechanical parts that have complex curved shapes, such
as,The
propeller blades,
analytical andaircraft fuselage,curves,
interpolated automobile body, etc.
discussed These
in the components
previous contain
section non-
are insufficient
analytical, synthetic curves. Design of curved boundaries and surfaces require
to meet the requirements of mechanical parts that have complex curved shapes, such curve
representations
as, propeller that can be
blades, manipulated
aircraft by changing
fuselage, automobile databody,
points,etc.
which will components
These create bends and
contain
sharp turns in the shape of the curve. The curves are called synthetic curves, and the data points
non-analytical, synthetic curves. Design of curved boundaries and surfaces require curve
are called vertices or control points. If the curve passes through all the data points, it is called an
representations that can be manipulated by changing data points, which will create bends
interpolant (interpolated). Smoothness of the curve is the most important requirement of a
and sharp
synthetic turns in the shape of the curve. The curves are called synthetic curves, and
curve.
the data points are called vertices or control points. If the curve passes through all the
data points,
Various it is
continuity called an interpolant
requirements (interpolated).
at the data points Smoothness
can be specified to impose of the curve
various degreesis of
the
most important
smoothness requirement
of the curve. A complexof acurve
synthetic curve.of several curve segments joined
may consist
together.
VariousSmoothness
continuityofrequirements
the resulting curve
at theis data
assured by imposing
points can be one of the continuity
specified to impose various
requirements. A zero order continuity (C0) assures a continuous curve, first order continuity (C1)
degrees of smoothness of the curve. A complex curve2 may consist of several curve seg-
assures a continuous slope, and a second order continuity (C ) assures a continuous curvature, as
ments joined together. Smoothness of the resulting curve is assured by imposing one of
shown below.
the continuity requirements. A zero order continuity (C 0 ) assures a continuous curve,
first order continuity (C 1 ) assures a continuous slope, and a second order continuity (C 2 )
assures a continuous curvature, as shown in figure 3.5.

C0 Continuity – The curve is C1 Continuity- Slope Continuity C2 Continuity - Curvature


Continuous everywhere at the common point continuity at the common point

Figure 3.5: Order of curvature continuity

A cubic polynomial is the lowest degree polynomial that can guarantee a C2 curve. Higher2 order
A cubic polynomial
polynomials are not used isin theCAD, lowest degree
because polynomial
they tend to oscillatethat cantheguarantee
about a Candcurve.
control points
Higher order polynomials are not used in CAD, because they
require large data storage. Major CAD/CAM systems provide three types of synthetic curves:tend to oscillate about the
controlCubic
Hermite points and require
Spline, large data
Bezier Curves, storage. Curves.
and B-Spline Major CAD/CAM systems provide three
types of synthetic curves: Hermite Cubic Spline, Bezier Curves, and B-Spline Curves.
ME 165 Lecture Notes © by R. B. Agarwal Computer Aided Design in Mechanical Engineering 4-11
Cubic Spline curves pass through all the data points and therefore they can be called as

29
Chapter 4 - Curves

interpolated
Cubic curves.pass
Spline curves Bezier andallB-Spline
through the data curves do not
points and pass they
therefore through allcalled
can be the data
as points,
instead, they pass through the vicinity of these data points. Both the cubic
interpolated curves. Bezier and B-Spline curves do not pass through all the data points, spline and
instead,
Bezier
they passcurve have
through thefirst-order
vicinity of continuity, whereBoth
these data points. as, the
B-Spline curvesand
cubic spline have a second-order
Bezier curve have
continuity.
first-order continuity, where as, B-Spline curves have a second-order continuity.

Hermite
4.5.3 Cubic
Hermite Spline
Cubic Spline
Hermite cubic curve is also known as parametric cubic curve, and cubic spline. This
Hermite
curve cubic
is used curve is also
to interpolate givenknown as parametric
data points cubic
that result in curve,curve,
a synthetic and cubic
but notspline.
a free This
form,
curveunlike
is usedthetoBezier and B-spline
interpolate given curves. The most
data points thatcommonly
result in aused cubic spline
synthetic curve,is but
a not a
three-dimensional
free form, unlike planar curve and
the Bezier (not B-spline
twisted). The curveThe
curves. is defined by two dataused
most commonly points that spline
cubic
lie
is at
a the beginning and at planar
three-dimensional the end curve
of the curve, along with The
(not twisted). the slopes
curveatisthese points.
defined byIttwo
is data
represented
points thatbyliea cubic
at thepolynomial.
beginningWhen and attwothe
endend
points and their
of the slopes
curve, alongdefine
witha the
curve,
slopes at
the curve is called a Hermite cubic curve. Several cubic splines can
these points. It is represented by a cubic polynomial. When two end points and be joined together by their
imposing the slope continuity at the common points. In design applications, cubic splines
slopes define a curve, the curve is called a Hermite cubic curve. Several cubic splines can
are not as popular as the Bezier and B-spline curves. There are two reasons for this:
be joined together by imposing the slope continuity at the common points. In design
applications, cubic splines are not as popular as the Bezier and B-spline curves. There
x The curve cannot be modified locally, i.e., when a data point is moved, the
are two reasons for curve
entire this: is affected, resulting in a global control, as shown in the
• The curve cannot be modified locally, i.e., when a data point is moved, the entire
figure.
curvex The order of
is affected, resulting
the curveinisaalways
globalconstant
control,(cubic),
as shown in the figure.
regardless of the number
of data points. Increase in the number of data points increases shape
• The order of the curve
flexibility, is always
However, constant
this requires (cubic),
more regardless
data points, of the
creating more number
splines,of data
points. that
Increase in the
are joined number
together of data
(only points
two data increases
points shape
and slopes are flexibility,
utilized for However,
this requires more data points, creating more splines, that are joined together (only
each spline).
two data points and slopes are utilized for each spline).

Effect of Moving the Data Point Effect of Change in slope

Equation of a Cubic Spline


4.5.4 Equation
A cubic spline is of a Cubic Spline
a third-degree polynomial, defined as
A cubic spline is a third-degree polynomial, defined
X as
P (t) = ai t i (3.13)
P(t) = 6 ai ti (4.11)
where, 0 ≤ t ≤ 1, and P (t) is a point on the curve.
Expanding
where, 0 d the
t d 1,above equation,
and P(t) is a pointweonget
the curve.
Expanding the above equation, we get
p(t) = a3 t3 + a2 t2 + a1 t + a0 (3.14)

If 165
ME (x,Lecture
y, z) Notes
are ©the
by R.coordinates
B. Agarwal of point
ComputerPAided
, the equation
Design (3.14)
in Mechanical can be written as, 4-12
Engineering

x(t) = a3x t3 + a2x t2 + a1x t + a0x


y(t) = a3y t3 + a2y t2 + a1y t + a0y (3.15)
z(t) = a3z t3 + a2z t2 + a1z t + a0z

30
There are 12 unknown coefficients, aij , known as the algebraic coefficients. These coef-
ficients can be evaluated by applying the boundary conditions at the end points. From
the coordinates of the end points of each segment, six of the twelve needed equations
are obtained. The other six equations are found by using the tangent vectors at the two
ends of each segment. Substituting the boundary conditions at t = 0, and t = 1, we get,

p(0) = a0 and (a)


p(1) = a3 + a2 + a1 + a0 (b)

To find the tangent vectors, we differentiate equation (3.14), and get,

P 0 (t) = 3a3 t2 + 2a2 t + a1 (3.16)

Applying the boundary conditions at t = 0 and t = 1, we get,

p0 (0) = a1 and (c)


p(0 1) = 3a3 + 2a2 + a1 (d)

Solving for the coefficients in terms of the P (t) and P 0 (t) values in equations (a) through
(d), we get,

a0 = P (0)
a1 = P 0 (0) (3.17)
a2 = −3P (0) + 3P (1) − 2P 0 (0) − P 0 (1)
a3 = 2P (0) − 2P (1) + P 0 (0) + P 0 (1)

The equation
P (t) = a3 t3 + a2 t2 + a1 t + a0 (3.18)
can be written, with coefficients aij replaced by the P (t) and P 0 (t) values in equations
(3.17), resulting,

P (t) = [2P (0)−2P (1)+P 0 (0)+P 0 (1)]t3 +[−3P (0)+3P (1)−2P 0 (0)−P 0 (1)]t2 +P 0 (0)t+P (0)

Or, rearranging the terms, we get,

P (t) = [(2t3 − 3t2 + 1)]P (0) + [(−2t3 + 3t2 )]P (1) + [(t3 − 2t2 + t)]p0 (0) + [(t3 − t2 )]P 0 (1)

In matrix form the equation can be written as,


  
2 −2 1 1 P (0)
 −3 3 −2 −1   P0(1)
  
P (t) = [ t3 t2 t 1 ] 
 0
 (3.19)
0 1 0   P (0) 
1 0 0 0 p0 (1)

The equation in short form can be written as: P (t) = [t][M ]H [G]
Where, the terms [t], [M ]H , and [G] correspond to the terms on the right hand side of
the equation (3.19). [M ]H is called Hermite matrix of a cubic spline, and represents the
constant matrix. The term [G] is called geometric coefficient matrix. Let us consider an
example to understand how the equation (3.19) works.

31
Example

A parametric cubic curve passes through the points (0, 0), (2, 4), (4, 3), (5, −2) which
are parametrized at t = 0, 41 , 43 , and 1, respectively. Determine the geometric coefficient
matrix and the slope of the curve Chapter
when4 -t Curves
= 0.5.

¾ Solution
1 The points on the curve are
(0, 0) at t = 0
(2, 4) at t = 41
ation (4.15), we get,(4, 3) at t = 34
(5, −2) at t = 1

Substituting in equation (3.19), we get,


0 0 00 10 2 -2 01 1 0 P(0)0
     
1 2 −2 1 1 P (0)
0.0156 0.0625 0.25 1
2 4   -3 3 -2 -10.0625 P(1)  −3 3 −2 −1   P (1)
 00.0156 0.25 1 
 
0.4218 0.5625 0.75 1 =0 1 00.5625 P’(0)    (3.20)
 4 3   0.4218 0.75 1  0 0 1 0   P 0 (0) 
1 1 1 1 1 0 0 0 P’(1)
5 −2 1 1 1 1 1 0 0 0 p0 (1)

Solving we get    
P (0) 0 0
 P (1)   5 −2 
 P (0)  =  10.33 22 (3.21)
 0   

p0 (1) 4.99 −26
The slope at t = 0.5 is found by taking the first derivative of the equation (3.19), as
0 follows,
-2   
22 2 −2 1 1 0 0
-26  −3 3 −2 −1   5 −2 
P 0 (t) = [ 3t3 2t 1 0 ]   0
  (3.22)
0 1 0   10.33 22 
1 0 0 0 4.99 −26
is found by taking the first derivative of the equation (4.15), as follows,

Therefore,
2 -2 1 1 0 0 P 0 (0.5) = [ 3.67 −2.0 ], or
-3 3 -2 -1 5 -2
2t 1 0] 0 Slope
0 1= ∆x/∆y
0 −2.0/3.67
=10.33 22 = −0.545 Note: coinciding the end points, and imposing
1 equal
0 values
0 0 of the4.99
slopes,
-26as shown, can create closed shape of a cubic spline.

2.0], or

.0/3.67 = - 0.545

e end points, and imposing equal values of the slopes, as shown, can create
ubic spline.

32
R. B. Agarwal Computer Aided Design in Mechanical Engineering 4-15
3.1.5 Approximated Synthetic Curves

In the previous sections, we have studied the analytical and interpolated curves, now
we will focus on the approximated curves. Bezier and B-spline curves represent the
approximated curves, these curves are synthetic, and can be joined together to form a
very smooth curve. For data fitting, interpolated curves work best, where as, for free
form geometry, interpolation cannot be used, and approximation becomes necessary. In
many engineering applications, smoothness of a curve is preferred over the quality of
interpolation. These curves are flexible, local changes in the shape do not affect the
entire shape of the curve. Let us study the Bezier curve first, followed by the B-spline.

Bezier Curves

Equation of the Bezier curve provides an approximate polynomial that passes near the
given control points and through the first and last points. In 1960s, the French engineer
P. Bezier, while working for the Renault automobile manufacturer, developed a system of
curves that combine the features of both interpolating and approximating polynomials.
In this curve, the control points influence the path of the curve and the first two and
last two control points define lines which are tangent to the beginning and the end of
the curve. Several curves can be combined and blended together. In engineering, only
the quadratic, cubic and quartic curves are frequently used.

• Beziers Polynomial Equation


The curve is defined by the equation
X
P (t) = Vi Bi,n (t) where 0 ≤ t ≤ 1 and i = 0, 1, 2, . . . , n (3.23)

Here, Vi represents the n + 1 control points, and Bi,n (t) is the blending function
for the Bezier representation and is given as
 n 
Bi,n (t) = (ti )(1 − t)n−i (3.24)
i

Where n is the degree of the polynomial and


 n  n!
= i = 0, 1, 2, . . . , n
i i!(n − i)!

These blending functions satisfy the following equations


X
Bi,n (t) > 0 for all i and Bi,n (t) = 1 (3.25)

The equations (3.25) force the curve to lie entirely within the convex figure (or
envelop) set by the extreme points of the polygon formed by the control points.
The envelope represents the figure created by stretching a rubber band around all
the control points.
The figure 3.1.5 shows that the first two points and the last two points form lines
that are tangent to the curve. Also, as we move point v1 , the curve changes shape,

33
v1
v2 v1’

v0 v3

Relationship between end-points and curve slope

such that the tangent lines always remain tangent to the curve. Beziers blending
Bezier’s blending
function function an
produces nth degree
produces an nth polynomial
degree polynomial
for n for
+ 1n+1 control
control pointsand
points and forces
the Bezier curve to interpolate the first and last control points. The intermediate control
the Bezier curve to interpolate the first and last control points. The intermediate points
pull thecontrol
curve toward
points them, andcurve
pull the can betoward
used tothem,
adjust and
the curve
can beto the
useddesired shape.
to adjust the curve to
the desired shape.

• Third Order Bezier Polynomial


We will simplify the Beziers equation for n = 3 (a cubic curve). The procedure
ME 165 Lecture Notes © byhere
developed R. B. Agarwal Computer
can be extended to Aided
theDesign
otherin Mechanical
values of Engineering
n. 4-17

For n = 3, we will have four control points, namely, V0 , V1 , V2 , V3 . i will vary


from 0 to 3. The Beziers equation,
X
P (t) = Vi Bi,3 (t) can be expanded to give, (3.26)

P (t) = V0 B0,3 + V1 B1,3 + V2 B2,3 + V3 B3,3 and

3! 0
B0,3 = t (1 − t)3 = (1 − t)3
0!3!

3! 1
B1,3 = t (1 − t)2 = 3t(1 − t)2
1!3!

3! 2
B2,3 = t (1 − t)1 = 3t2 (1 − t)
2!3!

3! 3
B3,3 = t (1 − t)0 = t3
3!3!
34
By substituting the above values in the equation (3.26) we get

P (t) = (1 − t)3 V0 + 3t(1 − t)2 V1 + 3t2 (1 − t)V2 + t3 V3

In matrix form this equation is written as


Chapter 4 - Curves
  
−1 3 −3 1 V0
 3 −6 3 0   V1 
4.6.4 Blending Two [ t3 tBezier
P (t)or=More 2
t 1 ]Curves

 −3 3
  (3.27)
0 0   V2 
Two or more Bezier curves can be blended to provide a desired curve of a complex nature. When
1 0 0 0 V3
joining curves, slope continuity is maintained by having three collinear points, the middle one
being common to the adjoining curves, as shown.
• Blending Two or More Bezier Curves
Two or more Bezier curves can be blended to provide a desired curve of a com-
plex nature. When joining curves, slope continuity is maintained by having three
collinear points, the middle one being common to the adjoining curves, as shown
in figure 3.6.

Figure 3.6: Point V3 is the middle point of the common points V2,, V3,, and V4 of
curves A and B.
Point V3 is the middle point of the common points V2,, V3,, and V4 of curves A and B.
NOTE: Using the Bezier curves, we can create closed curves by making the first
and last points of the control points coincide.
NOTE: Using the Bezier curves, we can create closed curves by making the first and last points
of the control points coincide.
Example
A cubic Bezier curve is described by the four control points: (0, 0), (2, 1), (5, 2),
(6, 1). Find the tangent to the curve at t = 0.5.
Example: A cubic Bezier curve is described by the four control points: (0,0), (2,1), (5,2), (6,1).
FindSolution
the tangent to the curve at t = 0.5.
We will use the Bezier cubic polynomial, given in equation (3.27), which is,
Solution: We will use the Bezier cubic polynomial,

−1 given
3 in−3
equation
1
 (4.20),
V0 which is,

 3 −6 3 0   V1 
P 0 (t) = [ t3 t2 t 1 ] 
 −3 3
 
0 0   V2 
-1 3 -3 11 0V 0 0 V3
0
P(t) = [t3 t2 t 1] 3 -6 3 0 V1
Where, -3 3 0 0 V2
1
V = (0, 0) V
0 00 0 3
V1 = (2, 1)
V2 = (5, 2)
V3 = (6, 1)

35
ME 165 Lecture Notes © by R. B. Agarwal Computer Aided Design in Mechanical Engineering 4-19
The tangent is given by the derivative of the general equation above,
  
−1 3 −3 1 V0
 3 −6 3 0   V1 
P 0 (t) = [ 3t2 2t 1 0 ] 
 −3 3
  (3.28)
0 0  V2 
1 0 0 0 V3

At t = 0.5, we get,
  
−1 3 −3 1 V0
 3 −6 3 0   V1
P 0 (t) = [ 3(0.5)2

2(0.5) 1 0 ] 
 −3 3
  = [ 6.75 1.5 0 1 ]
0 0   V2 
1 0 0 0 V3

B-Spline Curve

B-spline curves use a blending function, which generates a smooth, single parametric
polynomial curve through any number of points. To generate a Bezier curve of the same
quality of smoothness, we will have to use several pieces of Bezier curves. Unlike the
Bezier curve, the degree of the polynomial can be selected independently of the number
of control points. The degree of the blending function controls the degree of the resulting
B-spline curve. The curve has good local control, i.e., if one vertex is moved, only some
curve segments are affected, and the rest of the curve remains unchanged.

The mathematical derivation of the B-spline curve is complex and beyond the scope
of this course. The equation is of the form:
X
P (t) = Ni,k (t)Vi (3.29)

Where, P (t) is a point on the curve. i indicates the position of control point i, k is order
of curve Ni,k (t) are blending functions Vi are control points

The matrix form of the uniform cubic B-spline curve is:


  
−1 3 −3 1 Vi−1
 3 −6 3 0   Vi 
Pt (t) = 1/6[ t3 t2 t 1 ] 
 −3 0
 
3 0   Vi+1 
1 4 1 0 Vi+2

3.2 Surfaces

Like curves, surfaces can be classified into analytical and free-form surfaces. Analyti-
cal surfaces include two groups. The first group is defined by nonparametric equations;
examples are the plane, cylinder, sphere, cone, and torus. The second group is defined
by parametric equations; examples are a surface of revolution, ruled surface, and tabu-
lated cylinder. Free-form surfaces are defined by control points, as are free-form curves.
Displaying a surface, however, is not a straight forward as displaying a curve. Drawing

36
a curve basically involves connecting n equally spaced (either in Cartesian space or in
parameter space) points on the curve. The value of n determines how precise the curve
is interpolated. If the same strategy is used in drawing surface n × m points are needed.
When both n and m are large, the surface will be fully covered by curves and thus not
discernible in shape. If n and m are small, then each curve will be course.

3.2.1 Analytical surfaces

In this section equations for analytical surfaces are presented.

(a) Nonparametric surfaces: The simplest surface is a planar surface (see Fig. 3.7),
the equation has the general form

ax + by + cz = 1 (3.30)
Section 5.4 Curves and Curved Surfaces 163

ol
ur

2. Figure 5.27 A planar surface.


FigureSection
3.7: A5.4plane surface
Curves and Curved Surfaces 163
A
ol A cylindrical surface with axis on the z-axis is basically a circle in the x-y plane
of
ur
al (see Fig. 3.8)
e, (x − a)2 + (y − b)2 = r2 (3.31)
a8
t# Alternatively, in parametric form with height h, we have
sl    
nd x r cos θ
al  y  =  r sin θ  0 ≤ θ < 2π, 0 ≤ z ≤ h (3.32)
2. Figure 5.27 A planar surface.
z z
A Figure 5.28 A right cylinder.
e&
of
id
al
e, A cylindrical surface with axis on the Z-axis is basically a circle in the X-Y plane
a8 (see Figure 5.28):
t#
sl (X - a)' + (y - b)' = r2
nd Alternatively, in parametric form with height h, we have
al

Figure 5.28 A right cylinder.


e& Figure 3.8: A right cylinder
id For a cylindrical surface in an arbitrary orientation, an axis vector is defined an1
the surface Equation
A cylindrical 5.49 iswith
surface rotated.
axis on the Z-axis is basically a circle in the X-Y plane
A sphere
(see Figure is a 3-D object defined by its center (xo, yo, zO)and radius r:
5.28): U

(y +
(X -+a)'
V'(x - XO)' (y -+b)'37
- YO)' (z =-r2
20)' = r2 (5.51) '
The parametricinform
Alternatively, is
parametric form with height h, we have
r cos 8
h
h-z
r sin 8
h

For a cylindrical surface in an arbitrary orientation, an axis vector is defined and


the surfaceAs Eqn.
with a 3.31
cylinder, to have a different orientation, the cone can be transforla!
is rotated.
by rotating its axis.
A sphere is a 3-D object defined by its center (xo , yo , zo ) and radius r
Finally, a torus is defined by its center (xo,yo, zo), the radius r of the mcrltl~
and the distance
 cfromthe center of meridian to center of t h e t n n i q l ~ p Fpi o l l r r h 4 3
x r cos θ sin φ
 y  =  r sin θ sin φ  0 ≤ θ < 2π, 0 ≤ φ ≤ π (3.33)
z r cos φ 1
The parametric form of the torus is
A torus is defined by its center (xo , yo , zo ), the radius r of the meridian, and the
(c + r cos t) cos s

p
(c + r cos t) sin s
c − (x − xo ) + (y − yo ) + (z − zo )2 = r2
2 2
1
distance c from the center of meridian to center of the torus (see Fig. 3.9)
0 s t , s < 27r
(3.34)

b. Parametric
The parametric formsugaces
of the torus is cylinder. A tabulated cylinder is a surfacc cre
Tabulated
ated with the useof a curve
  r(t) and a vector V. (See
Figure 5.30.) The equation is
x (c + r cos t) cos s
 y  =  (c + r cos t) sin s  0 ≤ t, s < 2π (3.35)
z r sin t

5.3

Figure 5.29 A torus centered at (1,1,1).The radius of Eq


thecentered
Figure 3.9: A torus meridian = at2(1,1,1).
and the distance from the
The radius center
of the of the
meridian=2 and the distance
meridian to the center of the torus = 5.
from the center of meridian to the center of the torus=5.

(b) Parametric surfaces


Tabulated cylinder: A tabulated cylinder is a surface created with the use of a
curve r(t) and a vector V (See Fig. 3.10). The equation is
r(t, s) = r(t) + sV 0 ≤ t, s ≤ 1 (3.36)

The curve r(t) can be any parametric curve, even a line segment. A line segment
ca be written as r(t) = tP1 + (1 − t)Po . For example, to create a planar surface,
one may sweep a line:
r(t, s) = [tP1 + (1 − t)Po ] + sV 0 ≤ t, s ≤ 1

Ruled surface: A ruled surface is the result of blending two curves ro (t) and
r1 (t). (See Fig. 3.11). This kind of surface is defined as
r(t, s) = ro + s[r1 (t) − ro (t)] 0 ≤ t, s ≤ 1 (3.37)

38
Figure 3.10: A tabulated cylinder

Eqn. 3.37 can also be written as

r(t, s) = (1 − s)ro (t) + r1 (t) 0 ≤ t, s ≤ 1 (3.38)

M
f

r1

Figure 5.31 A ruled surface.


Figure 3.11: A ruled surface I 1

The two curves :es


wo curves can be any parametric curves. In engineering
can
pa
be any parametric curves. In engineering products, rules sur-
commonly create a surface between two curves. For exun
faces commonly airplane
create acan
surface between
be defined two curves.
by blending For example,
cross-sectional airfd the wing of an
airplane can be defined by blending
ro(t)degenerates into across-sectional
vector, the ruledairfoil
surfacecurves.
becomesNote
a t that if r0 (t)
One can simply replace (1 s ) by s, since s has a range betw06
degenerates into a vector, the ruled surface becomes a tabulated cylinder. One can
-

simply replace (1 − s) by s, since s has a range between zero and unity.

Surface of revolution: A surface of revolution is defined by a curve r(t) with


d surface formed from the following two curves:
rotational sweep around an axis. If a line is used instead of a curve, the result will Blilr c1
r 3 t 3 The
be a cylinder or conical surface. + 1 for the surface shown in Fig. 3.12 is
+ zt2equation
(@I~F
  I)ill~l
x(t) cos θ 1
r(t, θ) =  x(t) sin θ  (3.39) &!!rrvrt
z(t) $:34,1e
~ ( s ~
in the figure ha II i
rface is given by
3t3 + 2t2 
+ 4t 2t + 1
x(t)
r(t, θ) + 4t 0  t + 5
t2 = -~ (3.40)
z(t)
he two terms, we obtain the following equation:

39
$:34,1e ~Icl'ilicdby 4 X 4 = 16 control points. Each point on the surface is the result of
~ ( s ~ ~ ill
~ lill1l of
~ ~the
W control points.Thus, the surface equation has 16 terms. Each term
ha II i~wlhcspondingcontrol point Pi;and combination of blending functions Bi(t)B;(s).

z
I" '.
I!,
I
. ,, .

3 ',

A Figure 5.32 Surface of revolution.


Figure 3.12: Surface revolution

3.2.2 Free-form surfaces:

Free-form surfaces are based on free-form curves. The Bezier, and B-spline surfaces are
formed from Bezier, and B-spline curves, respectively. To blend points together to form
a surface, two parameters t and s are needed:
XX
r(t, s) = Bi (t)Bj (s)Pij 0 ≤ t, s ≤ 1 (3.41)
i j

where, Pij represent control points, Bi (t) and Bj (t) are blending functions. A bicubic
Bezier surface, as shown in Fig. 3.13, is defined by 4 × 4 = 16 control points. Each
point on the surface is the result of blending in all of the control points. Thus, the
surface equation has 16 terms. Each term has a corresponding control point Pij and
a combination of blending functions Bi (t)Bj (s). The i and j values run from 0 to 3.
The four corners of the surface are located at P0,0 , P0,3 , P3,0 and P3,3 . Continuity and
smoothness conditions must be satisfied. The tangent plane (instead of line) at any given
point r(t, s) is defined by two principal tangent vectors, on in the t direction and one
in the s direction. The following Equations are used to find the principal tangents:

∂r(t, s) X X dBi (t)


= Bj (s)Pij (3.42)
∂t i j
dt

∂r(t, s) X X dBj (s)


= Bi (t) Pij (3.43)
∂s i j
ds

The tangent plane is formed by these two vectors. The surface normal is

∂r(t, s) ∂r(t, s)
N(t, s) = × (3.44)
∂t ∂s

Note that the normal vector could point either up or down. To change the vector from
pointing in one direction to another, just multiply it by -1. Figure 3.14 shows the
principal tangent and surface normal of a bicubic Bezier surface.

40
Figure 5.33 A surface
ar(t,patch
S)
on a larger surface.
dBi(t)
at = i j
CC, Bj(s)Pii (5.60)

ar(t, S ) dB,(s)
= Ci C j
. ~ i ( t )Pij~ - (5.61)

e I , I I I ~ , C I I ( plane is formed by these two vectors. The surface normal is


ar(t, S ) dr(t, s )
N(t, s ) = -X - (5.62)
3
at as
l u I I ~ c normal vector could point either up or down. To change the vector from
) c J ~ ~ 111111
FIIIIII~IIR
ill one direction to another, just multiply it by -1. Figure 5.35 shows the prin-
gI(s111 a11pc111s
and surface normal of a bicubic Bezier surface.

PI'II
Np~
I ~ model, its internal representation is usually used. The internal rep-
(11 V I I I S N ~ I ' ~ a~ Isolid , ('ell
fgse~~lr~lioll is how a computer stores the model. It is different from the external repre- , Con
S ~ I I I H I I ~ Iwhich
I, is how the picture or image is displayed. There are six different types , Bo~
I I h~r ~ l l t lilllcrnal representation schemes (see Figure 5.36):

I I'~*irnilive
, instancing
! S l ~ ~ l ioccupancy
i~l enumeration (SOE)
i, ( 'c l l clccomposition
4, ( 'ollslructive solid geometry (CSG)
'1. Iloundary representation (B-rep)

Figure 5.34 Characteristic polygon and surface of a bicubic Bezier surl'acr,


Figure 3.13: Characteristic polygon and surface of a bicubic Bezier surface

The i and j values run from 0 to 3. The four corners of the surface are locnlr*
po,o,
tang
zier surf

are 1
e sati
y two p Figure 5.35 Principal tangents and surface normal.
Figure 3.14: Principal tangents and surface normal

3.3 Solid models

3.4 Finite Element as CAD tool

41
Chapter 4

Computer numerical controlled


(CNC) Machine Tools

Introduction to numerical control of machines

Numerical control is the operation of machines by coded instruction in form of alphanu-


merical data. Numerical control (NC) machines usually refer to systems using manual
programming and punched paper or magnetic tape to store the program. If the machine
has a built-in computer supporting its function, the system is referred to as Computer
numerical controlled (CNC) machine.
An NC machine tool system contains the machine control unit (MCU) and the machine
tool itself. The MCU is further divided into control-loops unit (CLU) and data-processing
unit (DPU). The DPU processes the coded data that are read from the tape or some
other medium. Them, it tells the CPU specific information: the position of each axis,
its direction of motion feed, and its auxiliary function control signals. CLU operates the
drive mechanisms of the machine, receives feedback signals about the actual position and
velocity of each of the axes, and announces when an operation has been completed. DPU
reads the data sequentially when each line has completed execution. A DPU consists of
the following parts;
• Data-input devices such as a RS-232-C port

• Data-reading circuits and parity-checking logic

• Decoding circuits for describing data among the contoller axes

• An editor and graphical user interface

A CLU, on the other hand, consists of the following,


• An interpolator that supplies machine-motion commands between data points for
tool motion

• Position-control loop hardware for all the axes of motion where each axis has a
separate control loop

• Velocity-control loops, where feed control is required

42
• Acceleration, deceleration, and backlash take-up circuits

• Auxiliary function control, such as a coolant on-off, gear changes and spindle on-off
control

The most important function of any CNC machine tool is to control motion precisely
and consistently. CNC systems use a dedicated program to perform NC functions in
accordance with the control commands stored in a computer memory. If the host com-
puter is external to the machine tool and commands several machines as well as other
NC devices, the system is referred to as Direct Numerical Control (DNC) system. If
the microprocessor that interacts with the host computer is used as a resident controller
in the machine tool, the system is referred to as Distributed Numerical Control system.
The distributed numerical control system may also comprise a management information
retrieval package, where information is returned to the central computer and a variety
of reports are presented for management.

Bulk Memory

Master computer

Machine Machine Machine Machine


controller 1 controller 2 controller 3 controller n

Machine 1 Machine 2 Machine 3 Machine n

Figure 4.1: General configuration of DNC system

4.1 Applications of numerical control

Numerical control has been applied in many machine operations, both in machine tools
as well as in non machine tools.

43
4.1.1 Machine tool applications

Numerical Control has been implemented for the control, of most of machine tools,
mainly for operations such as turning, milling, drilling and grinding. The machines in
which NC has been successfully incorporated include the common conventional and non
conventional machines, some of which are the following:

1. NC lathe - either horizontal or vertical axis. It is used in straight turning or contour


turning. It requires two-axis continuous path control.

2. NC boring mill - horizontal or vertical spindle. It has similar requirements as for


an NC lathe.

3. NC drill press - This uses point to point control of the workhead. Some drill presses
have turrets containing several drill bits to enable them drill holes of different sizes
by automatically changing the tools.

4. NC milling machine - This requires a continuous path control to perform straight


cut or contouring operations.

5. NC cylindrical grinder - This is similar to a turning center, except that the tool in
this case is a grinding wheel. It has a 2-axis continuous path control similar to an
NC lathe.

6. NC-Sinker EDM -Ram type or orbital type

7. NC Wire EDM - The electrode in form of a wire is passed through a small hole
drilled into the workpiece. The movement of the work table through the computer
numerical control in x and y directions enables cutting the components to the
required shapes.

8. NC Laser beam machining (LBM)- A high power laser beam is directed to the
workpiece either by use of fibre optics or by use of mirrors. The beam is focused
onto the workpiece, and causes the material to vaporize, hence the cutting action.
A CNC system is used to move the workpiece or the beam or both, in order to
achieve the desired shape.

9. NC Plasma arc machining (PAM), etc.

It has also been applied in material processing machines such as punch presses, nibbling
machines, presses, welding and tube bending.

4.1.2 Non-Machine tool applications

The non-machine tool applications of NC include:

• Electrical wire wrap machines

• Components insertion machines

44
• Drafting machines, such as x-y plotters

• Coordinate measuring machines (CMMs)

• Rapid prototyping machines, etc.

4.2 Advantages of CNC machine tools

Just as for any form of automation there are several advantages of CNC machine tools.
These include:

1. Reduction of non-productive time

2. Fewer and simpler jigs and fixtures required, thanks to the highly accurate posi-
tioning systems.

3. Complex components may be machined with ease, allowing for more functional
features, hence fewer components. Surfaces to be generated can also be defined
mathematically.

4. Throughput time is reduced and therefore shorter manufacturing lead time.

5. Greater accuracy and repeatability

6. Highly reliable with consistent quality

7. Reduced inspection requirements and hence, costs

8. Engineering changes can be accommodated easily by simply changing the pro-


gramme.

9. Less floor space required - owing to increased output rates, fewer NC machines
are required to perform the same amount of work, compared to the number of
conventional machines required.

10. Reduction of operator’s skill level requirements - after programming, the work
required is only that of machine tending, the main tasks being loading/unloading
the work and changing tools, which do not call for highly specialized skills.

11. Reduced parts inventory - smaller lot sizes are still economical, and hence the
average inventory is reduced.

12. Lower scrap rates, mainly due to the reduction of human errors.

45
Disadvantages
1. Very high initial investment cost due to the high costs of software development,
CNC controls and electronic hardware, the more reliable mechanical components
and additional features such as tool changers, which are not found in conventional
machines.

2. Maintenance cost is generally high due to the sophistication of the control systems

3. In addition to process planning, there is an added task of part programming.

4. May require well-trained programmers/operators.

5. CNC systems have to be highly utilized in order to realize economic benefits. They
are not economical for low production levels.

46
Parameters used in specification and rating of CNC
machine tools
Accuracy: This is the ability to position the machine table / spindle at a desired
location. It is usually a combination of control resolution and hardware accuracy.
The control resolution is the minimum length distinguishable by the control unit,
and is normally governed by the type of actuator used. Hardware accuracy is as
a result of tolerances on the machine elements such as screws and bearings. Note:
There are other sources of errors such as force-induced tool deflections, thermal
errors due to cutting process. The manufacturer-rated machine accuracy does not
include machining process-related errors. The actual accuracy varies from the rated
accuracy.

Repeatability: This is the ability of the control system to return to a given location
that was previously programmed into the controller, under identical conditions.
It is a statistical term indicating how closely a machine repeats a given position
command. If a the slide of a machine always moves to a fixed position, then it is
said to be highly repeatable, even if the position is far from the command position.
Repeatability is measured by the standard deviation of the errors. Accuracy is
measured as the diameter of the circle enclosing a target area produced by many
repeated experiments. The actual accuracy of a CNC Machine can be estimated
as:
A = X̄ ± R (4.1)
where, A= Accuracy of the CNC Machine
R = Repeatability and
X̄= Average error from the programmed point.

Spindle power and axes power: These are very important as they dictate the type
of material that can be machined/handled and the maximum rate of machin-
ing/processing.

Number of axes: This is analogous to the degrees of freedom. The number of axes of
a machine determines the complexity of the part geometry that can be machined.
The most common machines are 3- and 5-axes machines.

Axes limits: These determine the maximum work size that can be machined.

Maximum speeds: - spindle speed, rapid traverse, etc.

Type of controls: This determines the complexity of programming.

4.3 Hardware for numerical control

In addition to the machine frame and other features found in conventional machines, a
typical Numerical control machine has the following components.

47
System Controller: This consists of a mechanism for reading the software and convert-
ing the coding into machine instructions. The controller is the heart of the NC
operation. Types of control programs include

• Sequential control e.g. for perforated paper-tape


• Programmable logic control (PLC) - a solid state device with a CPU inter-
acting with I/O devices to monitor motion.
• Automatic adaptive control (AAC) - continuously adjusts parameters for im-
provement
• Numerical control - prerecorded written symbolic instructions.

Operator’s Console: This contains the necessary control for operating the machine
manually. It could be a swinging cabinet, a rolling cabinet or an overhanging
pendant. It offers the facility for setting up workpieces.

Magnetic controls cabinet: Contains starting switches and magnetic relays for control-
ling the flow of electrical power to the pumps, spindle motor, etc. The relays and
switches are controlled by the signals from the controller.

Hydraulic pump: This supplies fluid power for operating hydraulic motors attached to
the lead screws for table movements. Note: Lead screws are, in some machines
driven by electric motors.

4.4 Data for a typical CNC machine (3-axis vertical


machining center)

Manufacturer/type: Okuma MX-45VA


Spindle speed range: 60 - 25000 rpm
Fast feed, X, Y: 36000 mm/min
Fast feed, Z: 30000 mm/min
Cutting feed range: 1-30000 mm/min
Max. X travel: 560 mm
Max. Y travel: 460 mm
Spindle drive motor power: 15 kW
Weight: 5000 kg
Tool changer capacity: 20
Dimensions: 1800 x 3100 x 2750 mm

4.5 Other functions of a CNC machine tool

In addition to the main functions of machine tools, such as holding the workpiece and
cutting tool securely and displacing them relative to one another, the CNC machine tool
must have provision for performing functions such as automatically altering the spindle

48
speed and feed rates, tool changing, coolant application etc.
These extra functions are normally included in the programme for execution.
Some of the major functions performed by the control systems include:

• displacement of slide members

• rotation of circular tables

• start and stop of the main spindle

• change of spindle speeds

• change of feed speeds of slide members

• change of tools

• cutting fluid on/off

• locking of the table in position

• loading of workpiece, and transfer of workpiece.

Note: Not all machines are equipped with automatic operation for all the above listed
functions.

4.6 Control loops

CNC systems require motor drives to control both the position and the velocity of the
machine axes. Each axis must be driven independently and follow the command signal
generated by the NC control. There are two ways to activate the motor drives: the
open-loop system and the closed-loop system. The following sections will describe these
two systems.

4.6.1 Open loop control

In general, an open loop control is a system where the output variables have no effect
on the control of the input. In an open loop system, a device is instructed to move to
a certain location in a certain manner, say at a specified speed, but the control unit
does not ascertain that the device reaches the predetermined location or moves at the
commanded speed.
Open-loop principles are sometimes employed in manipulating electric or electro-hydraulic
stepper motors for machine tool control using computers. Discrete signals from the com-
puter are fed into the control unit, and instructions move to the stepper motor drive
unit. One pulse input to the motor drives turns it through one step.
The main variables in the open-loop control deal with the stepping motor. These vari-
ables are the step angle, angle of rotation and rotational speed of the motor. The drive
to the machine element may be a leadscrew, ball-bearing screw, or rack and pinion.

49
Workpiece
Fixture
Stepper Table
Pulses motor Lead screw
Numerical ∆x, v Electric
control logic pulse generator

Figure 4.2: Open loop control

Programmed instructions are fed into the controller through an input device. These
instructions are then converted to electrical pulses (signals) by the controller and sent
to the servo amplifier to energize the servo motors. The cumulative number of electrical
pulses determines the distance each drive will move, and the pulse frequency determines
the velocity.
In general, the control resolution Rm due to the mechanical factors is given by
p
Rm = , (4.2)
ns rg
where p is the pitch of the lead screw, ns is the number of steps per revolution of a motor,
and rg is the gear ratio.
Note: Each machine movement to be controlled has its own stepping motor and drive as
shown in Fig. 4.3.

Motors and drives

Y
X
Numerical
Controller

Figure 4.3: Open loop control for 3-axis machine

50
Example:

The motor shaft is directly connected to the leadscrew for driving an NC machine table.
The leadscrew has a step angle of 1.80 . If the pitch of the leadscrew is 2.5mm, determine
how closely the table’s position can be controlled. Suppose we want to move the table at
120 mm/min. What would be the rotational speed of the motor and the pulse frequency?

Soln.

One complete revolution of motor = 360/1.8 = 200 steps. (This corresponds to 200
pulses) One revolution of leadscrew moves the table = 2.5 mm. Therefore, the table can
be controlled up to 2.5/200 mm increments = 0.0125mm To achieve the table speed of
120 mm/min, the leadscrew speed (and hence the motor speed) ought to be 120/2.5 = 48
rpm. The pulse frequency,
Np
fp = (4.3)
60
where p is the number of pulses per revolution and N is the motor speed. Thus,
48 × 200
fp =
60
= 160 pulses/sec

The open-loop system has a drawback in that there is no feedback system to check
whether the program position and velocity have been achieved. If the system perfor-
mance is affected by say load or temperature, then the actual output could deviate from
the desired output. For these reasons, the open-loop system is normally used in point-
to-point systems where the accuracy requirements are not critical.

4.6.2 Closed loop control

In order to completely automate a process of a machine tool, it is necessary to employ


control systems that can compare the desired set of results with the actual results, and
take corrective action. This is the essence of closed-loop feedback systems. Although
open-loop control is simple and relatively cheap, it is not as accurate as closed-loop
system.
In a closed-loop control system, the machine motion is normally actuated by servomotors
and is monitored by a feedback unit that may be electronic, mechanical or optical. The
feedback subsystem in a closed-loop system monitors continuously, the actual output
and corrects any discrepancy from the programmed input.
The feedback subsystem could be either analog or digital. The analog systems measure
the variation of physical variables such as position or velocity in terms of voltage levels.
Digital systems monitor output variations by means of electrical pulses.
The monitoring unit transmits position signals through the feedback signal circuit to the
control unit where the signals are compared continuously with program signals.

51
Position Speed
comparator comparator Servo motor Machine tool
Input command
(position, speed)
Amp. Amp.

Speed feedback Speed


sensor

Position feedback Position


sensor

Figure 4.4: Closed-loop

Figure 4.5: Closed-loop for a 3-axis machine tool

In the case of position control, the command signal is fed through an amplifier to actuate
the drive motor until the difference between the command signal(position) and the actual
slide position reaches zero. When the error signal is zero, the machine movements are
at the exact or very close to the positions commanded. Most modern NC systems have
closed loop control with a resolution of up to 2.5 µm.
Actual devices used in feedback control will be discussed in Unit 4.

4.7 CNC Operational sequence

From the design drawings and specifications, the part programmer identifies the various
operations required to manufacture the part taking into consideration the materials to
be used, the dimensions, the required tolerances, etc, and selects the necessary tools and
other parameters for the operation. In most cases, the part programmer will need to

52
Design drawing

Identification of Preparation of Program


Machine operations (Part programming)

Program Verification Tape preparation


(dry running) (or Input translation)

Post processing and


Actual machining

Figure 4.6: CNC Operation sequence

refer back to the designer for clarification and sometimes to suggest design modifications
for more efficient machining.
After identification of the operations, the programmer prepares the program (Part pro-
gramming), which is a sequence of symbolic codes that specifies the desired machine
actions.
The program may be prepared manually or generated by use of a computer - either by
computational or direct from design drawing (Computer assisted part programming).
The next step is the input translation. In older machines, the process involved punch-
ing of tapes using a special printer to translate the code to machine language. Modern
systems use disks or direct computer inputs. After coding, it is important to check for
errors. This can be done by simulating the operations. This is the verification stage. A
plotter simulates the movements of the tool and graphically displays the final part in 2D
on paper.
Alternatively, the tools are offset, and the actions observed without cutting (this is a
post-processing action). Any errors detected are then corrected at this stage. The fi-
nal step is the post-processing step, whereby the coded instructions are converted into
machine tool action, and the actual machining takes place.

4.8 Types of programming and interpolation

Numerical control programming can be classified into two categories. These are point to
point (PTP) and continuous path. In a PTP system, accurate positional control is re-
quired only to place the spindle, workpiece or other machine members in fixed positions
for such operations as spot welding, drilling, boring, reaming or tapping. In between
these positions, the only requirement is that the machine members move from one point

53
G
9
Actual 7
8

Specified 5
6
y
3 4
x
F1 2

Figure 4.7: Point to point system

to another without regard to the path taken. Since this movement from one point to the
next is non-machining, it is made as rapidly as possible to reduce idle time.
Movements in more than one axis may take place simultaneously (with separate controls)
or sequentially (which consumes more time). Though the path G taken between the two
points is generally not important, care must be taken 9 collision with workpiece
to avoid
Actual 7
or fixture. 8
In order to avoid errors due to backlash, it is advisable to approach a point always from
the same direction along Specified
any axis. 5
6
PTP is extensively used on machines that can move in oneydirection only, such as in
drilling or punching. In some cases,
3 PTP method is used to machine a straight line and
a contour. In such cases, the number of 4steps determines
x how close the actual profile is
to the specified profile. In order to get much closer to the specified line, much smaller
step sizes will be neededFand 2 a much longer program.
1 hence,
For a continuous path system, the motion is controlled on more than one axis con-

N
Actual and specified

y
30°

x
M

Figure 4.8: Continuous path system

tinuously and simultaneously. The machine controls not only the destinations, but also
Designed by Checked Date Date
the paths through which thebytool reaches
Approvedthese
by destinations. The cutting tool contacts
Githu 1/12/2011
the workpiece as coordinate movements take place. This system, which is also known
as contouring system, is typically used in milling, grinding, turning, flame cutting and
pocketing operations.
Edition Sheet
point_to_point 1/1
54
The main difference between continuous path programming (CPP) and PTP is the in-
terpolation routine. The problem is that of providing control for the tool continuously,
which requires changes in two or more axes simultaneously, as the machining progresses.
Suppose, in Fig. 4.8, the length of the segment MN is 120 mm, and the movement to be
made is from M to N. The displacement in x -direction is

100 cos(30) = 103.92 mm,

while that in y-direction has to be 60 mm.


This type of movement requires the two driving motors to run simultaneously at two dif-
ferent speeds. The contouring system is certainly more expensive than the PTP system.
The control of the travel rate in two or more directions, proportional to the distance
moved is called linear interpolation. The shape produced is the result of a series of
straight-line machining moves programmed in sufficient quantity to give an acceptable
comparison between the designed shape and the actual shape. Let vf be the desired
velocity in the direction MN. Then the velocities along the two axes, vx and vy , are

4x
vx = √ vf
(4x2 + 4y 2 )
(4.4)
4y
vy = √ vf
(4x2 + 4y 2 )

where 4x and 4y are the displacements along the x and y axes, respectively.
In linear interpolation for a circular surface, several thousand discrete points connected
by straight lines would be required. Most machine control units, however have a circular
interpolator, in which the programming for a circular path is the end points of the arc,
the radius, the arc center and the direction of the cutter.
Example:
G02G17x56.5z70.0R65.5
The circular interpolator breaks up the span into the smallest straight line resolution
units (Basic Length Units(BLU)) available in the control. The control computes and
generates the controlling signal to achieve the required movements.
Other types of interpolation include:

• parabolic

• helical

• logarithmic

• exponential interpolations

These types of interpolation allow for machining of free-form surfaces. They usually
require generation of points for cutter paths, through a computer programme.

55
4.9 Circular interpolation

If an NC controller does not have built-in functions for complicated geometries such as
circles, parabolas etc, these geometries can be approximated using an offline interpolation
procedure. The main task in this case would be to determine the number of interpolation
points that would guarantee the desired results in terms of tolerances. Most computer as-
sisted part programming languages have subroutines for automatically calculating these
points. Interpolation can be used to produce curves and circular or parabolic arcs to
very close tolerances.
Circular interpolation can be performed using the specified an inner, outer or total toler-
ance, each of which is the maximum allowable deviation between the desired ideal curve
and the actual linear paths. These are illustrated in Fig. 4.9

to
ti
R

R
δθ tt δθ
tt

(a) Inner tolerance (b) Outer tolerance


R

δθ

(c) Total tolerance

Figure 4.9: Circular interpolation - inner, outer and total tolerances

The minimum number of chords necessary to achieve the specified tolerances are com-
puted based on the radius of the circular arc and the angle subtended by the arc at the
center.
It can be shown that for the case of inner tolerance, the angle δθ, subtended by a an arc,
whose chord approximates the arc is given by
R − ti
δθ = 2 cos−1 (4.5)
R
while for the outer tolerance,
R
δθ = 2 cos−1 (4.6)
R − to
In the case of total tolerance,
R − tt
δθ = 2 cos−1 (4.7)
R + tt
The total number of chords N necessary to approximate the circular arc is determined
as
θ
N= (4.8)
δθ
56
where θ is the angle subtended by the arc at the centre.
Note: If N is not a whole number, the next higher integer should be used in order to
ensure that the specified tolerance is achieved.
The position of various vertices of the polygon approximating the arc can be determined
by incrementing δθ and working out the coordinates.
For example, the nth vertex of a polygon approximating a circle of radius R and whose
center is (xc , yc ) can be determined as

xn = xc + R cos(nδθ)
yn = yc + R sin(nδθ) (4.9)

57
4.10 CNC Part programming

CNC part program is a detailed list of instructions that are to be executed by the machine
control unit to drive the machine tool in order achieve the final component shape. CNC
programming refers to the generation of the part program.
There are 4 different techniques used to generate the CNC part programs. These are:

1. Manual programming
2. Computer assisted part programming
3. Graphic numerical control programming
4. CNC programming based on solid modelling.

In this unit, we shall study these techniques in details.

4.10.1 Word address format in numerical control

Almost all modern CNC controls use the word address format, whereby each command
consists of a CNC word containing a letter address and a numerical value. The letter
address tells the control the kind of word, and the numerical value tells it the value of
the word. The following general format is used, but the order of words within the same
block does not really matter.
N....G....X....Y....Z....A....B....C....F....S....T....M....

ISO standards for coding

An ISO standard for coding exists in which all the 26 letters of the English alphabets
have been assigned meanings in the word addresses format. The meaning of some of
these words are shown in Table 4.1.

Table 4.1: Some common letter address specifications


Type Function Example
N Sequence number; used for identification N15 = line 15
O Program number O6205 = program name
G Preparatory function G01 = linear interpolation
M Miscellaneous/ Auxiliary function M30 = End of program
F Feed rate designation F80 = 80 mm/min
S Speed designation S6500 = 6500 rpm
T Tool designation T09 = Tool no. 9
X,Y,Z Axis designation Z10 = move to point x,y,10
I, J, K Incremental in x, y, z dir. (circular interpolation)
H Tool length offset (compensation)

Refer to unit 3 for the nomenclature of the coordinate system.

58
4.10.2 Manual programming

Manual programming involves writing part program using the word address directly into
a computer or through the keyboard into the CNC console (this is normally referred to
as manual data input or MDI).
Manual programming is used for workpieces of relatively simple geometries, where the
program needs not be very long. It begins with a careful study of component drawing.
The tools to be used are then identified, and the tool path of the CNC machine is then
described in the standard codes, which are then keyed in for processing.
A part program consists of a number of blocks, each representing an operation to be
carried out in machining of a part. Ordinarily, each block starts with a block number,
but this is not a rule. Each block can have one or more of the word addresses in a
sequence. For example:
N35 G01 G91 X55.6 Y70.3 Z40.0 F100;
Within the block, the word address can occur in any sequence, as was mentioned earlier.
The end of the block (EOB) is indicated by a semicolon.
Important Note:
Programming formats for various control systems are not always identical and may some-
times differ from ISO recommendations. It is therefore important that the relevant pro-
gramming manual should be referred to when preparing the program. Such manuals are
normally supplied by the machine tool or controls manufacturers.

Preparatory functions

Preparatory functions are pre-set functions associated with the movement of the machine
axes and geometry. They are denoted by the letter G, followed by appropriate address,
e.g., G43. The preparatory functions are for this reason, often referred to as G codes.
Below is a list of G codes that are generally present in all machining centers, and uni-
formly followed by all controller manufacturers.

1) Motion group

• G00 - Rapid motion (default)


• G01 - Linear interpolation
• G02 - Circular interpolation clockwise
• G03 - Circular interpolation counter clockwise

2) Active plane selection group

• G17 - XY plane (default)


• G18 - XZ plane
• G19 - YZ plane

3) Cutter compensation group

• G40 - Cutter compensation, cancel (default)

59
• G41 - Cutter compensation left
• G42 - Cutter compensation right

4) Units group

• G70 - Imperial units (default)


• G71 - Metric units (mm)

5) Coordinate system group

• G90 - Absolute coordinate system (default)


• G91 - Incremental coordinate system.

Some of the G codes are modal, meaning that they remain functional until they are
canceled by another G code. Others are non modal, meaning that they remain functional
only in the block in which they are programmed.

Miscellaneous functions

Miscellaneous functions operate some controls on the machine, such as tool change,
coolant supply or cut, stopping of machines and giving direction of rotation of spindle.
Some of the most common miscellaneous functions are:

• M00 - (program stop) for terminating auto operation of the machine, eg. when an
inspection is to be done before going on with the work.

• M01 - Optional stop when the “optional stop” switch is ON.

• M02, M30 - End of program. It causes the stopping of the machine and clearing
of all the control registers.

• M03 - Machine spindle control for clockwise rotation.

• M04- Machine spindle control for counter clockwise rotation.

• M05 - Stopping of the machine spindle. When it is given in a block, it will be the
last the last code to be executed.

• M06 - tool change

• M07, M08 - coolant on

• M09 - coolant off

Exercises

Attempt a number of part programming exercises for milling operations. A comprehen-


sive list of all G codes will be given in the following pages.

60
4.10.3 List of G and M codes

Preparatory functions

G00* RAPID POSITIONING MOTION (X,Y,Z,A,B) (SETTING 10, 56, 101)


G01 LINEAR INTERPOLATION MOTION (X,Y,Z,A,B,F) (SETTING 85)
G02 CIRCULAR INTERPOLATION MOTION CW (X,Y,Z,A,I,J,K,R,F)
G03 CIRCULAR INTERPOLATION MOTION CCW (X,Y,Z,A,I,J,K,R,F)
G04 DWELL (P) (P=seconds”.”milliseconds)
G09 EXACT STOP, NON-MODAL
G10 PROGRAMMABLE OFFSET SETTING (X,Y,Z,A,L,P,R)
G12 CW CIRCULAR POCKET MILLING (Z,I,K,Q,D,L,F)
G13 CCW CIRCULAR POCKET MILLING (Z,I,K,Q,D,L,F)
G17* CIRCULAR MOTION XY PLANE SELECTION (G02 or G03) (SETTING 56)
G18 CIRCULAR MOTION ZX PLANE SELECTION (G02 or G03)
G19 CIRCULAR MOTION YZ PLANE SELECTION (G02 or G03)
G20* VERIFY INCH COORDINATE POSITIONING (SETTING 9, set to INCH)
G21 VERIFY METRIC COORDINATE POSITIONING (SETTING 9 set to METRIC)
G28 MACHINE ZERO RETURN THRU REF. POINT (X,Y,Z,A,B) (SETTING 108)
G29 MOVE TO LOCATION THROUGH G28 REF. POINT (X,Y,Z,A,B)
G31** FEED UNTIL SKIP FUNCTION (X,Y,Z,A,B,F)
G35** AUTOMATIC TOOL DIAMETER MEASUREMENT (D,H,Z,F)
G36** AUTOMATIC WORK OFFSET MEASUREMENT (X,Y,Z,A,B,I,J,K,F)
G37** AUTOMATIC TOOL LENGTH MEASUREMENT (D,H,Z,F)
G40* CUTTER COMP CANCEL G41/G42/G141 (X,Y)
G41 2D CUTTER COMPENSATION, LEFT (X,Y,D) (SETTING 40, 43, 44, 58)
G42 2D CUTTER COMPENSATION, RIGHT (X,Y,D) (SETTING 40, 43, 44, 58)
G43 TOOL LENGTH COMPENSATION+ (H,Z) (SETTING 15)
G44 TOOL LENGTH COMPENSATION- (H,Z) (SETTING 15)
G47 TEXT ENGRAVING (X,Y,Z,R,I,J,P,E,F,) (Macro Variable 599 Change Serial #)
G49* TOOL LENGTH COMPENSATION CANCEL G43/G44/G143 (SETTING 56)
G50* SCALING G51 CANCEL (SETTING 56)
G51** SCALING (X,Y,Z,P) (SETTING 71)
G52 WORK OFFSET COORDINATE POSITIONING (YASNAC) (SETTING 33)
G52 GLOBAL WORK COORDINATE OFFSET SHIFT (FANUC) (SETTING 33)
G52 GLOBAL WORK COORDINATE OFFSET SHIFT (HAAS) (SETTING 33)
G53 MACHINE COORDINATE POSITIONING, NON-MODAL (X,Y,Z,A,B)
G54* WORK OFFSET COORDINATE POSITIONING #1 (SETTING 56)
G55 WORK OFFSET COORDINATE POSITIONING #2
G56 WORK OFFSET COORDINATE POSITIONING #3
G57 WORK OFFSET COORDINATE POSITIONING #4
G58 WORK OFFSET COORDINATE POSITIONING #5
G59 WORK OFFSET COORDINATE POSITIONING #6
G60 UNI-DIRECTIONAL POSITIONING (X,Y,Z,A,B) (SETTING 35)
G61 EXACT STOP, MODAL (X,Y,Z,A,B)
G64* EXACT STOP G61 MODE CANCEL (SETTING 56)
G65** MACRO SUB-ROUTINE CALL
G68** ROTATION (G17,G18,G19,X,Y,Z,R) (OPTION) (SETTING 72, 73)

61
G69* ROTATION G68 CANCEL (SETTING 56)
G70 BOLT HOLE CIRCLE with a CANNED CYCLE (I,J,L)
DEFAULT *
OPTIONAL **
G71 BOLT HOLE ARC with a CANNED CYCLE (I,J,K,L)
G72 BOLT HOLES ALONG AN ANGLE with a CANNED CYCLE (I,J,L)
G73 HIGH SPEED PECK DRILL CANNED CYCLE (X,Y,A,B,Z,I,J,K,Q,P,R,L,F) (SET-
TING 22, 52)
G74 REVERSE TAPPING CANNED CYCLE (X,Y,A,B,Z,J,R,L,F) (SETTING 130)
G76 FINE BORING CANNED CYCLE (X,Y,A,B,Z,I,J,P,Q,R,L,F) (SETTING 27)
G77 BACK BORE CANNED CYCLE (X,Y,A,B,Z,I,J,Q,R,L,F) (SETTING 27)
G80* CANCEL CANNED CYCLE (SETTING 56)
G81 DRILL CANNED CYCLE (X,Y,A,B,Z,R,L,F)
G82 SPOT DRILL / COUNTERBORE CANNED CYCLE (X,Y,A,B,Z,P,R,L,F)
G83 PECK DRILL CANNED CYCLE (X,Y,A,B,Z,I,J,K,Q,P,R,L,F) (SETTING 22, 52)
G84 TAPPING CANNED CYCLE (X,Y,A,B,Z,J,R,L,F) (SETTING 130)
G85 BORE IN, BORE OUT CANNED CYCLE (X,Y,A,B,Z,R,L,F)
G86 BORE IN, STOP, RAPID OUT CANNED CYCLE (X,Y,A,B,Z,R,L,F)
G87 BORE IN AND MANUAL RETRACT CANNED CYCLE (X,Y,A,B,Z,R,L,F)
G88 BORE IN, DWELL, MANUAL RETRACT CANNED CYCLE (X,Y,A,B,Z,P,R,L,F)
G89 BORE IN, DWELL, BORE OUT (X,Y,A,B,Z,P,R,L,F)
G90* ABSOLUTE POSITIONING COMMAND
G91 INCREMENTAL POSITIONING COMMAND (SETTING 29)
G92 GLOBAL WORK COORDINATE SYSTEM SHIFT (FANUC) (HAAS) (SETTING
33)
G92 SET WORK COORDINATE VALUE (YASNAC) (SETTING 33)
G93 INVERSE TIME FEED MODE ON
G94* INVERSE TIME FEED MODE OFF / FEED PER MINUTE ON (SETTING 56)
G98* CANNED CYCLE INITIAL POINT RETURN (SETTING 56)
G99 CANNED CYCLE ”R” PLANE RETURN
G100 MIRROR IMAGE G101 CANCEL (X,Y,Z,A,B)
G101 MIRROR IMAGE (X,Y,Z,A,B) (SETTING 45, 46, 47, 48, 80)
G102 PROGRAMMABLE OUTPUT TO RS-232 (X,Y,Z,A,B)
G103 LIMIT BLOCK LOOKAHEAD (P0-P15 for number control looks ahead)
G107 CYLINDRICAL MAPPING (X,Y,Z,A,Q,R,)
G110-G129 WORK OFFSET COORDINATE POSITIONING #7-26
G136** AUTOMATIC WORK OFFSET CENTER MEASUREMENT
G141 3D+ CUTTER COMPENSATION (X,Y,Z,I,J,K,D,F)
G143** 5-AXIS TOOL LENGTH COMPENSATION+ (X,Y,Z,A,B,H) (SETTING 15,
117)
G150 GENERAL PURPOSE POCKET MILLING (X,Y,P,Z,I,J,K,Q,D,R,L,S,F)
G153** 5-AXIS HIGH SPEED PECK DRILL CANNED CYCLE (X,Y,A,B,Z,I,J,K,Q,P,E,L,F)
(SETTING 22)
G154** 5-AXIS REVERSE TAPPING CANNED CYCLE (X,Y,A,B,Z,J,E,L,F)
G161** 5-AXIS DRILL CANNED CYCLE (X,Y,A,B,Z,E,L,F)
G162** 5-AXIS SPOT DRILL / COUNTERBORE CANNED CYCLE (X,Y,A,B,Z,P,E,L,F)
G163** 5-AXIS PECK DRILL CANNED CYCLE (X,Y,A,B,Z,I,J,K,Q,P,E,L,F) (SET-
TING 22)

62
G164** 5-AXIS TAPPING CANNED CYCLE (X,Y,A,B,Z,J,E,L,F)
G165** 5-AXIS BORE IN, BORE OUT CANNED CYCLE (X,Y,A,B,Z,E,L,F)
G166** 5-AXIS BORE IN, STOP, RAPID OUT CANNED CYCLE (X,Y,A,B,Z,E,L,F)
G169** 5-AXIS BORE IN, DWELL, BORE OUT (X,Y,A,B,Z,P,E,L,F)
G174 SPECIAL PURPOSE NON-VERTICAL RIGID TAPPING CCW (X,Y,Z,F)
G184 SPECIAL PURPOSE NON-VERTICAL RIGID TAPPING CW (X,Y,Z,F)
G187 ACCURACY CONTROL FOR HIGH SPEED MACHINING (E) (SETTING 85)

MISCELLANEOUS FUNCTIONS

M00 PROGRAM STOP (SETTING 42)


M01 OPTIONAL PROGRAM STOP (SETTING 17)
M02 PROGRAM END
M03 SPINDLE ON CLOCKWISE (S) (SETTING 144)
M04 SPINDLE ON COUNTERCLOCKWISE (S) (SETTING 144)
M05 SPINDLE STOP
M06 TOOL CHANGE (T) (SETTING 42, 87)
M08 COOLANT ON (SETTING 32)
M09 COOLANT OFF
M10** 4th AXIS BRAKE ON
M11** 4th AXIS BRAKE RELEASE
M12** 5th AXIS BRAKE ON
M13** 5th AXIS BRAKE RELEASE
M19** ORIENT SPINDLE (P,R)
M21-M28 OPTIONAL USER M CODE INTERFACE WITH M-FIN SIGNAL
M30 PROGRAM END AND RESET (SETTING 2, 39, 56, 83)
M31 CHIP AUGER FORWARD (SETTING 114, 115)
M32 CHIP AUGER REVERSE (SETTING 114, 115)
M33 CHIP AUGER STOP
M34 COOLANT SPIGOT POSITION DOWN, INCREMENT
M35 COOLANT SPIGOT POSITION UP, DECREMENT
M36** PALLET PART READY
M39 ROTATE TOOL TURRET (T) (SETTING 86)
M41 SPINDLE LOW GEAR OVERRIDE
M42 SPINDLE HIGH GEAR OVERRIDE
M50** EXECUTE PALLET CHANGE (SETTING 121 thru 129)
M51-M58 OPTIONAL USER M CODE SET
M59 OUTPUT RELAY SET (N)
M61-M68 OPTIONAL USER M CODE CLEAR
M69 OUTPUT RELAY CLEAR (N)
M75 SET G35 OR G136 REFERENCE POINT
M76 CONTROL DISPLAY INACTIVE
M77 CONTROL DISPLAY ACTIVE
M78 ALARM IF SKIP SIGNAL FOUND
M79 ALARM IF SKIP SIGNAL NOT FOUND

63
M80** AUTOMATIC DOOR OPEN (SETTING 131)
M81** AUTOMATIC DOOR CLOSE (SETTING 131)
M82 TOOL UNCLAMP
M83** AUTO AIR JET ON
M84** AUTO AIR JET OFF
M86 TOOL CLAMP
M88** COOLANT THROUGH SPINDLE ON (SETTING 32)
M89** COOLANT THROUGH SPINDLE OFF
M93 AXIS POS CAPTURE START (P,Q)
M94 AXIS POS CAPTURE STOP
M95 SLEEP MODE
M96 JUMP IF NO SIGNAL (P,Q)
M97 LOCAL SUB-PROGRAM CALL (P,L)
M98 SUB-PROGRAM CALL (P,L)
M99 SUB-PROGRAM/ROUTINE RETURN OR LOOP (SETTING 118)
M109** INTERACTIVE USER INPUT (P)

64
4.10.4 Computer assisted part programming using high level
languages

There are several high-level processing languages that can be used for numerical control.
Some of the most commonly used NC languages include the following

• Automatically Programmed Tool (APT)


• Automatic System for Positioning Tools (SPOT)
• Adaptation of APT (ADAPT)
• Extended Subset of APT (EXAPT)
• Sundstrand Processing Language Internally Translated (SPLIT), etc.

In all these languages, a postprocessor is required to convert the program into the specific
language that a particular CNC machine tool can understand. The final program used
by the machine tool will be identical, whether it is prepared in machine language, by a
CAM system or by the computer in a high-level programming languages. Note: Differ-
ent machine tools require their information differently, and therefore there are different
postprocessors. Of all the above languages, APT is the most widely used.

4.10.5 The APT language

This language is easy to understand as it uses simple statements to command the cutting
tool through its sequence of machining operations. Like any other high-level language,
APT allows arithmetic operations, subroutines, macros, looping logic, et cetera. More-
over, it allows parametric representations of geometric entities ranging from a single
point in space to very complex 3-D sculptured surfaces. Though currently APT is being
replaced by graphics-based user-friendly interactive CAD/CAM software systems, it is
important to understand the very basic structure of APT programming system since
most CAD/CAM systems use APT standards in processing NC tool path data.

APT statements

There are 4 types of statements and over 400 words in APT vocabulary. These statements
are

Geometry statements These are also called definition statements. They define the
geometric elements that comprise the workpiece.
Motion statements These are used to describe the path taken by the tool
Post processor statements These apply to specific machine tool and control system.
They are used to specify feeds and speeds and actuate other features of the machine.
Auxiliary statements These are used to identify the workpiece, tool, tolerances, etc.

65
Table 4.2: Typical APT geometry words
Geometric Type APT Vocabulary word
Point POINT
Line LINE
Spline SPLINE
Plane PLANE
Circle CIRCLE
Cylinder CYLNDR
Pattern PATERN

Geometry statements

The geometry of a workpiece is defined using points, lines, arcs, space curves and surfaces.
Each geometric entity is mathematically represented and stored as variables by APT.
Each geometry is defined according to the following format:
(Geometry’s symbol)=Geometry/Dimension and parameters of the geometry
For example, to define a point P1, we write
P1=POINT/3.0,2.1,8.5
The geometry symbol is P1, and the geometry statement is POINT, and the descriptive
data are the coordinates of the point. Some typical APT geometry vocabulary words
are given in the Table 4.2.
APT allows the use of parabolas, hyperbolas, ellipses and parametric curves. Splines
are the most common parametric curves that allow flexible and smooth curve fit passing
through a given set of points.
Note: There are many ways of defining some of the geometry types. Refer to the recom-
mended textbooks [1] and [5]for details.

66
It is important to note the following points for geometry statements;

(1) The coordinate data must be specified in the order x,y,z

(2) Any symbol used as descriptive data or definitional modifier must have been pre-
viously defined.

(3) A symbol can be used to define one geometry element

(4) Only one symbol can be used to define any given element

(5) Lines defined by APT are considered to be of infinite length in both directions.
The same applies to planes.

(6) circles are complete circles.

Tool motion statements

There are two types of tool motion commands in APT, namely, Point to Point and con-
tinuous tool motion command. The general form of motion statement is:
Motion command/descrtiptive data
If the requirement is to move the tool to a specified point from its current position, the
PTP commands are used. There are two types of PTP motion commands. These are
GOTO/Point, Feedrate
and
GODLTA/Point,Feedrate
Both commands take the tool to the point indicated to the right of the forward slash
with an optional feed rate provided. The part coordinates are absolute for GOTO state-
ment and incremental for GODLTA statement. Such statements are especially useful for
drilling and punching operations.
For continuous potion commands, the controlled path is defined by the part, drive and
check surfaces.

Drive surface This is the surface that guides the side of the cutter. It is parallel to the
tool axis.

Part surface This is the surface on which the bottom of the tool rides. It doesn’t have
to be an actual surface of the workpiece.

Check surface This is the surface that bounds the tool motion

Modifier words are used within the descriptive data of the motion statement. The main
modifier words are TO, ON and PAST. They define the position of the tool with respect
to the surface. If the drive surface is tangent to a circular check surface, a fourth modifier
word TANTO is used.
The APT continuous motion statement commands the tool to move along the ’drive’
and ’part’ surfaces and the movement ends when the tool is at the ’check’ surface. The
general format for motion command is

67
Numerical Control and Computer Numerical Control Technology 335

Check surface

Drive surface

Tool
Part
surface

FIGURE 8.61 APT definitions of drive, part, and check surfaces.


Figure 4.10:
For PTP motions the following statements are used:
Motion command/drive surface,modifier word, part surface,modifier word, check surface
There are six motion commands. These are:
GOTO/P2 Move to point P2
GOTO/2.0,7.0,00 Absolute
GODELTA/2.0,7.0,0.0 Incremental

• GOFWD
For continuous motions as shown in Figure 8.61, the tool motion is guided by the following
three surfaces:
• GOBACK
• Drive surface. Guides the sides of the cutter
• Part surface. The bottom of the cutter rides
• GOUP
• Check surface. Stops the movements of the tool (TO, ON, PAST, TANTO), as shown in
• GODOWN Figure 8.62.
Figure 8.63 shows the motion command that include GOLFT, GORGT, GOFWD,
• GORGT GOBACK, GOUP, and GODOWN
3. Postprocessing statements. These statements contain the machine instructions that are
• GOLFT passed unchanged into the cutter location data (CLDATA) file to be dealt with by the post-
processor. It operates the spindle speed, feed rate and other features of the machine tool,
such as adding coolant and stopping the program. Some common postprocessor statements
Note: The check surfacewhere
are as follows, andthetheslash
drive surface
indicates that must be re-defined
some descriptive inneeded:
data are each new command.

COOLANT/ For coolant control (ON or OFF)


Post-processor statements
RAPID To select rapid cutter motion
SPINDL/ To select spindle on/off, speed and direction of rotation
FEDRAT/ To select feed rate
These are statements that
TURRET/ controlTothe
selectoperation
cutter number of spindle, the feed and other features
of the machine tool. Typical examples are:
FEDRAT, used to specify feed rate (eg in mm/min);
RAPID, used for rapid motions;
END, used to stop the machine at the end of a section of program;
FINI,
CRC_43390_Ch008.indd 335 indicates the end of the complete program. It is the last word in the APT3:31:36
3/25/2008 program;
PM

COOLNT, Turns the coolant on, off and actuates other coolant options.

68
Auxiliary statements

These are used for cutter size specifications, part identifications etc.

4.11 CAD/CAM Approach to part programming

CAM utilizes computers in the manufacturing stage. Such a modern technique has the
following features:
• Allows the programmer to develop a model that represents the part and the ma-
chining operations.

• The programmer can interact with the model graphically to make the necessary
adjustments and modifications before the CNC code is generated.

• CAM software reads the DXF that contains the part geometry and the levels or
layers that the geometry exists on.

• CAM software utilizes a job plan to assign the correct tool path to each layer.

• The job plan knows the work material that will be used so that it can calculate
speeds and feeds for each tool.

The integrated CAD/CAM approach prepares the part program directly from the CAD
part geometry, either by using NC programming commands called in the CAD/CAM sys-
tem or by passing the CAD geometry into a dedicated CAM program. Using CAD/CAM
systems, the CAD drawings can therefore be changed to CNC programs. The CAD/CAM
approach has the following advantages:
(1) No need to encode the part geometry and the tool motion

(2) Allows the use of interactive graphics for program editing and verification

(3) Displays the programmed motions of the cutter with respect to the WP, which
allows visual verification of the program

(4) Allows interactive editing of the tool path with the addition of the tool moves and
standard cycles

(5) Incorporates the most sophisticated algorithms for part programming generation

The programming steps for CAD/CAM approach are as follows:

(1) The aspects of the part geometry that are important for machining purposes are
identified (and perhaps isolated on a separate level or layer); geometry may be
edited or additional geometry added to define boundaries for the tool motion.

(2) Tool geometry is defined; for instance, by selecting tools from a library.

(3) The desired sequence of machining operations is identified and tool paths are de-
fined interactively for the main machining operations.

69
(4) The tool motion is displayed and may be edited to refine the tool motion, or other
details may be added for particular machining cycles or operations.

(5) A CLDATA file is produced from the edited tool paths.

(6) The CLDATA file is postprocessed to MCD, which is then transmitted to the
machine.

Postprocessor

The postprocessor takes the part geometry and job plan and writes the code that the
specific machine will understand.

Simulation

The program can be written and tested before it is actually run, and jigs, fixtures, and
clamping can be shown during simulation to determine whether there are any potential
problems. The simulation shows the machining time. Operations can then be adjusted
to optimize production off-line, which keeps the machine operating.

Download the CNC Programs

The program is sent to the machine manually, using a tape or disk, or electronically,
using a communication cable.

70

You might also like