PM 2
PM 2
PM 2
March 2015
1
PART-I
2
Introduction
MATLAB is a powerful computing system for handling the calculations involved in scientific
and engineering problems. The name MATLAB stands for MATrixLABoratory, because the
system was designed to make matrix computations particularly easy.
MATLAB is an interactive computing environment that enables numerical computation and data
visualization.The MATLAB environment allows the user to manage variables, import and export
data, perform calculations, generate plots, & develop and manage files for use with MATLAB.
MATLAB has hundreds of built-in functions and can be used to solve problems ranging from the
very simple to the sophisticated and complex ones.
Whether you want to do some simple numerical or statistical calculations, some complex
statistics, solve simultaneous equations, make a graph, or run and entire simulation program,
MATLAB can be an effective tool.
This Lab manual is prepared to assist the students who take the course Numerical and
Computational Methods in solving various complex and tedious mathematical computations by
using MATLAB software.
It is tried to introduce the basics of MATLAB prior to starting the main topics of the course in
order to familiarize the students about MATLAB. An M-File for each method of solving
numerical problems is included in this manual.
1
Contents
Introduction......................................................................................................................................1
Lab 1...............................................................................................................................................6
MATLAB Basics.............................................................................................................................6
Scalar Mathematics......................................................................................................................7
Operators in MATLAB................................................................................................................8
Format........................................................................................................................................10
Special variables:.......................................................................................................................11
E X E R C I S E S..........................................................................................................................14
Lab 2.............................................................................................................................................16
2.3 Plotting.................................................................................................................................19
3-D plots.....................................................................................................................................24
EXERCISES..................................................................................................................................27
Lab 3.............................................................................................................................................28
2
3.2 Relational and Logical Operators........................................................................................32
3.4 Loops....................................................................................................................................40
While Loops...........................................................................................................................42
Exercise..........................................................................................................................................43
Lab 4.............................................................................................................................................44
Bisection method...........................................................................................................................44
Bisection Method...........................................................................................................................44
EXERCISES..................................................................................................................................48
Lab 5.............................................................................................................................................49
Newton-Raphson Method..............................................................................................................49
EXERCISE.................................................................................................................................53
Lab 6.............................................................................................................................................54
3
EXERCISE....................................................................................................................................58
Lab7..............................................................................................................................................59
Polynomial Interpolation...............................................................................................................59
8.1 Determining Polynomial Coefficients using MATLAB functions: polyfit and polyval.....60
EXERCISE.................................................................................................................................64
Lab 8.............................................................................................................................................65
8.2 LU Factorization..................................................................................................................68
EXERCISE.................................................................................................................................71
Lab 9.............................................................................................................................................72
4
EXERCISE....................................................................................................................................79
Lab 10...........................................................................................................................................80
Romberg integration......................................................................................................................80
EXERCISE....................................................................................................................................83
REFERENCES..............................................................................................................................84
5
Lab 1
MATLAB Basics
Objectives
To start MATLAB from Windows, double-click the MATLAB icon on your Windows
Desktop. When MATLAB starts, the MATLAB desktop opens as shown in Figure 1.1.
The window in the desktop that concerns us most of the time is the Command Window, where
the special >>prompt appears. This prompt means that MATLAB is waiting for a command.
6
You can quit MATLAB at any time with one of the following:
Select Exit MATLAB from the desktop File menu.
Enter quit or exit at the Command Window prompt.
Do not click on the close box in the top right corner of the MATLAB desktop. This does not
allow MATLAB to terminate properly and, on rare occasions, may cause problems with your
computer operating software
In MATLAB most of the time, we use the following desktop tools.
1.Command Window:-shows the commands which are executed on the command window as well
as the output result of a MATLAB program.
2.Command History: - in the command history we will find all the commands which are executed
previously in the MATLAB.
3.Work Space:- the work space is basically the memory space of MATLAB which contains all
the variables and their numerical values which were stored in particular program.
4.Curent Directory(folder):- displays the current directory (folder)from where you are taking the
MATLAB file.
7
It is called floating point because the decimal point is allowed to move. The number has two
parts:
mantissa m: fixed point number (signed or unsigned), with an optional decimal point
(2.6349 in the example above)
exponent e: an integer exponent (signed or unsigned) (5 in the example).
Mantissa and exponent must be separated by the letter e (or E).
Scientific notation is used when the numbers are very small or very large. For example, it is
easier to represent 0.000000001 as 1e-9.
In MATLAB the evaluation of expressions is achieved with arithmetic operators, shown in the
table below.
8
o ans = following the completion of the command with the Enter key marks the beginning of
the answer.
Operations may be chained together. For example:
>> 3 + 5 + 2
ans =
10
>> 4*22 + 6*48 + 2*82
ans =
540
>> 4 * 4 * 4
ans =
64
Instead of repeating the multiplication, the MATLAB exponentiation or power operator can be
used to write the last expression above as:
>> 4^3
ans =
64
Left division may seem strange: i.e divide the right operand by the left operand. For scalar
operands the expressions 56/8 and 8\56 produce the same numerical result.
>> 56/8
ans =
7
>> 8\56
ans =
7
Since several operations can be combined in one expression, there are rules about the order in
which these operations are performed:
1. Parentheses’()’, innermost first
2. Exponentiation (^), left to right
9
3. Multiplication (*) and division (/ or \) with equal precedence, left to right
4. Addition (+) and subtraction (−) with equal precedence, left to right
When operators in an expression have the same precedence the operations are carried out from
left to right. Thus 3 / 4 * 5 is evaluated as ( 3 / 4 ) * 5 and not as 3 / ( 4 * 5 )
Syntax
MATLAB cannot make sense out of just any command; commands must be written using the
correct syntax (rules for forming commands). Compare the interaction above with
>>4 + 6 +
??? 4 + 6 +
I
Error: Expression or statement is incomplete or incorrect.
Here, Matlab is indicating that we have made a syntax error, which is comparable to a misspelled
word or a grammatical mistake in English. Instead of answering our question, MATLAB tells us
that we’ve made a mistake and tries its best to tell us what the error is.
1.6 Format
We Use the format function to control the output format of numeric values displayed in the
Command Window.
Note The format function affects only how numbers are displayed, not how MATLAB
computes or saves them.
formattype changes the format to the specified type.
The tables below show the allowable values for type, and provides an example for each type.
Command Description example
format short Fixed-point with 4 >> 351/7
decimal digits ans = 50.1429
format long Fixed-point with 14 >> 351/7
decimal digits ans = 50.14285714285715
format short e Scientific notation with 4 >> 351/7
decimal digits ans = 5.0143e + 001
format long e Scientific notation with 15 >> 351/7
decimal digits ans = 5.014285714285715e001
format short g Best of 5 digit fixed or >> 351/7
floating point ans = 50.143
10
format compact Two decimal digits >> 351/7
ans = 50.14
format bank Eliminates empty lines to allow more lines with information
displayed on the screen
format loose Adds empty lines (opposite of compact)
11
or
ii. >> b = [2
4
6
8
10]
or, by transposing a row vector with the ‘ operator,
iii. >> b = [2 4 6 8 10]‘
The result in all three cases will be
b =
2
4
6
8
10
A matrix of values can be assigned as follows:
>> A = [1 2 3; 4 5 6; 7 8 9 ]
A =
1 2 3
4 5 6
7 8 9
In addition, the Enter key can be used to separate the rows. For example:
>> A = [ 1 2 3
4 5 6
7 8 9 ]
Finally, we could construct the same matrix by joining the vectors representing each column:
>> A = [ [ 1 4 7 ]' [ 2 5 8 ]' [ 3 6 9 ]']
At any point in a session, a list of all current variables can be obtained by entering the who
command:
>>who
12
Your variables are:
-----------------
or, with more detail, enter the whoscommand:
>>whos
Name Size Bytes Class
----- ------ -------- --------
Note that subscript notation can be used to access an individual element of an array. For
example, the fourth element of the column vector b can be displayed as
>>b ( 4 )
ans =
8
For an array, A(m,n) selects the element in mth row and the nth column. For example,
>> A ( 2 , 3 )
ans =
6
There are several built-in functions that can be used to create matrices. For example, the ones
and zeros functions create vectors or matrices filled with ones and zeros, respectively. Both have
two arguments, the first for the number of rows and the second for the number of columns.
For example, to create a 2 × 3 matrix of zeros:
>> E = zeros(2,3)
E =
0 0 0
0 0 0
Similarly, the ones function can be used to create a row vector of ones:
>> u = ones(1,3)
u =
1 1 1
13
1.10 The Colon Operator
The colon operator is a powerful tool for creating and manipulating arrays. If a colon is used to
separate two numbers, MATLAB generates the numbers between them using an increment of
one:
>> t = 1:5
t =
1 2 3 4 5
If colons are used to separate three numbers, MATLAB generates the numbers between the first
and third numbers using an increment equal to the ;number:
>> t = 1:0.5:3
t =
1.0000 1.5000 2.0000 2.5000 3.0000
EXERCISES
1
(a) (0.1667)
2 X3
Lab 2
MATLAB Built –in Functions
Objectives
Introducing common Mat Lab built-in Functions
15
Introducing how to Display Values and texts in Mat Lab
Introducing about plotting In Mat Lab
16
2.2 Displaying Values and Text
• There are three ways to display values and text in Matlab,
1. By entering the variable name at the Matlab prompt, without a semicolon.
2. By use of the command disp.
3. By use of the command fprintf.
disp:
There are two general forms of the command disp,
1. disp(variable): Displays value of variable without displaying the variable name.
17
2. disp(string): Displays string by stripping off the single quotes and echoing the characters
between the quotes.
String: A group of keyboard characters enclosed in single quote marks (’). The quote marks
indicate that the enclosed characters are to represent ASCII text.
Example
>>temp=78;
>>disp(temp); disp(’degrees F’)
78
degrees F
fprintf
The general form of this command is:
fprintf(’format string’, list of variables)
The format string contains the text to be displayed (in the form of a character string enclosed in
single quotes) and it may also contain format specifiers to control how the variables listed are
embedded in the format string.
The format specifiers include:
w.d%f:- Display as fixed point or decimal notation (defaults to short), with a width of w characters
(including the decimal point and possible minus sign, with d decimal places. Spaces are filled in from
the left if necessary. Set d to 0 if you don’t want any decimal places, for example %5.0f. Include
leading zeros if you want leading zeroes in the display, for example %06.0f.
w.d%e:-Display using scientific notation (defaults to short e), with a width of w characters (including
the decimal point, a possible minus sign, and five forthe exponent), with d digits in the mantissa after
the decimal point. Themantissa is always adjusted to be less than 1.
w.d%g:- Display using the shorter of tt short or short e format, with width w and d decimal places.
\n:- Newline (skip to beginning of next line)
The w.dwidth specifiers are optional. If they are left out, default values are used.
Examples:
>>fprintf(’The temperature is %f degrees F \n’, temp)
The temperature is 78.000000 degrees F
>>fprintf(’The temperature is %4.1f degrees F \n’, temp)
The temperature is 78.0 degrees F
18
2.3 Plotting
MATLAB has a powerful graphics system for presenting and visualizing data, which is
reasonably easy to use.
MATLAB has many commands that can be used to create basic 2-D plots, overlay plots,
specialized 2-D plots,3-D plots, mesh and surface plots.
Basic 2-D Plots
Probably the most common form of plot is plot(x, y) where x and y are vectors of the same
length, e.g.
>> x=0:pi/40:4*pi;
>>plot( x, sin(x))
The basic command for producing a simple 2-D plot is:
plot(x values, y values, ‘style option’)
where
• x values and y values are vectors containing the x- and y-coordinates of points on the
graph.
• Style option is an optional argument that specifies the color, line-style and the point-
marker style.
The different color, line-style and marker-style options are summarized below.
You can also combine several specifieres. For example, if you want to use square green markers
connected by green dashed lines, you could enter:
19
>> x=0:pi/40:4*pi;
>>plot( x, sin(x),'s--g‘)
You can customize the graph a bit with commands such as the following:
>>x=0:pi/40:4*pi;
>>plot(x,sin(x),'s--g')
>>title('plot of x Vs sin(x)')
>>xlabel('value of x')
>>ylabel('value of sin(x)')
Multiple curves can appear on the same graph. if for example we define another vector,
>>z=cos(x);
We can get both graphs on the same axis , distinguished by their line type, using
>>plot( x, y, ’r--’,x , z , ’b:’)
The resulting graph can be seen below, with the red dashed line representing y=sin (x) and the
blue dotted line representing z= cos(x).
0.8
0.6
0.4
0.2
-0.2
-0.4
-0.6
-0.8
-1
0 2 4 6 8 10 12 14
When multiple curves appear on the same axis, it is good idea to create a legend to label and
distinguish them. The command legend does exactly this.
20
>>legend (‘sin(x)’ , ‘cos(x) ’)
1
sin(x)
0.8 cos(x)
0.6
0.4
0.2
-0.2
-0.4
-0.6
-0.8
-1
0 2 4 6 8 10 12 14
• There are several specialized graphics functions available in MATLAB for 2-D plots.
• The list of functions commonly used in MATLAB for plotting x-y data are given in the
following Table.
For example:
21
1
0.8
0.6
0.4
0.2
-0.2
-0.4
-0.6
-0.8
-1
0 2 4 6 8 10 12
Examples
1.Plot the graph of y=log(x), for x=0:10
>>x=1:0.1:10;
>> y=log(x);
>>plot(x,y,'c--*');
>>title('plot of log(x)');
>>xlabel('x');
>>ylabel('log(x)')
plot of log(x)
2.5
1.5
log(x)
0.5
0
1 2 3 4 5 6 7 8 9 10
x
2.Obtain the plot of the functions y= x 2, z= x 3for x=-1 to 1 on the same axis. Label the x and y
axes and create a legend indicating which graph is which.
>> x=-1:.01:1;
22
>> y=x.^2;
>> z=x.^3;
>> plot(x,y,'b-',x,z,'g-');
>>xlabel('value of x');
>> legend('x^2','x^3')
1
x2
0.8
x3
0.6
0.4
value of y and z
0.2
-0.2
-0.4
-0.6
-0.8
-1
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1
value of x
3-D plots
• MATLAB has a variety of functions for displaying and visualizing data in 3-D,either as
lines in 3-D, or as various types of surfaces.
23
• Some of commonly used functions in 3-D graphics are listed below.
command Description
plot3 Plots three-dimensional graph of the trajectory of a set of three parametric
equations x(t),
y(t), and z(t) can be obtained using plot3(x,y,z).
meshgrid If x and y are two vectors containing a range of points for the evaluation of a
function,
[X,Y] = meshgrid(x, y) returns two rectangular matrices containing the x and y
values at
each point of a two-dimensional grid.
surf Produces a three-dimensional perspective drawing. Its use is usually to draw
surfaces, as
opposed to plotting functions, although the actual tasks are quite similar. The
output of
surfwill be a shaded figure. If row vectors of length n are defined by x = r cos θ
and y =
rsin θ, with 0 ≤ θ ≤ 2π, they correspond to a circle of radius r. If r is a column
vector
equal to r = [0 1 2]’; then z = r*ones(size(x)) will be a rectangular, 3 × n, arrays
of 0’s
and 2’s, and surf(x, y, z) will produce a shaded surface bounded by three circles;
i.e., a
cone.
grid grid on adds grid lines to a two-dimensional or three-dimensional graph; grid off
removes
them
mesh(X,Y,z If X and Y are rectangular arrays containing the values of the x and y coordinates
) at each
point of a rectangular grid , and if z is the value of a function evaluated at each of
these
points, mesh(X,Y,z) will produce a three-dimensional perspective graph of the
points.
The same results can be obtained with mesh(x,y,z) can also be used.
plot3
The function plot3 is the 3-D version of plot. The command plot3(x, y, z) draws a 2-D projection
of a line in 3-D through the points whose coordinates are the elements of the vectors x, y and z.
24
For example, the command:
Generates 10 random points in 3-D space, and joins them with lines, as shown in Figure below.
0.8
0.6
0.4
0.2
0
1
1
0.8
0.5 0.6
0.4
0.2
0 0
>>[X,Y]=meshgrid(-3:0.1:3,-3:0.1:3);
>>z=3*(1-X).^2.*exp(-(X.^2)-(Y+1).^2)-10*(Y/5-X.^3-
Y.^5).*exp(-X.^2-Y.^2)-1/3*exp(-(X+1).^2-Y.^2);
>>surf(z) peaks
>>xlabel('X')
10
>>ylabel('Y')
5
>>zlabel('Z')
0
Z
>>title('peaks')
-5
-10
80
60 80
40 60
40
20 20
Y 0 0
X
Examples
(a) Using plot3 Plot the parametric space curve of
x ( t ) = t , y ( t ) = t 2 ,z ( t ) = t 3; 0 ≤ t ≤ 1.0
25
(b) Drawthesurface z = x 2- y 2; for0 ≤ x ≤ 5, 0 ≤ y ≤ 5
(c) The initial heat distribution over a steel plate is given by the function
2 2
u(x, y) = 80 y 2 e−x −0.3 y ,
Solution
(a) 1
0.6
0.2
>> plot3(x,y,z),grid
0
1
1
0.8
0.5 0.6
0.4
0.2
0 0
(b)
>> [x,y]=meshgrid(0:0.25:5);
30
>> z=x.^2-y.^2; 20
10
>> mesh(z) 0
-10
-20
-30
30
25
20
20
15
10 10
5
0 0
100
80
60
40
(c) 20
0
100
26
30
50 20
10
0 0
>> [x,y]=meshgrid(-2.1:0.15:2.1,-6:0.15:6);
>> u=80.*(y.^2).*(exp((-x.^2)-0.3.*(y.^2)));
>>surf(u)
EXERCISES
1. Use the linspace function to create a row vector called meshPoints containing exactly
1000values with values evenly spaced between -1 and 1. Do not print all 1000 values!
2. What expression will yield the value of the 95th element of meshPoints? What is this value?
Lab 3
Programming in MATLAB and Conditional statements
Objectives
27
To know the types of programs in mat lab
To have a basic understanding of Conditional Statements
if-end
if-else-end,
if-elseif-else-end
In Matlab, programs may be written and saved in files with a suffix .m called M-files. There
aretwo types of M-file programs: functions and scripts.
Function Programs
Begin by clicking on the new document icon in the top left of the Matlab window (it looks like
an empty sheet of paper). In the document window type the following:
function y = myfunc(x)
y = 2*x.^2 - 3*x + 1;
Save this file as: myfunc.minyour working directory. This file can now be used in the command
window just like any predefined Matlab function; in the command window enter:
>> x = -2:.1:2; . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Produces a vector ofx values.
> y = myfunc(x); . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Produces a vector ofy values.
>plot(x,y)
Note that the fact we used x and y in both the function program and in the command window
was just a coincidence. In fact, it is the name of the filemyfunc.mthat actually mattered, not what
anything in it was called. We could just as well have made the function
Let us see a simple example . The text below is saved in a file called log3.m and it is used to
calculate the base three logarithm of a positive number.
function [a]=log3(x)
28
%[a]=log3(x)-calculate the base 3 logarithm of x.
a= log(abs(x)./log(3));
%End of function
Using this function within MatLab to compute log3(5), we get
>> b=log3(5)
b =
1.4650
The text file can be created In variety of ways, for example using the built-in MatLab editor
through the command edit or your favorite (external)text editor (note pad or word pad in
Microsoft windows).You must make sure that the file name has the extension ”.m”!
Every MatLab function begins with a header, which consists of the following:
d, The name of the function, which must much the function file name(log3 in the above
example )and
Any statement that appears after a ”%” sign on a line is ignored by MatLab and plays the role of
comments in the subroutine.
Comments are essential when writing long functions or programs, for clarity.
Functions can have multiple inputs and/or multiple outputs. Next let’s create a function that has
1input and 3 output variables. Open a new document and type:
Save this file as mypowers.m. In the command window, we can use the results of the program to
make graphs:
> x = -1:.1:1
29
> [x2 x3 x4] = mypowers(x);
> plot(x,x,’black’,x,x2,’blue’,x,x3,’green’,x,x4,’red’)
Example 1
1. Use the Editor to create and save (in the current MATLAB directory) the function file f.m as
follows:
function y = f(x)
Script Programs
Matlab uses a second type of program that differs from a function program in several ways,
namely:
• A script program may use and change variables in the current workspace (the variables
used by the command window.)
Below is a script program that accomplishes the same thing as the function program plus the
commands in the previous section:
x2 = x.^2;
x3 = x.^3;
x4 = x.^4;
plot(x,x,’black’,x,x2,’blue’,x,x3,’green’,x,x4,’red’)
Type this program into a new document and save it as mygraphs.m. In the command window
enter:
> x = -1:.1:1;
>mygraphs
Note that the program used the variable x in its calculations, even though x was defined in the
command window, not in the program.
30
Many people use script programs for routine calculations that would require typing more than
one command in the command window. They do this because correcting mistakes is easier in a
program than in the command window.
Create the file named qroots.m in your present working directory using a text editor to solve the
quadratic equation f(x)= x 2+ 5 x +6
Solution
To execute the script M-file, simply type the name of the script file qroots at the Matlab prompt:
>>qroots
s1 =
-2
s2 =
-3
A relational operator compares two numbers by finding whether a comparison statement is true
or false.
31
A logical operator examines true/false statements and produces a result which is true or false
according to the specific operator.
MATLAB has six relational operators and three logical operators as shown in Table below.
Logical operators
Examples:
if a < b
if c >= 5
32
if a == b
if a ~= 0
if (d<h)&(x>7)
if (x~=13)l(y<0)
Conditional statements can be a part of a program written in a script file or a function file. As
shown below, for every if statement there is an end statement. The if statement is commonly
used in three structures, if-end, if-else-end, and if-elseif-else-end, which are described next.
Example1
Write a script file that demonstrates the use of the if-end statement in which:-
33
- Calculates the average of the grades.
- If the average is less than 60, a massage:‘ The student did not pass the course’. is
printed.
disp(ave_grade)
ifave_grade< 60
end
Saving the script file in the previous slide as average.m and executing in the Command Window:
>>average
Enter (as a vector) the scores of the three tests [78 61 85]
74.6667
>>average
Enter (as a vector) the scores of the three tests [60 38 55]
51
Example 2
34
A worker is paid according to his hourly wage up to 40 hours, and 50% more for overtime. Write
a program in a script file that calculates the pay to a worker. The program asks the user to enter
the number of hours and the hourly wage. The program then displays the pay.
Solution
The program in a script file is shown below. The program first calculates the pay by multiplying
the number of hours by the hourly wage. Then an if statement checks whether the number of
hours is greater than 40. If yes, the next line is executed and the extra pay for the hours above 40
is added. If not, the program skips to the end.
>>workerspay
>>workerspay
35
2. The if-else-endStructure
This structure provides a means for choosing one group of commands, out of a possible two
groups, for execution. The first line is an if statement with a conditional expression. If the
conditional expression is true, the program executes group 1 of commands between the if and the
else statements and then skips to the end.
If the conditional expression is false, the program skips to the else, and then executes group 2 of
commands between the else and the end.
Example
Write a script file that demonstrates the use of the if-else-end statement in which :
If the average is less than 60, a massage: ‘The student did not pass the course.’ is printed.
We can edit the previous script by simply adding else statement as follow
36
score = input('Enter (as a vector) the scores of the three
tests ');
ave_grade = (score(1) + score(2) + score(3))/3;
disp('The average grade is:')
disp(ave_grade)
ifave_grade< 60
disp('The student did not pass the course.')
else
disp('The student passed the course.')
End
Executing the script file in the command window we will find the following
>>average
Enter (as a vector) the scores of the three tests [65 80 83]
76
>>average
Enter (as a vector) the scores of the three tests [60 40 55]
51.6667
This structure includes two conditional statements (if and elseif) which make it possible to select
one out of three groups of commands for execution.
The first line is an if statement with a conditional expression. If the conditional expression is
true, the program executes group 1 of commands between the if and the elseif statement and then
skips to the end. If the conditional expression in the if statement is false, the program skips to the
elseif statement.
If the conditional expression in the elseif statement is true the program executes group 2 of
commands between the elseif and the else and then skips to the end.
37
If the conditional expression in the elseif statement is false the program skips to the else and
executes group 3 of commands between the else and the end.
Example
Write a script file that demonstrates the use of the if-elseif-else-end statement.
The program calculates the tip in a restaurant according to the amount of the bill.
38
else
tip = bill*0.2;
end
disp('The tip is (in dollars):')
disp(tip)
Saving the script file as dollar.m, let us see some demonstration of the program.
>>dollar
2.7000
>>dollar
1.8000
>>dollar
20
3.4 Loops
A loop is another method to alter the flow of a computer program.In a loop, the execution of a
command, or a group of commands, is repeated several times consecutively.
39
for -end Loops
In for-end loops the execution of a command, or a group of commands, is repeated a
predetermined number of times.
For k= 1:3:10
x = k^2
End
Saving the file as exa.mWhen this program is executed in the command window, the loop is
executed four times.
>>exa
x =
x =
16
x =
49
x =
100
EXAMPLE 1:
Write a for loop to compute the sum of the squares of all integers from 2 to 20:
22 +32 +4 2+……..+202.
40
Solution
for n = 2:20
end
When this loop is entered into the command window, the only output one sees is:
Sum = 2869
EXAMPLE 2:
Suppose that $1000.00 is left to sit in a bank account that pays 8% interest per year, compounded
annually. What is the account balance after 30 years?
Solution
Balance = (1.08)*Balance;
end
Balance = 10062.66
While Loops
The while loop is used when the looping process terminates because a specified condition is
satisfied, and thus the number of passes Is not known in advance.
statements
end
41
MatLabfirsts tests the truth of the logical expression.A loop variable must be included in the
logical expression.
For a while loop to function properly, the following two conditions must occur:
o The loop variable must have a value before the while statement is executed.
The statements are executed once during each pass, using the current value of the loop
variable.The looping continues until the logical expression is false.
x = 5;
while x < 25
disp (x)
x = 2*x-1;
end
The loop variable x is initially assigned the value 5, and it has this value until the statement x =
2*x –1 is encountered the first time. The value then changes to 9.
Before each pass through the loop, x is checked to see whether its value is less than 25.
If so, the pass is made. If not, the loop is skipped and the program continues to execute any
statements following the end statement.
A principal application of while loops is,when we want the loop to continue as along as a certain
statement is true. Such a task is often more difficult to do with a for loop. For example:
x = 1;
while x ~= 5
disp (x)
42
x = x + 1;
end
The statements between the while and the end are executed once during each pass, using the
current value of the loop variable x.
EXERCISE
Suppose, starting at his 25th birthday, Michael deposits $5000 at the beginning of everyyear into
a retirement annuity that pays 9% interest per year, compounded annually He wants to
retirewhen his annuity first reaches or exceeds $1 million. In how many years will he be able to
retire with thisplan?
Solution
Balance = 5000; %initialize Balance
year = 0; %initialize year counter
while Balance < 1000000
Balance = (1.09)*Balance + 5000;
year = year + 1; %update year counter
end
year, Balance %This will display the year and the
corresponding balance that first broke $1 million.
When this code is entered, the following output results: year = 34.00, Balance = 1078553.77
Thus, Michael will be able to retire at age 59, with a nest egg of $1,078,553.77.
Lab 4
Bisection Method
Objective
43
Producing an M-file for bisection method for finding the root of a non-linear equation in
Mat Lab
Bisection Method
An M-file to implement bisection is displayed in the following script. It is passed the function
(func) along with lower (xl) and upper (xu) guesses. In addition, an optional stopping criterion
(es) and maximum iterations (maxit) can be entered.
The function first checks whether there are sufficient arguments and if the initial guesses bracket
a sign change. If not, an error message is displayed and the function is terminated.
It also assigns default values if maxitandesare not supplied. Then a while...break loop is
employed to implement the bisection algorithm until the approximate error falls below esor the
iterations exceed maxit.
44
END Bisect
Example
(a) Use bisection method to find the first root of the function f (x) = -12-21x+18 x 2−2.75 x 3.
45
(use initial guesses of xl = −1 and xu = 0 and a stopping criterion of 1%).
Solution
>>fx=@(x)-12-21.*x+18.*x^2-2.75.*x^3;
root =
-0.4147
fx =
5.2128e-004
ea =
0.0074
iter =
15
(b) Locate the first nontrivial root of sin(x) = x 2 where x is in radians. Use a graphical technique
and bisection with the initial interval from 0.5 to 1. Perform the computation until εais less than
εs= 2%.
Solution
>>fx=@(x)x^2-sin(x);
>>[root fxeaiter]=bisect(fx,0.5,1,0.02)
root =
0.8768
fx =
1.1678e-004
ea =
0.0139
iter =
12
(c)determine the real roots of f(x)=-2+7x-5x2+6x3:using bisection to locate the lowest root.
Employ initial guessesofxl=0 and xu=1 and iterate until the estimated error eafalls below a level of
es=10%.
46
Solution
>>fx=@(x)-2+7*x-5*x^2+6*x^3;
>> [root fxeaiter]=bisect(fx,0,1,0.1)
root =
0.3333
fx =
-4.6115e-004
ea =
0.0733
iter =
12
Solution
>>fx=@(x)-26+82.3*x-88*x^2+45.4*x^3-9*x^4+0.65*x^5;
root =
0.5796
fx =
0.0051
ea =
0.0842
iter =
10
EXERCISES
47
3. Find the root of x-e(-x) = 0 using a graphical technique and bisection method within the
interval [0,1] after 8 iterations.
4. Determine the positive real root of ln(x^2) = 0.7
(a)Graphically,
(b) Using 3 iterations of the bisection method, with initial guesses of xl = 0.5 and xu = 2,
Lab 5
Newton-Raphson Method
Objective
48
Producing an M-file for Newton-Raphson Method
Newton-Raphson Method
Perhaps the most widely used of all root-locating formulas is the Newton-Raphson method
(Fig.A). If the initial guess at the root is xi , a tangent can be extended from the point
[xi , f (xi )]. The point where this tangent crosses the x axis usually represents an
improvedestimate of the root.
The Newton-Raphson method can be derived on the basis of this geometrical interpretation.
As in Fig. A, the first derivative at x is equivalent to the slope:
f (x i)−0
f’(xi)= x i−x i+1
Fig .A. Graphical depiction of the Newton-Raphson method. A tangent to the function of xi [that
is,f‘(x)] is extrapolated down to the x axis to provide an estimate of the root at xi+1.
49
An algorithm for the Newton-Raphson method can be easily developed .Note thatthe program
must have access to the function (func) and its first derivative (dfunc). These can be simply
accomplished by the inclusion of user-defined functions to compute these quantities.
Alternatively, as in the algorithm in the following script file, they can be passed to the function
as arguments.
END IF
END DO
Newtraph= xr
END Newtraph
function[root,ea,iter]=newtraph(func,dfunc,xr,es,maxit,varargin)
50
% newtraph: Newton-Raphson root location zeroes
% [root,ea,iter]=newtraph(func,dfunc,xr,es,maxit,p1,p2,...):
% uses Newton-Raphson method to find the root of func
% input:
% func = name of function
% dfunc = name of derivative of function
% xr = initial guess
% es = desired relative error (default = 0.0001%)
% maxit = maximum allowable iterations (default = 50)
% p1,p2,... = additional parameters used by function
% output:
% root = real root
% ea = approximate relative error (%)
% iter = number of iterations
ifnargin<3,error('at least 3 input arguments required'),end
ifnargin<4|isempty(es),es=0.0001;end
ifnargin<5|isempty(maxit),maxit=50;end
iter = 0;
while (1)
xrold = xr;
xr = xr - func(xr)/dfunc(xr);
iter = iter + 1;
ifxr ~= 0, ea = abs((xr - xrold)/xr) * 100; end
ifea<= es | iter>= maxit, break, end
end
root = xr;
EXAMPLES
1.Determine the positive root of f (x) = x10 − 1 using the Newton- Raphson method and an initial
guess of x = 0.5.
51
Solution
>>fx=@(x)x^10-1;
>>dfx=@(x)10*x^9;
root =
ea =
2.5776e-007
iter =
43
But if we need only the root we can use the following format:
>>fx=@(x)x^10-1;
>>dfx=@(x)10*x^9;
>>newtraph(fx,dfx,0.5)
ans =
1
2. Use the Newton- Raphson method to determine a root of f (x) = −0.9x2+1.7x + 2.5
usingx0= 5. Perform the computation until εais less than εs= 0.01%.
Solution
>>fx=@(x)-0.9*x^2+1.7*x+2.5;
>>dfx=@(x)-1.8*x+1.7;
root =
52
2.8601
ea =
9.9139e-006
iter =
3.Determine the highest real root of f (x) = x3− 6x2+11x − 6.1Using the Newton-Raphson method
(three iterations,xi= 3.5).
>>fx=@(x)x^3-6*x^2+11*x-6.1;
>>dfx=@(x)3*x^2-12*x;
root =
2.3552
ea =
1.5903
EXERCISE
1. Approximate the only solution to the equation x= cos(x) with initial guess x=1
2. f(x) = x-2+lnx has a root near x =1.5. Use newton-raphson method to obtain a better
method.
Lab 6
Linear Least Square Regression
Objective
To use linear least square regression M-file for curve fitting
53
6.1 Curve Fitting and Interpolation
Discrete data sets or tables of the form
x1 x2 … x3 xn
y1 y2 … y3 yn
are commonly involved in technical calculations. The source of the data may be
experimentalobservations or numerical computations. There is a distinction betweeninterpolation
and curve fitting. In interpolationweconstruct a curve through the datapoints. Indoing so,wemake
the implicit assumption that the datapoints are accurateand distinct.Curve fitting is applied to
data that contain scatter (noise), usuallydue tomeasurement errors. Herewe want tofind a smooth
curve that approximates the datain some sense. Thus the curve does not have to hit the data
points. This differencebetween interpolation and curve fitting is illustrated in Figure below.
54
The slope of the line indicates how much y changes for a unit change in x.r2 (the square of the
correlation) is the fraction of the variation in the values of y that is explained by the least squares
regression on x.
An algorithm for linear regression can be easily developed as shown in the following M-File.The
required summations are readily computed with MATLAB’s sum function. The routine displays
the intercept and slope, the coefficient of determination, and a plot of the best-fit line along with
the measurements.
Pseudocode for Linear regression
SUB Regress(x, y, n, al, a0, syx, r2)
sumx=0: sumxy= 0: st=0
sumy= 0: sumx2 = 0: sr=0
DOFOR i= 1, n
sumx=sumx+ xi
sumy=sumy+yi
sumxy= sumxy+xi*yi
sumx2 = sumx2 +xi*xi
END DO
xm= sumx/n
ym=sumy/n
a1 =(n*sumxy- sumx*sumy)/(n*sumx2 - sumx*sumx)
a0 =ym-a1*xm
DOFOR i= 1, n
st=st+(yi-ym)2
sr=sr+ (yi-a1*xi -a0)2
END DO
syx= (sr/(n -2))0.5
r2 = (st-sr)/st
END Regress
55
% [a, r2] = linregr(x,y): Least squares fit of straight
% line to data by solving the normal equations
% input:
% x = independent variable
% y = dependent variable
% output:
% a = vector of slope, a(1), and intercept, a(2)
% r2 = coefficient of determination
n = length(x);
if length(y)~=n, error('x and y must be same length'); end
x = x(:); y = y(:); % convert to columnvectors
sx = sum(x); sy = sum(y);
sx2 = sum(x.*x); sxy = sum(x.*y); sy2 = sum(y.*y);
a(1) = (n*sxy-sx*sy)/(n*sx2—sx^2);
a(2) = sy/n—a(1)*sx/n;
r2 = ((n*sxy—sx*sy)/sqrt(n*sx2—sx^2)/sqrt(n*sy2—sy^2))^2;
% create plot of data and best fit line
xp = linspace(min(x),max(x),2);
yp = a(1)*xp+a(2);
plot(x,y,'o',xp,yp)
gridon
Example
1, Fit a straight line to the values in table below.
xi 10 20 30 40 50 60 70 80
1400
1200
1000
800
Solution 600
400
56
200
-200
10 20 30 40 50 60 70 80
>>x=[10 20 30 40 50 60 70 80];
x 0 2 4 6 9 11 12 15 17 19
y 5 6 7 6 9 8 8 10 12 12
Along with the slope and intercept, Plot the data and the regression line.
Solution
57
12
11
10
4
0 2 4 6 8 10 12 14 16 18 20
EXERCISE
Consider the following data on 12 trees. The age of the tree and their size is given bellow. Fit the
given data to know the relationship between the size and age of the tree.
58
Lab7
Polynomial Interpolation
Objectives
To Determining Polynomial Coefficients using MATLAB functions: polyfit and polyval
Producing M-files for new Newton’sinterpolating polynomials
Producing M-files for new Lagrangeinterpolating polynomials
Polynomial Interpolation
Interpolation is a method of constructing new data points within the range of a discrete set of
known data points. We will frequently have occasion to estimate intermediate values between
precise data points.The most common method used for this purpose is polynomial interpolation.
General formula for an (n−1)th-order polynomial can be written as:
f (x) = a1 + a2x + a3x2 + ・・・ + anxn−1
For n data points, there is one and only one polynomial of order (n − 1) that passes through all
the points.For example, there is only one straight line (i.e., a first-order polynomial) that
connects two points.Similarly, only one parabola connects a set of three points.
Examples of interpolating polynomials:
(a) first-order (linear) connecting two points,
(b) second-order (quadratic or parabolic) connecting three points, and
(c) third-order (cubic)connecting four points.
59
8.1 Determining Polynomial Coefficients using MATLAB functions: polyfit and
polyval
For the case where the number of data points equals the number of coefficients, polyfit performs
interpolation.That is, it returns the coefficients of the polynomial that pass directly through the
data points.For example, it can be used to determine the coefficients of the parabola that passes
through the last three density values from the following Table.
>>format long
>> T = [300 400 500];
>> D= [0.616 0.525 0.457];
>> p = polyfit(T,D,2)
p=
0.000001150000000 -0.001715000000000 1.026999999999995
We can then use the polyval function to perform an interpolation as follow:
>> I= polyval(p,350)
I=
0.56762500000000
60
61
end
% use the finite divided differences to interpolate
xt = 1;
yint = b(1,1);
for j = 1:n-1
xt = xt*(xx-x(j));
yint = yint+b(1,j+1)*xt;
end
Example
1. Employ a second-order Newton polynomial to estimate ln 2 using the points ln 1 = 0 , ln
4 =1.386294 ,ln 6 = 1.791759 and ln 5 =1.609438
Solution
>>format long
>>x = [1 4 6 5]';
>>y = log(x);
>>Newtint(x,y,2)
ans =
0.628768578908414
where the L’s are the weighting coefficients and represented as:
n
x−xj
∏ xi−xj
j=1
j≠1
Where n= the number of data points and -designates the ‘’product of’’.
62
An M-file to implement Lagrange interpolation.
functionyint = Lagrange(x,y,xx)
% Lagrange: Lagrange interpolating polynomial
% yint = Lagrange(x,y,xx): Uses an (n - 1)-order
% Lagrange interpolating polynomial based on n data points
% to determine a value of the dependent variable (yint) at
% a given value of the independent variable, xx.
% input:
% x = independent variable
% y = dependent variable
% xx = value of independent variable at which the
% interpolation is calculated
% output:
% yint = interpolated value of dependent variable
n = length(x);
if length(y)~=n, error('x and y must be same length'); end
s = 0;
fori = 1:n
product = y(i);
for j = 1:n
ifi ~= j
product = product*(xx-x(j))/(x(i)-x(j));
end
end
s = s+product;
end
yint = s;
Example
Predict the density of air at 1 atm pressure at a temperature of 15 °C based on the first four
values from Table below.
63
Solution
>>format long
>>density = Lagrange(T,d,15)
density =
1.221128472222222
EXERCISE
x 0 1 2 5.5 11 13 16 18
2. The following data for the density of nitrogen gas versus temperature come from a table that
was measured with high precision. Use fifth-order polynomial to estimate the density at a
temperature of 330 K.
T, K 200 250 300 350 400 450
64
Lab 8
Solutions of Systems of Linear Algebraic Equation
Objective
Matrices provide a concise notation for representing simultaneous linear equations. For example,
a 3 × 3 set of linear equations,
a11x1 + a12x2 + a13x3 = b1
a21x1 + a22x2 + a23x3 = b2
a31x1 + a32x2 + a33x3 = b3
Can be expressed as:
[A]{x} = {b}
Where:
[A] is the matrix of coefficients:
{b} is the column vector of constants:
{b}T = [b1 b2b3]
And {x} is the column vector of unknowns:
65
{x}T=[ x1x2x3]
The first phase is designed to reduce the set of equations to an upper triangular system. The
initial step will be to eliminate the first unknown x1 from the second through the nth equations.
To do this, multiply Eq.1 by a21/a11 to give:
The procedure is then repeated for the remaining equations.Perform a similar elimination for the
remaining equations to yield
66
% x = GaussNaive(A,b): Gauss elimination without
pivoting.
% input:
% A = coefficient matrix
% b = right hand side vector
% output:
% x = solution vector
[m,n] = size(A);
if m~=n, error('Matrix A must be square'); end
nb = n+1;
Aug = [A b];
% forward elimination
for k = 1:n-1
fori = k+1:n
factor = Aug(i,k)/Aug(k,k);
Aug(i,k:nb) = Aug(i,k:nb)-factor*Aug(k,k:nb);
end
end
% back substitution
x = zeros(n,1);
x(n) = Aug(n,nb)/Aug(n,n);
fori = n-1:-1:1
x(i) = (Aug(i,nb)-Aug(i,i+1:n)*x(i+1:n))/Aug(i,i);
end
Example
Use Gauss elimination to solve
Solution
67
>>b=[7.85;-19.3;71.4];
>>x=GaussNaive(A,b)
x =
3.0000
-2.5000
7.0000
8.2 LU Factorization
MATLAB has a built-in function lu that generates the LU factorization. It has the general syntax:
[L,U] = lu(X)
WhereL and U are the lower triangular and upper triangular matrices, respectively.
Example
Use MATLAB to compute the LU factorization and find the solution for the same linear system
analyzed in the previous example.
Solution
68
L =
1.0000 0 0
0.0333 1.0000 0
U =
0 7.0033 -0.2933
0 0 10.0120
>> d = L\b
d =
7.8500
-19.5617
70.0843
>> x = U\d
x =
3.0000
-2.5000
7.0000
69
8.3 Cholesky Factorization
MATLAB has a built-in function chol that generates the Cholesky factorization. It has the
general syntax,
U = chol(X)
whereU is an upper triangular matrix so that U'*U = X. The following example shows how it can
be employed to generate both the factorization and a solution for the matrix.
Example:Compute the Cholesky factorization for the symmetric matrix given below using
MatLab.
6 15 55
[
[A]= 15 55 225
55 225 979 ]
Also obtain a solution for a right-hand-side vector that is the sum of the rows of [A]. Notethat for
this case, the answer will be a vector of ones.
Solution
The matrix is entered in standard fashion as
>> A = [6 15 55; 15 55 225; 55 225 979];
A right-hand-side vector that is the sum of the rows of [A] can be generated as
>> U = chol(A)
U=
2.4495 6.1237 22.4537
0 4.1833 20.9165
0 0 6.1101
70
We can test that this is correct by computing the original matrix as
>> U'*U
ans =
6.0000 15.0000 55.0000
15.0000 55.0000 225.0000
55.0000 225.0000 979.0000
EXERCISE
1. Determine the LU factorization without pivoting using Mat Lab for the following matrix
8 5 1
[ ]
[A] = 3 7 4
2 3 9
71
9 0 0
[
[A] = 0 25 0
0 0 16 ]
Lab 9
Newton-Cotes closed integration formulas
Objectives
What Is Integration?
According to the dictionary definition, “to integrate means “to bring together, as parts, into a
whole; to unite; to indicate the total amount. . . .” “Mathematically, definite integration is
represented by:
I=∫ fx dx
a
which stands for the integral of the function f (x) with respect to the independent variable x,
evaluated between the limits x = a to x = b.
As suggested by the dictionary definition, the meaning of the above equation is the total value,
or summation, of f(x) dx over the range x = a to b. In fact, the symbol ∫is actually a stylized
capital S that is intended to signify the close connection between integration and summation.
72
Geometrically, the trapezoidal rule is equivalent to approximating the area of thetrapezoid under
the straight line connecting f (a) and f (b) in the following Figure.
Recall from geometrythat the formula for computing the area of a trapezoid is the height times
the average of the bases. In our case, the concept is the same but the trapezoid is on its side.
Therefore, the integral estimate can be represented as:
Or,
where, for the trapezoidal rule, the average height is the average of the function values at the end
points, or [ f (a) + f (b)]/2.
One way to improve the accuracy of the trapezoidal rule is to divide the integration interval
froma to b into a number of segments and apply the method to each segment (see Figure below).
The areas of individual segments can then be added to yield the integral for the entire interval.
The resulting equations are called composite, or multiple-segment, integration formulas.
73
The figure shows the general format and nomenclature we will use to characterize composite
integrals. There are n + 1 equally spaced base points (x0, x1, x2, . . . ,xn). Consequently, there are
n segments of equal width:
b−a
h= n ……………. Eqn.1
If a and b are designated as x0 and xn, respectively, the total integral can be represented
As:
x1 x2 xn
Eqn.2
or grouping terms:
Eqn.3
or, using Eq. (1) to express Eq. (3) in the general form of Eqn.a above.
74
Eqn. 4
A simple algorithm to implement the composite trapezoidal rule can be written as in the
following M-file. The function to be integrated is passed into the M-file along with the limits of
integration and the number of segments. A loop is then employed to generate the integral
following Eqn 4.
75
Example
Estimate the integral of the function f (x) = 0.2 + 25x − 200x2 + 675x3 − 900x4 + 400x5 from
Solution
fx=@(x)0.2+25*x-200*x.^2+675*x.^3-900*x.^4+400*x.^5;
>> I = trap(fx,0,0.8,10)
I =
1.6150
Eqn.5
where hi = the width of segment i. Note that this was the same approach used for the composite
trapezoidal rule. The only difference between Eqs. (2) and (5) is that the h’sin the former are
constant.
A simple algorithm to implement the trapezoidal rule for unequally spaced data can be written as
in the following M-file. Two vectors, x and y, holding the independent and dependent variables
are passed into the M-file. Two error traps are included to ensure that (a) the two vectors are of
the same length and (b) the x’s are in ascending order. A loop is employed to generate the
integral. Notice that the subscripts are modified from those of Eq. (5) to account for the fact that
MATLAB does not allow zero subscripts in arrays.
76
M-file to implement the trapezoidal rule for unequally spaced data
function I = trapuneq(x,y)
% trapuneq: unequal spaced trapezoidal rule quadrature
% I = trapuneq(x,y):
% Applies the trapezoidal rule to determine the integral
% for n data points (x, y) where x and y must be of the
% same length and x must be monotonically ascending
% input:
% x = vector of independent variables
% y = vector of dependent variables
% output:
% I = integral estimate
ifnargin<2,error('at least 2 input arguments required'),end
if any(diff(x)<0),error('x not monotonically ascending'),end
n = length(x);
if length(y)~=n,error('x and y must be same length'); end
s = 0;
for k = 1:n-1
s = s + (x(k+1)-x(k))*(y(k)+y(k+1))/2;
end
I = s;
Example: The information in Table below was generated using the same polynomial employed
in the previous example. Use Mat Lab to determine the integral for thesedata.Recall that the
correct answer is 1.640533.
77
Solution
MATLAB has a built-in function that evaluates integrals for data in the same fashion as the
z = trapz(x, y)
where the two vectors, x and y, hold the independent and dependent variables, respectively.
Here is a simple MATLAB session that uses this function to integrate the data from the above
table:
>> y = 0.2+25*x-200*x.^2+675*x.^3-900*x.^4+400*x.^5;
>>trapz(x,y)
ans =
1.5948
In addition, MATLAB has another function, cumtrapz, that computes the cumulativeintegral. A
simple representation of its syntax is
z = cumtrapz(x, y)
where the two vectors, x and y, hold the independent and dependent variables, respectively, and
z = a vector whose elements z(k) hold the integral from x(1) to x(k).
78
EXERCISE
1. Integrate the function f(x) = 1/x from [e,2e] using trapezoidal rule.
2. Integrate the function f(x)=ex2in the interval [o,1]
3. The function
f (x) = e−x
79
Lab 10
Romberg integration
Objective
Romberg Integration
The M-file for Romberg integration can be developed as shown below. By using loops, this
algorithm implements the method in an efficient manner. Note that the function uses another
function trap to implement the composite trapezoidal rule evaluations.
function [q,ea,iter]=romberg(func,a,b,es,maxit,varargin)
% romberg: Romberg integration quadrature
% q = romberg(func,a,b,es,maxit,p1,p2,...):
% Romberg integration.
% input:
% func = name of function to be integrated
% a, b = integration limits
% es = desired relative error (default = 0.000001%)
% maxit = maximum allowable iterations (default = 30)
% pl,p2,... = additional parameters used by func
% output:
% q = integral estimate
% ea = approximate relative error (%)
% iter = number of iterations
ifnargin<3,error('at least 3 input arguments required'),end
ifnargin<4||isempty(es), es=0.000001;end
80
ifnargin<5||isempty(maxit), maxit=50;end
n = 1;
I(1,1) = trap(func,a,b,n,varargin{:});
iter = 0;
whileiter<maxit
iter = iter+1;
n = 2^iter;
I(iter+1,1) = trap(func,a,b,n,varargin{:});
for k = 2:iter+1
j = 2+iter-k;
I(j,k) = (4^(k-1)*I(j+1,k-1)-I(j,k-1))/(4^(k-1)-1);
end
ea = abs((I(1,iter+1)-I(2,iter))/I(1,iter+1))*100;
ifea<=es, break; end
end
q = I(1,iter+1);
Example: Use Romberg integration to evaluate the integral of f (x) =0.2 + 25x − 200x2+ 675x3−
900x4+ 400x5 from a = 0 to b = 0.8.
Solution
>> f=@(x) 0.2+25*x-200*x^2+675*x^3-900*x^4+400*x^5;
>>romberg(f,0,0.8)
ans =
1.6405
MATLAB has two functions, both based on algorithms developed by Gander and
Gautschi(2000), for implementing adaptive quadrature:
quad. This function uses adaptive Simpson quadrature. It may be more efficient for low
accuracies or nonsmooth functions.
81
quadl. This function uses what is called Lobatto quadrature. It may be more efficient for
high accuracies and smooth functions.
The following function syntax for the quad function is the same for the quadlfunction:
where fun is the function to be integrated, a and b = the integration bounds, tol= the desired
absolute error tolerance (default = 10−6), trace is a variable that when set to a nonzero value
causes additional computational detail to be displayed, and p1, p2, . . .are parameters that you
want to pass to fun. It should be noted that array operators.*,./ and .^ should be used in the
definition of fun. In addition, pass empty matrices for tolor trace to use the default values.
Solution
First, let’s evaluate the integral in the simplest way possible, using the built-in version of humps
along with the default tolerance:
>>format long
>>quad(@humps,0,1)
ans =
29.85832612842764
function y = myhumps(x,q,r,s)
y = 1./((x-q).^2 + 0.01) + 1./((x-r).^2+0.04) - s;
Then, we can integrate it with an error tolerance of 10−4 as in
>>quad(@myhumps,0,1,le-4,[],0.3,0.9,6)
ans =
29.85812133214492
Notice that because we used a larger tolerance, the result is now only accurate to five
significantdigits. However, although it would not be apparent from a single application, fewer
function evaluations were made and, hence, the computation executes faster.
EXERCISE
1. Evaluate the following integral using (a) Romberg integration (εs = 0.5%), (b) MATLAB
quad function:
8
4 3 2
I =∫ −0.055 x + 0.86 x −4.2 x +6.3 x +2 dx
0
2. Evaluate the following integral with (a) Romberg integration (εs = 0.5%), (b) MATLAB
quad and quadl functions:
3
2x
I = ∫ x e dx
0
83
REFERENCES
84
PART-II
85
Contents
INTRODUCTION
LAB SESSION 90
Getting started with AutoCAD.................................................................................................................91
1.1 Starting Autocad.................................................................................................................................91
1.2The Auto Cad Interface.......................................................................................................................91
1.2.1 Changing the Workspace.............................................................................................................92
1.2.2 Auto CAD Interface Elements.....................................................................................................93
1.3 Opening a Drawing, new drawing, save a drawing and exiting Auto Cad........................................98
1.3.1 Opening a drawing.......................................................................................................................98
1.3.2 New Drawings.............................................................................................................................98
1.3.3 Saving Drawings..........................................................................................................................99
1.3.4 Exiting AutoCAD......................................................................................................................100
1.4 Setting the drawing units limits........................................................................................................100
1.5 Basic Draw Commands....................................................................................................................101
Lab Exercise 1: 105
LAB SESSION 2
Basic Draw Command Continued 107
2.1 Construction Line.............................................................................................................................107
2.2 Polyline Command...........................................................................................................................109
2.3 Drawing Rectangles..........................................................................................................................113
2.4 Drawing Polygons............................................................................................................................116
2.5 Drawing Circles................................................................................................................................117
2.6 Drawing Arcs....................................................................................................................................119
2.7 Splines..............................................................................................................................................120
2.8 Ellipses.............................................................................................................................................121
Lab Exercise 2: 124
LAB SESSION 3
Modify/Editing commands 127
3.1 Editing Commands...........................................................................................................................127
86
3.1.1 Copying and Moving Objects....................................................................................................128
3.1.2 Resizing commands...................................................................................................................137
Lab Exercise 3 147
LAB SESSION 4
Blocks,Hatching, Region and Text 151
4.1 Blocks...............................................................................................................................................151
4.2 Hatching...........................................................................................................................................154
4.3 Regions.............................................................................................................................................156
4.4 Text...................................................................................................................................................157
Lab Exercise 4 161
LAB SESSION 5
Layers Dimensioning and Change Properties 164
5.1 Layers...............................................................................................................................................164
5.2 DIMENSIONING.............................................................................................................................167
5.3 Object Properties Manager...............................................................................................................175
Lab Exercise 5 177
LAB SESSION 6
Orthographic Projection, Sectionning and Isometric Drawing 180
6.1 Orthographic projection....................................................................................................................180
6.2 Sectional views.................................................................................................................................183
6.3 Isometric Drawings..........................................................................................................................186
Lab Exercise 6 191
LAB SESSION 7
3-Dimensional Drawings 200
7.1Introduction:......................................................................................................................................200
7.23D Modeling work space...................................................................................................................200
7.3Solid editing tools..............................................................................................................................200
Poly solid tool.....................................................................................................................................201
The Extrude tool.................................................................................................................................205
Revolve tool........................................................................................................................................207
Box tool ...........................................................................................................................................209
87
Cone tool.............................................................................................................................................210
Cylinder tool.......................................................................................................................................211
Sphere Tool.........................................................................................................................................211
Torus tool............................................................................................................................................211
Wedge tool..........................................................................................................................................211
Sweep tool...........................................................................................................................................215
Loft tool..............................................................................................................................................216
Lab Exercise 7 218
LAB SESSION 8
View Ports and Blocks 223
8.1 View Ports........................................................................................................................................223
8.2 Creating 3D Model Libraries............................................................................................................231
Lab Exercise 8 236
LAB SESSION 9
Solid Editing Tools 238
9.1 3D Array Tool..................................................................................................................................238
9.2 3D Mirror Tool.................................................................................................................................240
9.3 3D Rotate Tool.................................................................................................................................243
9.4 Slice Tool..........................................................................................................................................244
9.5 Section Tool......................................................................................................................................245
9.6 Helix Tool.........................................................................................................................................247
Lab exercise 9 249
LAB SESSION 10
3D Modeling Template, Rendering and Light effect.............................................................................252
10.1 setting up a New 3D Template.......................................................................................................252
10.2 Pallets.............................................................................................................................................255
10.3 Applying Materials.........................................................................................................................258
10.4Render tools and dialogs.................................................................................................................260
The Lights Tools.....................................................................................................................................261
Lab exercise 10 262
LAB SESSION 11
88
Solid Editing Tools 265
Extrude face Tool...................................................................................................................................265
Move Face Tool......................................................................................................................................267
Offset Face Tool.....................................................................................................................................270
Tapper Face Tool....................................................................................................................................270
Copy Face Tool......................................................................................................................................270
Color Face Tool......................................................................................................................................271
Lab Exercise 11 273
LAB SESSION 12
Printing and Plotting 276
Creating Layout......................................................................................................................................276
Layout Setting........................................................................................................................................277
Lab Exercise 12 282
References 283
89
INTRODUCTION
Auto CAD is an acronym for Automated Computer Aided Design/Drafting. Cad allows you to
accomplish Design and Drafting activities using Computer. Cad is a tool that can be used:-
To make rough idea drawings, also it is more suited to creating accurate finish drawing
and rendering
To create a two dimensional or three dimensional computer model of the product or
system for further analysis and testing by other computer programs.
In this lab manual an attempt is made to include all the basic AutoCAD tools that are necessary
for the students to know at this stage. It is also tried to put step by step execution of each
examples .there are plenty of exercises at the end of each lab session in order to help this manual
user to practice the concepts explained theoretically in each lab session.
This lab manual is expected to enable the students (all the manual users) to understand the
application of AutoCAD in drafting different Engineering drawings (mechanical Engineering
drawings) both in 2D and 3D. Though most of the examples and exercises used in this manual
focused on mechanical engineering area, the concepts can be extend to drafting different
drawings for different engineering fields and to understand all the basics of Auto CAD.
90
Lab Session 1
91
Fig 1.1 AutoCAD 2009 Interface
92
1.2.2 AutoCAD Interface Elements
The workspace in AutoCAD is divided into 2 distinct areas. The drawing area covers most of the
screen and toolbars are attached above and below the drawing area. They include:
1. AutoCAD drawing area:This is where you will draw your AutoCAD objects.
2. Application button:The large, red A at the top, left-hand corner of the screen is the
application button. AutoCAD will show you the AutoCAD menu. This is where we can
access tools related to applications, such as saving files, printing files and to exiting the
program.
93
3. Quick-Access Toolbar: This toolbar sits next to the application button and contains
common commands like "Save" and "Open."
4. Auto CAD Ribbon:Located below the quick-access toolbar, the ribbon is comprised of a
series of tabs (e.g., "Home," "Insert," "Annotate," "View," etc.) that contain groups of
standard commands and tools. This is where you can access AutoCAD tools and settings.
94
5. Ribbon Tabs:AutoCAD Ribbon has several tabs. Each tab holds AutoCAD tools based on
your drawing task. For example, we can use drawing tools and modify tools in home tab.
But when we need to add text and dimensions, we need to open the Annotate tab. When
we need to insert blocks, we need to move to insert tab.
6. Ribbon Panel:In each tab have several panels. These panels have similar AutoCAD tools
inside them.
95
7. Command Line:We can activate tools and change the tool settings by typing in command
line. Command line is also providing information what you should do next.This is where
the software communicates with you.
8. Drafting Settings:This command provides some of the drawing aids to create the drawing
at a faster pace.
96
Grid (F7)
The grid command displays a dot grid with in the current view ports and drawing limits. The grid
command allows you to set your X,Y values and visibility. The grid is used only for reference
and will not show up within a hard copy plot. The grid and snap share the same base point and
rotate .Their spacing is often the same but it can be set to different values. To set up:
97
1.3 Opening a Drawing, new drawing, save a drawing and exiting AutoCad
2. Press CTRL + O. or
Command: OPEN
5 Press ENTER
1.3.2New Drawings
2. Press CTRL + N or
Command: NEW
5. Choose one of the options for creating a new drawing and Click the OK button.
98
Fig 1.11 The select template dialog box
SAVE and SAVE AS:Saves the most recent changes to a drawing. The first time an
unnameddrawing is saved the “Save As” dialog box appears. AutoCAD saves itsdrawings as
files with extensions ending in .DWG.
1. Choose File, Save or Saveas. Or
2. Type SAVE or SAVEAS at the command prompt.
Command: SAVE or SAVEAS
3. Press ENTER
4. Type a new drawing name or keep the existing drawing name.
5. Click the OK button
QUICK SAVE: The QSAVE command is equivalent to clicking Save on the File menu.If the
drawing is named, AutoCAD saves the drawing using the file format specified on the Open and
save tab of the Options dialog box and does not request a file name. If the drawing is unnamed,
AutoCAD displays theSave Drawing As dialog box (see SAVEAS) and saves the drawing with
the file name and format you specify.
1. Press CTRL + S. or
After we finish working on Auto Cad and saving the files we want, we have to properly exit
from Auto Cad. We can exit Auto Cad by clicking the red close bottom on the right top corner of
the screen. But usually it is not recommended to exit software by this method since it will create
a problem on our computer operating system. Therefore in order to properly exit from Auto Cad
we can follow the following steps:
1. Choose File, Exit. or
2. Type QUIT or EXIT at the command prompt.
Command: QUIT or EXIT
3. Press ENTER
4. Click Yes to save changes or No to discard changes.
1.4 Setting the drawing units limits
To set the units, choose the type of units you want in the Units step of the Advanced Setup
Wizard.Choose a precision in the Precision drop-down list box and then click Next.
To set drawing units without the wizard, choose Format →Units to open the Drawing Units
dialog box, shown in the figure below. The left side of the Drawing Units dialog box enables you
to choose which unit type you want to use. In the Precision box in the Length section, click the
arrow and a list of precision options drops down. Click the one you want. You can also set the
units that AutoCAD uses when inserting the drawing into another drawing using the Design
Center.
Line Command :It is the most basic of all the drawing objects .The initial form point can be
picked using the screen cursor or by entering an X, Y co-ordinate, followed by a two point
location.
Draw toolbar
101
Draw menu Line
Command line entry Line
Alias L
To specify distance in AutoCAD we have two methods:
1. Start the line command and specify the first point (anywhere on the screen)
2. Move the cursor in the direction you want to draw the line (make it horizontal better to work
in Ortho mode) enter the dimension 20
3. Move the cursor in vertical direction and enter 10
4. Move the cursor in horizontal opposite direction to the previous horizontal line
5. Select Close from the command line C and click enter
The AutoCAD system provides you with a variety of methods to locate a point on the drawing
screen in order to carry out a particular action, for instance, to locate the end point of a line or to
move one object to new location.
102
There are three methods of Co-Ordinate entry:
Imagine your screen is like a piece of graph paper and all your coordinates are taken from one
datum base point, the lower left corner ,X0,Y0. A co-ordinate position specified from the
keyboard will be taken relative to this X0, Y0 position (0, 0).
For instance point A shown in the figure below is 20 units in the X and 20 units in Y axis from datum 0,
0, whilst point B shown is 20 units far from point A in Y direction.
Activate the line command using draw toolbar, draw menu or by typing “L” on the command
line.
Command: _line Specify first point: 20, 20 enter(A)
Specify next point or [Undo]: 20, 40 enter (B)
Specify next point or [Undo]: 40, 40enter(C)
Specify next point or [Close/Undo]: 40, 50enter (D)
Specify next point or [Close/Undo]: 55, 50enter (E)
Specify next point or [Close/Undo]: 55, 40enter (F)
Specify next point or [Close/Undo]: 75, 40 enter (G)
Specify next point or [Close/Undo]: 75, 20enter (H)
Specify next point or [Close/Undo]: c enter(A)
Allows you to specify the X,Y co-ordinate of the end points of your next line relative to your
current position .In order to inform AutoCAD that you wish to use a relative co-ordinate entry ,
you must type the @ symbol prior to your next co-ordinate position.The format is :@X,Y
For instance point A shown is 20 units in the X and 20 units in Y axis from datum 0,0, whilst
point B shown is 20 units far from point A in Y direction.
Procedures to draw the given figure using relative co-ordinate system
Activate the line command using draw toolbar, draw menu or by typing “L” on the command line
Command: _line Specify first point: click anywhere in the drawing area (A)
103
Specify next point or [Undo]: @0, 20 enter (B)
Specify next point or [Undo]: @20, 0enter (C)
Specify next point or [Close/Undo]: @0, 10 enter (D)
Specify next point or [Close/Undo]: @15, 0 enter (E)
Specify next point or [Close/Undo]: @0, -10 enter (F)
Specify next point or [Close/Undo]: @20, 0 enter (G)
Specify next point or [Close/Undo]: @0, -20enter (H)
Specify next point or [Close/Undo]:@ -55,0orc enter (A)
c. Polar Co-Ordinate Entry
You can use polar co-ordinate to specify your next line point as a distance and angular direction
from your current position. Again, in order to inform AutoCAD that you wish to use a relative
co-ordinate entry, you must type the @ symbol prior to your next Co-Ordinate position.
The format is: @Distance < Angle .In AutoCad degrees are measured counter clock wise
starting at 3 o’clock.
Activate the line command using draw toolbar, draw menu or by typing “L” on the command line
Command: _line Specify first point: click anywhere in the drawing area (A)
Specify next point or [Undo]: @20<90 enter (B)
Specify next point or [Undo]: @20<0enter (C)
Specify next point or [Close/Undo]: @10<90enter (D)
Specify next point or [Close/Undo]: @15<0 enter (E)
Specify next point or [Close/Undo]: @10<270 enter (F)
Specify next point or [Close/Undo]: @20<0 enter (G)
Specify next point or [Close/Undo]: @20<270enter (H)
Specify next point or [Close/Undo]: @55<180orc enter (A)
104
LAB EXERCISE 1:
Try to draw the following figure using the line command and the concepts that youhave relent so
far. You have to open new drawing file for each figure and save it as Ex-1, Ex-2, Ex-3 and the
like.
105
Lab Session 2
Familiarize the students with other basic Draw Commands (How to draw Construction line,
Poly line, Rectangle, Arc, Circle, Revision Cloud, Spline, Ellipse and Elliptical Arc)
106
o Draw two lines from the midpoints of two perpendicular lines so that you can use their
intersection as the center for a circle.
o Draw a line from one object to another to visually indicate the relationship between the
two objects.
o Show the relationship between equivalent parts of a model shown in front and right-side
views.
o Draw a line through the center of an object shown in cross-section so that you can show
dimensions from the center line to the edge of an object.
You could use regular lines for these purposes. However, construction lines (also known as
xlines) are unique in that they extend infinitely in both directions. This makes them especially
useful for seeing the relationships among various objects in your drawing.
Of course, construction lines are not actually infinite. However, they extend to the edge of the
drawing area on your screen, and if you zoom out to see more of your drawing, they expand so
that they always extend to the edge of the screen. AutoCAD’s object snap tracking sometimes
eliminates the need for construction lines; nevertheless, sometimes you can work more easily
having a line visible for several commands and then erasing it.
If you zoom to show the extents of your drawing, AutoCAD ignores the xlines and shows you
just the extents of the regular objects in your drawing.
The XLINE command offers several ways to create construction lines. Start the command by
choosing Construction Line from the Draw toolbar. You see the following prompt: Specify a
point or[Hor/Ver/Ang/Bisect/Offset]:
Below are lists the possible options. AutoCAD continues to prompt you for more points so that
you can continue to draw construction lines—much like the LINE command. Press Enter to end
the command.
XLINE Command Options
OptionDescription
SpecifyA point
This option enables you to define the xline with two points. At the first
prompt, specify a point. At the Specify through point: prompt, specify
another point. The first point becomes the base point for subsequent
107
construction lines that you can draw by specifying other through points.
Hor y one point. It is useful for drawing a series of horizontal construction
lines.
Ver
To draw a construction line parallel to the Y axis, type v then enter to
specify the Vertical option. AutoCAD responds with the Specify through
Ang
point: prompt. Specify one point.
Type a then press enter (for Angle). AutoCAD responds with the Enter
angle of xline (0) or [Reference]: prompt. If you enter an angle, AutoCAD
asks for a through point.
Or you can type r then press enter and select a line as a reference, and then
provide an angle and a through point. AutoCAD then calculates the angle
of the construction line from the angle of the reference line. Useful for
drawing a series of construction lines at a specified angle.
To draw a
construction
line parallel to
the X axis, Bisect
type h then
press enter to
specify the
Horizontal
option. Offset
AutoCAD
responds with
the Specify
through point:
prompt.Specif
108
type b then press enter.AutoCAD responds with the Specify angle vertex
point: prompt. Choose any point that you want the construction line to
pass through. Then,at the Specify angle start point: prompt, choose a point
that defines the base of the angle. At the Specify angle end point: prompt,
choose a point that defines the end of the angle.
To draw a construction line parallel to a line, type o then press enter. You
can specify the offset distance by typing in a number or use the Through
To draw a option to pick a point through which the construction line should pass.
construction Either way, the next step is to select a line.
line that If you specified an offset distance, AutoCAD displays the Specify side to
bisects offset: prompt. Respond by picking a point on the side of the selected line
(divides in on which you want the construction line to appear.
half) an angle,
Polylines are single objects that combine line segments and arcs. In certain situations, it is useful
to be able to edit an entire set of lines and arcs as one object. Polylines can have a width, which
can vary from the start point to the endpoint. Polylines ensure that all the vertices of a closed
area actually meet, which is very helpful if you want to hatch the area. They are also very useful
for 3D drawing. In short, polylines are a neat, clean way to draw. The RECTANG and
POLYGON commands create polylines.Some examples of polylines:
109
Draw toolbar:
Draw menu: Polyline
Command entry: pl
One of the above methods starts the PLINE command.
AutoCAD responds with the Specify start point: prompt. Specify the start point.
Then AutoCAD responds with the Specify next point or
[Arc/Close/Halfwidth/Length/Undo/Width]: prompt. It offers the following options:
o Arc:Enables you to draw arcs. This option opens up a set of arc suboptions, which are
explained next, after this list.
o Close:Closes a polyline by drawing a line from the endpoint of the last line segment to the
start point of the polyline. This option appears only after you have picked a second point.
o Halfwidth:Defines half the width of the polyline—the distance from the center of the
polyline to its edge. AutoCAD asks you for the starting halfwidth and the ending
halfwidth, enabling you to create polylines that are tapered.
o Length:Specifies the length of the next line segment. AutoCAD draws the line segment in
the same direction as the last line segment or tangent to the last arc.
o Undo:Undoes the last line segment.
o Width:Defines the width of the polyline. AutoCAD asks you for the starting width and
the ending width.
o Specify next point:Enables you to create a line segment. This is the default option.
Like the LINE command, PLINE continues to prompt you for more points, repeating the entire
prompt each time. When you are done, press Enter to end the command.
If you choose Arc, AutoCAD responds with the Specify endpoint of arc
or[Angle/CEnter/CLose/Direction/Halfwidth/Line/Radius/Second pt/ Undo/Width]: prompt.
While this may seem overwhelming, most of the options are similar to the ARC command
options. The arc options are as follows:
o Angle: Specifies the included angle.
o Center: Specifies the arc’s center.
110
o Close: Closes the polyline by drawing a line from the endpoint of the last arc to the start
point of the polyline.
o Direction: Specifies the direction of the arc from the start point.
o Halfwidth: Defines half the width of the polyline—the distance from the center of the
polyline to its edge. AutoCAD asks you for the starting halfwidth and the ending
halfwidth.
o Line: Returns you to the main polyline prompt so you can draw line segments.
o Radius: Specifies the arc’s radius.
o Second pt:Specifies the second point of the arc.
o Undo:Undoes the last arc.
o Width: Defines the width of the polyline. AutoCAD asks you for the starting width and
the ending width.
o Specify endpoint of arc:Specifies the endpoint of the arc. This is the default.
AutoCAD creates an arc tangent to the previous arc (continuing in the same direction).PLINE
continues to display the arc submenu until you use the Line suboption or end the command
bypressing Enter.
Left-clickthe Polyline tool icon or type Pl on the command entry. The command line shows:
Command: _pline Specify start point: 50,220
Current line width is 0
111
[Prompts]: w (Width)
Specify starting width _ 0 _ : 0.5
Specify ending width _ 0.5 _ : right-click
Specify next point or [prompts]: 120,220
Specify next point or [prompts]: a (Arc)
Specify endpoint of arc or [prompts]: s (second pt)
Specify second point on arc: 150,200
Specify end point of arc: 180,220
Specify end point of arc or [prompts]: l (Line)
Specify next point or [prompts]: 250,220
Specify next point or [prompts]: 250,190
Specify next point or [prompts]: a (Arc)
Specify endpoint of arc or [prompts]: s (second pt)
Specify second point on arc: 240,170
Specify end point of arc: 250,150
Specify end point of arc or [prompts]: l (Line)
Specify next point or [prompts]: 250,150
Specify next point or [prompts]: 250,120
Command:
And so on until the outline in the above Figure is completed.
Because polylines can be quite complex, AutoCAD has a special command to edit them, PEDIT.
To edit a polyline, choose Modify→ Object→ Polyline. Or you can type PEDIT on the
command entry. AutoCAD responds with the Select polyline or[Multiple]: prompt. Select a
polyline and AutoCAD responds with the Enter an option[Close/Join/Width/Edit
vertex/Fit/Spline/Decurve/Ltype gen/Undo]: prompt. The options are as follows:
o Close:Closes an open polyline. If necessary, it adds a segment to connect the
endpoint to the start point. If the polyline is already closed, this prompt becomes
Open. Open creates a break between the first and last segments of the polyline.
o Join:Joins touching lines, arcs, or other polylines to the polyline.
112
o Width:Enables you to specify one width for the entire polyline.
o Edit Vertex:Provides a set of suboptions for editing vertices. These are explained
after this list.
o Fit:Turns the polyline into a curve that passes through the vertices.
o Spline:Creates a curve using the vertices as control points. The curve does not
usually actually pass through the vertices. This is not the mathematically exact spline
that the SPLINE command produces.
o Decurve:Returns a Fit or Spline curve to its original vertices.
o Ltype gen:Turns on continuous linetype generation for the selected polyline.
o Undo:Undoes the most recent edit.
You can change any line or arc into a polyline. Start PEDIT and choose a line or arc. AutoCAD
responds: Object selected is not a polyline. Do you want to turn it into one? <Y>. Press Enter to
accept the default. AutoCAD turns the object into a polyline. You can use this technique to turn a
series of connected lines and arcs into a polyline. First, turn one of the objects into a polyline as I
just explained. Then use the Join option and select the other objects individually or by a selection
window. When you finish object selection, AutoCAD tells you how many segments were added
to the polyline. In order to create a polyline in this way, the individual lines and arcs must
connect exactly end to end.
Draw toolbar:
113
o First corner point:Specifies a corner point of the rectangle.If you Specify the first corner of a
Area:Creates a rectangle using the area and either a length or a width. If the
Chamfer or Fillet option is active, the area includes the effect of the chamfers
or fillets on the corners of the rectangle.
Or
114
Once you have specified the length and width, four possible rectangles are
possible, as shown in the figure. As you move your mouse cursor around the
first corner you specified, AutoCAD displays these rectangles. Click when
you see the one you want.
Once you set the dimensions, they remain as defaults for future rectangles that
you draw. As a result, you can use the Dimensions option to quickly draw a
number of identical rectangles.
When you specify the first corner, a length, and a width, chooses which of
four possible rectangles you want.
Specify first chamfer distance for rectangles <current>: Specify a distance or press
ENTER
Specify second chamfer distance for rectangles <current>: Specify a distance or press
ENTER
The values become the current chamfer distances for subsequent RECTANG commands.
115
Specify the elevation for rectangles <current>: Specify a distance or press ENTER
The value becomes the current elevation for subsequent RECTANG commands.
Specify fillet radius for rectangles <current>: Specify a distance or press ENTER
The value becomes the current fillet radius for subsequent RECTANG commands.
The value becomes the current thickness for subsequent RECTANG commands.
Specify line width for rectangles <current>: Specify a distance or press ENTER
The value becomes the current polyline width for subsequent RECTANG commands.
Draw toolbar:
Draw menu: Polygon
Command entry: pol
Then the following prompt will be displayed.
Enter number of sides <current>:Enter a value between 3 and 1024 or press ENTER
Specify center of polygon or [Edge]:
o Center, Inscribed/Circumscribed: Specify center of polygon or [Edge]: Use one of the point
fixing methods
116
Define the center point of an imaginary circle, which passes through the edges or endpoints
of the polygon.
Enter an option [Inscribed in circle/Circumscribed about circle] <1>: I
Specify radius of circle: Specify radius of the imaginary circle
Using inscribed option AutoCAD draws the polygon, such that the vertices of the polygon lie
on the circumference of an imaginary circle constructed by AutoCAD with radius and center
point specified.
Enter an option [Inscribed in circle/Circumscribed about circle] <1>: C
Specify radius of circle: Specify radius of the imaginary circle
Using circumscribed option AutoCAD constructs the polygon such that the side of base is
tangential to all imaginary circle constructed by AutoCAD with radius and center point
specified.
o Edge: Using the edge method to create the polygon, you define the side of base by fixing two
points and
AutoCAD constructs the rest of polygon; here the user has control over the exact size and
orientation of the polygon.
Command: _pol
Command: _polygon Enter number of sides <6>: Enter a positive integer Specify center of
polygon or [Edge]: E
Specify first endpoint of edge: Use one of the pointfixing methods Specify second endpoint
of edge:
Use one of the point fixing methods
If you type a number for the radius, the bottom edge of the polygon is horizontal. However, if
you pick a point for the radius with your mouse, you can specify the orientation of the
polygon. Rotate the mouse cursor around the center, and you see the polygon rotate. Pick
when you like what you see.
If you type a number for the radius, the bottom edge of the polygon is horizontal. However, if
you pick a point for the radius with your mouse, you can specify the orientation of the
polygon. Rotate the mouse cursor around the center, and you see the polygon rotate. Pick
when you like what you see.
117
2.5 Drawing Circles
Draw toolbar:
You can create circles in several ways. The default method is to specify a center and radius.
AutoCAD also provides 3 more methods to draw circles which are discussed below.
Command: _circle
Specify center point for circle or [3P/2P/Ttr (tan tan radius)]: Use one of the point fixing
methods or enter an option
o Center, Radius/Center, Diameter: This allows drawing a circle based on the center point
and radius or diameter. The radius or diameter can be specified by fixing a point or by
entering a value. The distance between the specified point and the center, is the radius or
diameter, as the case may be.
Specify radius of circle or [Diameter]: Enter radius value or enter D for Diameter option
o 3Points: A circle can be fixed by specifying any 3 circumferential points using this
option.
118
Command: _circle
Specify center point for circle or [3P/2P/Ttr (tan tan radius)]: _3p
Specify first point on circle: Use one of the point fixing methods
Specify second point on circle: Use one of the point fixing methods
Specify third point on circle: Use one of the point fixing methods
o Tangent, Tangent, Radius: Select this to draw a circle of given radius. The circle will be
fixed tangential to both the selected objects.
Command: _circle
Specify center point for circle or [3P/2P/Ttr (tan tan radius)]: _ttr
Specify point on object for first tangent of circle: Select an object
Specify point on object for second tangent of circle: Select an object
Specify radius of circle <1.0000>: Enter a value.
119
Draw toolbar:
ARC command allows you to create an arc segment. Arcs created by AutoCAD are circular arcs
which form a part of a circle. There are different methods of creating an arc, as illustrated below.
The default method is to specify the circumference with three points.Except for 3 point arcs, arcs
are drawn in a Counter Clockwise direction.
3 point arc Start, center, chord length start, center, end
Start, end, radius Start, center, included angle Start, end, direction
2.7 Splines
Draw toolbar:
120
Command entry: Spline
A spline is a smooth curve that is defined by a series of points. The SPLINE command provides
a more precise representation of a spline than the Spline option of the PLINE command. By
default, the curve passes through each point you define.
To create a spline, choose Spline from the Draw menu. AutoCAD responds with the Specify first
point or [Object]: prompt. Use the Object option to convert a polyline that you have created with
PEDIT’s Spline option into a true spline. (It won’t look any different, but its internal definition
changes.) Otherwise, specify the first point for the spline.
If you choose a point, AutoCAD displays the Specify next point: prompt so you can pick a
second point. Once you do so, AutoCAD responds with the Specify next point or [Close/Fit
tolerance] <start tangent>: prompt. Use these options as follows:
o Close:Closes the spline by connecting the last point with the first in a continuous
(tangent) curve. AutoCAD asks for a tangent direction. You can specify a direction by
picking a point (watch the spline image change as you move the cursor) or pressing Enter
to accept the default tangent direction.
o Fit Tolerance:Specifies how closely the spline comes to the points you pick. The default,
0, creates a spline that passes through each point. If you want the curve to have latitude of
0.5 units from the points, set the tolerance to 0.5.
o Specify next point:The default is to continue to enter points. Press Enter to end point
selection.
o Start tangent:When you press Enter to complete point selection, AutoCAD prompts you
for start and ending tangent directions. You can press Enter at both prompts to accept the
default tangents based on the curve’s current shape. You can see the effect of other
tangent points by moving the cursor and watching the image change.
2.8 Ellipses
121
Draw toolbar:
Draw menu: Ellipse
Command entry: El
To draw an ellipse, choose Ellipse from the Draw toolbar or use one of the above methods. In
addition to the information AutoCAD explicitly requests in the prompts, you need to know the
angle of the first axis you define. Not all ellipses are horizontal or vertical. You control this
when you stipulate the second point of the first axis.
The second axis is automatically perpendicular to the first axis. The Ellipse Arc button is new on
the
Draw toolbar. It simply executes the ELLIPSE command with the Arc option.
To draw an elliptical arc, choose Ellipse Arc from the Draw toolbar. When you draw an elliptical
arc,
AutoCAD introduces a helpful but sometimes confusing feature: While you are defining the arc
angles, AutoCAD redefines 0 degrees along the major axis. This helps you define the included
angle in an orientation that relates to the ellipse, rather than the usual orientation where 0 degrees
is to the right.
Creates an ellipse or an elliptical arc
AutoCAD helps drawing a perfect ellipse or elliptical curve using this command. There are two
different ways in defining an ellipse: (a) you define the full length of one axis and half-length of
the other axis, (b) define the center point of the ellipse (the point where to axes intersect with
each other) and half-length of other two axes.
Command: _ellipse
Specify axis endpoint of ellipse or [Arc/Center]: Use one of the point fixing methods or enter an
option
Axis Endpoints
Draw > Ellipse > Axis, End
This is the first step towards defining the first axis. The two end points of the axis are specified.
When the first point is specified in the above option, it prompts for the second point.
Specify other endpoint of axis: Use one of the point fixing methods
122
Here, there is not distinction of major or minor axes of an ellipse. Depending on the distance you
specify one could be the major axis of an ellipse and the other could be the minor axis.
AutoCAD doesn't make any difference between these two.
After the first axis of the ellipse is defined, AutoCAD gives you two options to define the length
of the other axis. The first one is to define half-length| of the other axis
Specify distance to other axis -or- flotation]: Specify a distance
This defines the second axis as the distance from the center of the ellipse (midpoint of the first
axis that you defined earlier) in a direction perpendicular to the first axis.
The Rotation option defines the major to minor axis ratio of the ellipse by rotating an imaginary
circle about the first axis you defined by the given rotation angle. The higher the value, the
greater is the ratio of minor to major axis. Entering 0 defines a circle. Rotation around major
axis: Specify a point or enter a value (0-89.4)
Specify distance to other axis or [Rotation]: R Specify rotation around major axis: Specify an
angle
To specify start angle, you could enter a numeric value, in which case, AutoCAD measures the
angle from the angle of the first axis you defined. Parameter requires the same input as start
angle.
Specify start angle or [Parameter]: p
Specify start parameter or [Angle]: Enter a value or specify an angle
Specify end parameter or [Angle/Included angle]: Enter a value or specify an angle
Specify end parameter or [Angle/Included angle]: Enter a value or specify an angle
LAB EXERCISE 2:
#1.Using polyline commands draw the following. (Set the unit to inch)
# 2. Draw the following figure using line and Arc commands.
124
#3.The following figure shows a rectangle in the formof a square with hexagons along eachedge.
Using the Dimensions prompt of theRectangle tool construct the square. Then,using the Edge
prompt of the Polygon tool,add the four hexagons. Use the Object Snapendpoint to ensure the
polygons are in theirexact positions. (Units mm)
125
# 4.With the Line and Arc tools, construct # 5.With the Ellipse tool, construct the
theoutline shown in the following figures. drawingshown below.(each ellipse minor
axis=30)
# 6.With the Line, Circle and Ellipse # 7.Using the Circle tool, construct the
toolsconstruct the drawing shown bellow. following circles.
126
# 8.Construct the drawing shown in below using the Line and Arc tools. Then change allwidths
of lines and arcs to a width of 2 withPolyline Edit.
# 9.Using the Line tool construct the two lines at thelength and angle as given in the figure
below. Then, withthe Ttrprompt of the Circle tool, add the circle asshown.
10.Draw the following figure using line and tangent to the circle and change the units to
circle commands. (Turn on tangent from inches).
Osnap settings to draw the lines that are
# 11. Draw the following figure using
rectangle and circle commands.
127
#12. Using line, arc rectangle and circle commands draw the following figure. (Unit in mm)
Lab Session 3
MODIFY/EDITING COMMANDS
Objective
Modifying the object that we draw using draw command and to be familiar with
editing/modifying commands.
Editing Commands
Editing commands or modify commands are used to edit objects that are made using draw
commands. We can erase, copy, mirror, offset etc once we draw an object. The Editing/Modify
128
tools are among those most frequently used. The tools arefound in the Home/Modify panel. A
click on the arrow in the Home/
Modify panel brings down a further set of tool icons. Theycan also be selected from the Modify
toolbar or from theModify drop-down menu.We will see each modify command step by step.
Erase objects
The first editing tool in the modify toolbar is ERASE. This allows you to remove the selected
objects from the AutoCAD drawing.
Command: _erase,
Select objects: Pick an object to delete
Select Objects: Pick an object or press Esc to terminate the command.
Copy command
The copy command enables you to copy objects with a specified distance in a specified direction.
You can create multiple copies of a single object using this command.
Example:Construct the Figure bellow using Polyline. Do not include the dimensions.
129
Now Call the Copy tool (left-click on its tool icon in the Home/Modify panel, pick Copy from
the Modify toolbar, or enter cpor copy at the command line).
The command line shows:
Command: _copy
Select objects: pick the cross 1 found
Select objects: right-click
Current settings: Copy mode=Multiple
Specify base point or [Displacement/mode/Multiple]<Displacement>: pick
Specify second point or [use first point as Displacement]: pick
MIRROR command
Many drawings have symmetrical elements. Often, especially in mechanical drawing, you can
create one-half or one-quarter of a model and complete it simply by mirroring what you have
drawn.
To mirror, select an object or objects and then choose Mirror from the Modify toolbar.
Alternatively, choose Mirror from the Modify toolbar and then select an object or objects.
AutoCAD prompts for the first and second points of the mirror line. This is an imaginary line
across which AutoCAD creates the mirrored object. The length of the line is irrelevant—only its
start point and direction are important.
Most mirror lines are orthogonal. Therefore, once you specify the first mirror point, turn on
ORTHO and move the mouse in the direction of the second point. You can then quickly pick the
second point.
130
Polar tracking can also easily guide you to specify an orthogonal mirror line. AutoCAD then asks
if you want to delete the source objects. The source objects refer to the objects you have selected
to mirror. If you want to keep them, type n or press Enter. You would keep the source objects
when you are building a symmetrical model and want the mirror image to be added to the
original object(s). Type y when you want to edit an object, change its orientation, so that only the
mirror image is retained in the drawing.
Example: Construct the outline shown in the figure bellow using the Line and Arc tools.
Then call the Mirror tool (left-click on its tool icon in the Home/Modifypanel, pickthe Mirror
tool icon from the Modify toolbar,pick Mirror from the Modify drop-down menu, or enter mi or
mirrorat the command line. The command line shows:
Command: _mirror
131
Command:
Moving objects
Use the MOVE command to move objects in your drawing. Moving an object is more complex
than erasing one because you need to tell AutoCAD the distance and direction you want the
object to move.
To move an object, select it and choose Move on the Modify toolbar. Alternatively, choose
Move and then select the object. When you choose the MOVE command and once you have
selected an object, AutoCAD responds with the following prompt:
Specify base point or displacement:
You now have two ways of telling AutoCAD how to move the object or objects:
o Displacement method:At the Specify base point or displacement: prompt, state the entire
displacement as an X,Y coordinate such as 2,3 or a polar coordinate such as 2<60. Because
the word displacement already implies the relative distance from the object, you do not use
@.(AutoCAD actually uses 0,0as the relative point.) AutoCAD responds with the Specify
second point of displacement or <use first point as displacement>: prompt. Because you have
132
already given AutoCAD all the information it needs, press Enter. AutoCAD uses the first
point you indicated as the displacement (the default) and moves the object.
o Base point/second point method:At the Specify base point or displacement: prompt, pick a
base point. This can be anywhere in your drawing. At the Specify second point of
displacement or <use first point as displacement>: prompt, specify the distance and angle of
movement either by picking a second point on the screen or by typing a relative coordinate,
using @.
The displacement method requires less input and is simpler when you know the exact
displacement so that you can type it in. The only disadvantage is that once you type in the
displacement, AutoCAD sometimes displays a confusing drag line and copy of your object or
objects. Ignore this display, press Enter, and your object or objects move as you specified. The
base point/second point method works best when you want to move an object relative to another
object on the screen.
ARRAY command
The ARRAY command creates a rectangular or circular (polar) pattern by copying the object(s)
you select as many times as you specify. The ARRAY command is a powerful drawing tool. It
can quickly create large numbers of objects—saving a huge amount of time and effort.
o Rectangular arrays: A rectangular array creates a grid of rows and columns of one or more
objects. The figure below shows an example of a rectangular array.
1) Select the object or objects and choose Array from the Modify toolbar. Alternatively,
choose Array from the Modify toolbar and select the object or objects. AutoCAD opens the
Array dialog box, shown.
2) Click Rectangular Array at the upper-left corner of the dialog box (if it is not already
selected).
133
3) If you have already selected one or more objects, the dialog box indicates the number of
selected objects. If you have not selected any object, click Select Objects to return to your
drawing and select objects. Press Enter to end object selection and return to the dialog box.
4) Type the number of rows and columns you want in the Rows and Columns text boxes. Press
Tab after the last number you type to see the new result in the preview panel.
5) Type the row offset (the distance between the rows). The preview panel doesn’t display any
change when you change the row or column offsets.
6) Type the column offset (the distance between the columns).
7) If you want to specify the offsets by picking points on your screen, click one of the following
buttons:
If you need to create a number of copies of an object along a straight path, use a one-column or
one row array instead of the COPY command. It’s faster and easier.
o Polar (circular) arrays:A polar array creates copies of one or more objects arrayed in a circle
around a center point. An example of a polar array is shown below.
134
To create a polar array, follow these steps:
1. Select the object or objects and choose Array from the Modify toolbar. Alternatively,
choose
Array from the Modify toolbar and select the object or objects. AutoCAD opens the Array dialog
box.
2. Click Rectangular Array at the upper-left corner of the dialog box (if it is not already
selected).
3. If you have already selected one or more objects, the dialog box indicates the number of
selected objects. If you have not selected any object, click Select Objects to return to your
drawing and select objects. Press Enter to end object selection and return to the dialog box.
4. Specify the center point by typing X and Y coordinates or click the Pick Center Point
button. If you selected an object first, check that the center point displayed is what you want.
5. Select the two items you want to specify from the Method drop-down box. You can choose
any two from the three choices:
• Total Number of Items: Sets the total number of items in the resulting array, including
he one you are arraying.
• Angle to Fill: Sets the number of degrees the polar array covers. For example, to array
around half a circle, specify 180°.
• Angle Between Items: Specifies the number of degrees between each item in the polar
array.
6. Complete the values of the two items you specified. You can click the buttons to pick the
angle to fill or the angle between items on the screen.
7. Check the Rotate Items as Copied checkbox to rotate the objects you are arraying. Uncheck
the box to leave them un-rotated.
8. Click Preview to preview the array. Then choose Accept to create the array, Modify to return
to the dialog box, or Cancel to cancel the command.
135
9. Click OK to create the array.
Offsetting objects
The OFFSET command creates lines or curves parallel to one existing object. The beauty of this
command is apparent when you start to create complex objects, such as polylines. You may
remember that polygons and rectangles are polylines, meaning that they are treated as one object.
Using OFFSET, you can create concentric polygons, for example, in one step. The figure below
shows two concentric polygons. The outside polygon was created with the POLYGON
command, and the inside polygon was created using OFFSET.
To offset an object, choose Offset from the Modify toolbar. You cannot select objects before
choosing the command.
AutoCAD responds with the Specify offset distance or [Through] <1.0000>: prompt. AutoCAD
offers two slightly different ways to specify the offset:
If you type an offset distance, AutoCAD responds with the Select object to offset or <exit>:
prompt.
You can select one object. Then AutoCAD displays the Specify point on side to offset: prompt.
Pick a point to indicate on which side of the object AutoCAD should create the offset copy.
AutoCAD creates the offset and continues to show the Select object to offset or <exit>: prompt
so you can offset other objects using the same offset distance. Press Enter to exit the command.
If you want to indicate a through point, which is a point that the offset passes through, such as an
object snap on another object, type t : or right-click and choose Through from the shortcut menu.
Then AutoCAD displays the Select object to offset or <exit>: prompt. Pick one object. At the
Specify through point: prompt, pick a point through which you want the offset to go. AutoCAD
creates the offset.
136
Rotating objects
AutoCAD enables you to easily rotate an object or objects around a base point that you specify.
The base point is usually an object snap point on the object. To indicate the rotation, specify an
angle of rotation. Zero degrees is generally to the right, and degrees increase counterclockwise,
although you can change this convention. By specifying a negative angle, you can turn objects
clockwise.
To rotate an object, choose Rotate from the Modify toolbar and select an object. Alternatively,
select an object and then choose Rotate from the Modify toolbar. At the Specify base point:
prompt, indicate the point around which you want to rotate. At the Specify rotation angle or
[Reference]: prompt, type an angle at the command line.
The Reference option lets you specify the angle with reference to another angle or an object. At
the
Specify the reference angle <0>: prompt, you type in an angle or (more likely) specify an angle
by picking two points. These are often object snap points on the object that specify the object’s
current angle. At the Specify the new angle:prompt type or pick a new angle. This new angle can
also be indicated by picking an object snap on another object in the drawing. You can use the
Reference option to align the object with another object in your drawing.
Scaling, or resizing, objects is another common editing task in AutoCAD. As with rotating
objects, you specify a base point, usually an object snap on the object. The base point is the one
137
point on the object that does not move or change as you scale the object. The most common way
to resize an object is to specify a scale factor. The current object has a scale factor of 1.
Therefore, to increase the size of the object, type in a number greater than 1. For example, a scale
factor of 2 doubles the size of the object. To decrease the size of the object, type a number less
than 1. A scale factor of 0.25 creates an object one-quarter of its previous size.
As with the ROTATE command, you can scale using the Reference option. You specify the
reference length, usually the current length of the object, by typing it in or using object snaps on
the object. At the Specify new length: prompt, you can type a new length or pick a point.
AutoCAD measures this point from the base point you specified to determine the new length.
To scale an object, choose Scale from the Modify toolbar and select the object.
Alternatively, select the object and choose Scale from the Modify toolbar.
Resizing commands
There are four additional commands that resize objects. The TRIM and EXTEND commands
bring the endpoint of an object to another object. LENGTHEN lets you lengthen or shorten a
line, polyline, arc, or elliptical arc. STRETCH is used to stretch (larger or shorter) a group of
objects, letting you change their direction at the same time.
Trimming objects
As you edit a drawing, you may find that lines or arcs that once perfectly met other objects now
hang over. To trim an object, you must first specify the cutting edge, which defines the point at
which
AutoCAD cuts the object you want to trim. You define the cutting edge by selecting an object.
You can select several cutting edges and several objects to trim at one time, as shown in the
figure below. When you select an object to trim, you must pick the object on the side that you
want trimmed (not on the side that you want to remain).
138
To trim an object, choose Trim from the Modify toolbar. You cannot select objects before
starting the TRIM command. AutoCAD displays the Current settings: Projection=UCS,
Edge=None
Select cutting edges: prompt.
AutoCAD lets you know the values of the two system variables that affect trimming.The
Projection setting is used only for 3D models. The Edge setting is used for implied
intersections.When Edge is set to Extend, AutoCAD trims to the implied intersection of the
cutting edge and the object to be trimmed. At this prompt, pick the object(s) you want to use as a
cutting edge. Press Enter to end object selection.
If the object you want to use for the cutting edge is already selected before you start the TRIM
command, AutoCAD deselects it. At the Select cutting edges: prompt, you can type P to reselect
that object.
Stretching objects
The STRETCH command is generally used to stretch groups of objects. It can be used to enlarge
a certain object, for example. You can also shrink objects. You can change not only the length of
the objects but the angle as well. You use a crossing window to choose the objects to be
stretched.
All objects that cross the boundaries of the crossing window are stretched. All objects that lie
entirely within the crossing window are merely moved. Successful stretching involves precise
139
placement of the crossing window. Figure below shows the process of stretching a garage. Note
that the walls that cross the boundaries of the crossing window are stretched.
However, the dormer, which is entirely within the crossing window, is just moved. This
maintains the integrity of the model.
You cannot stretch circles, text, or blocks. You can stretch arcs, although the results may not be
what you expect. The real power of the STRETCH command is in stretching a number of objects
at once. However, you can also stretch one line. The results are similar to using the CHANGE
command to change the endpoint of a line.
To stretch objects, choose Stretch from the Modify toolbar. AutoCAD responds with the Select
objects to stretch by crossing-window or crossing-polygon... instruction and then the Select
objects: prompt. Create the crossing window and select the objects you want to stretch. (You can
also use a crossing polygon.) After completing the crossing window, check to see which objects
are highlighted.
This helps you avoid unwanted results. You can use the object selection Remove option (type r
enter at the command prompt) to remove objects by picking that you don’t want to stretch or
move.
AutoCAD then displays the Specify base point or displacement: prompt. This step is just like
moving objects. You can respond in two ways.
Pick a base point. At the Specify second point of displacement: prompt, pick a second point.
Object snap and polar snap are helpful for picking these points.
Type a displacement, without using the @ sign. For example, to lengthen the objects by 6 units
in the 0-degree direction, type 6<0. Then press Enter at the Specify second point of
displacement: prompt.
When specifying a displacement by typing at the keyboard, you can use both positive and
negative distances. For example, 6<180 is the same as –6<0. Both would stretch the objects 6
unit to the left.
140
Extending objects
The EXTEND command has the same prompts as the TRIM command, but instead of trimming
objects to a cutting edge, it extends them to a boundary edge. As with TRIM, when you select an
object to extend, you must pick the object on the side that you want extended (not on the side
that you want left as is).
The object you want to extend does not have to actually intersect the boundary edge after its
extension. AutoCAD can extend an object to a boundary edge that would intersect the extended
object if it were longer. This is called extending to an implied intersection.
To extend an object, choose Extend from the Modify toolbar. You cannot select objects before the
EXTEND command. AutoCAD displays the Current settings:
Projection=UCS, Edge=Extend Select boundary edges ... Select objects: prompt. AutoCAD lets you know
the values of the two settings that affect extending. Projection is used only for 3D models. Edge is used
for implied intersections.
When Edge is set to Extend, AutoCAD extends to the implied intersection of the boundary edge and the
object to be extended. At this prompt, pick the object(s) you want to use as the boundary edge(s).
Press Enter to end object selection. You can extend to an actual or implied intersection:
If the extension will result in an actual intersection, at the Select object to extend or shift-select to trim or
[Project/Edge/Undo]: prompt, select objects to extend. Be sure to pick each object at the end you want to
extend. Press Enter to end object selection. AutoCAD extends the object(s). If you want to extend to an
implied intersection, at the prompt , right-click and choose Edge.
AutoCAD responds with the Enter an implied edge extension mode [Extend/No extend]
<Extend>: prompt. Right-click and choose Extend. Then select the objects you want to extend at the
Select object to extend or shift-select to trim or [Project/Edge/Undo]: prompt. Be sure to pick each object
at the end you want to extend. Press Enter to end object selection. AutoCAD extends the object(s). Use
141
the Undo option if the results of the extension are not what you want. You can then continue to select
objects to extend.
You can use the Fence object selection method to select objects to extend. AutoCAD extends the side of
the object that the fence line crosses.
Breaking objects
It is often much easier to draw a long line and then break it into two or more shorter lines. A
common use for BREAK is to break a wall at a door or a window in an architectural floor plan.
You specify two points on the object, and AutoCAD erases whatever is between those two
points. Typically, you use object snaps to specify the points. Sometimes, you can use TRIM to
break an object, but if there is no convenient cutting edge, you may find BREAK more efficient.
You can break lines, polylines, splines, xlines, rays, circles, arcs, and ellipses.
To break a line, choose Break from the Modify toolbar. You cannot select the object first and
then the BREAK command. AutoCAD responds with the Select object: prompt. (Notice that you
can only select one object to break.) At this prompt, you have two choices:
I. Select the object at one of the break points you want to create. AutoCAD then responds
with the Specify second break point or [First point]: prompt. Because you have already
specified the first point, you can now specify the second point. AutoCAD breaks the
object between the two points.
II. Select the object using any method of object selection. AutoCAD then responds with the
Specify second break point or [First point]: prompt. Right-click and choose First point.
At the Specify first break point: prompt, pick the first break point. At the Specify second
break point: prompt, pick the second break point. AutoCAD breaks the object between
the two points.
Example: Construct a rectangle and call the break command using one of the methods which
shows:Command: _break
Select object: pick at the point
Specify second break point or [First point]: pick
Command:
The result is shown in the figure.
142
Join Command
The Jointool can be used to join polylines provided their ends are touching; to join lines which
are in line with each other; to join arcs and convert arcs to circles.
Example:Construct a rectangle from four separate polylines. Then Call the Join tool (click the
Join tool icon in the Home/Modify panel, left-click its tool icon in the Modify toolbar, select Join
from the Modify drop-down menu or enter join or j at the command line. The command line
shows:
Command: _join
Select source object:pick a pline
Select objects to join to source: pick a pline
1 found
Select objects to join to source: pick another
1found, 2 total
Select objects to join to source: pick another
1found, 3 total
Select objects to join to source: right-click
3 segments added to polyline
Command: right-click
Command:
The result is shown in the figure..
The CHAMFER command creates corners from two nonparallel lines. You can also chamfer
xlines, rays, and polylines. You can simply extend the lines to meet at an intersection (a square
corner), or create a beveled edge. If you create a beveled edge, you define the edge by either two
143
distances or one distance and an angle relative to the first line you are chamfering. This figure
shows the elements of a chamfered corner.
Chamfering is a two-step process. First you define how you want to chamfer the corner,
specifying either two distances from the corner or a distance and an angle.
Then you select the two lines you want to chamfer. AutoCAD chamfers them using the
information you specified.
To chamfer, choose Chamfer from the Modify toolbar. You cannot select objects before the
CHAMFER command. AutoCAD responds with the (TRIM mode) Current chamfer Dist1 =
0.5000,
Dist2 = 0.5000 Select first line or [Polyline/Distance/Angle/Trim/Method]: prompt. AutoCAD
starts by listing the current settings. You can define two distances from a corner or one distance
and an angle:
• To define two distances from the corner, right-click and choose Distance. At the Specify first
chamfer distance <0.5000>: prompt, type the first chamfer distance or press Enter to accept the
default (which is the last distance you defined). At the Specify second chamfer distance
<0.5000>: prompt, type the second distance. The default for this is always the first chamfer
distance because equal chamfer distances are so common.
• To define a distance (from the corner) and an angle, right-click and choose Angle. At the
Specify chamfer length on the first line <1.0000>: prompt, enter a distance. This is the same as
the first chamfer distance. At the Specify chamfer angle from the first line <0>: prompt, type the
angle between the first line and the chamfer line.
Example:Construct a rectangle 100 by 60 using either the Line or the Polyline tool. Then Call
Chamfer tool ( click the arrow to the right of the tool icon in the Home/Modify panel and select
Chamfer from the menu which appears, click on its tool icon in the Modify toolbar, pickChamfer
144
from the Modify drop-down menu, or enter cha or chamfer at the command line) which then
shows:
Command: _chamfer
(TRIM mode) Current chamfer Dist1 = 1, Dist2 = 1
Select first line or [Undo/Polyline/Distance/ Angle/Trim/Method/Multiple]: d
Specify first chamfer distance < 1 >: 10
Specify second chamfer distance <10 >: right-click
Select first line or [Undo/Polyline/Distance/Angle/Trim/ Method/Multiple]: pick the first line for
the chamfer
Select second line or shift-select to apply corner: pick
Command:
The result is as follows.
The FILLET command creates rounded corners, replacing part of two lines with an arc. Fillets
are often used in mechanical drawings. In certain cases, you can use FILLET instead of the ARC
command to create arcs. As with CHAMFER, you can fillet lines, xlines, rays, and polylines—
they can even be parallel. You can also fillet circles, arcs and ellipses.The FILLET command
defines the fillet arc by its radius, as shown in this figure.
145
Like chamfering, filleting is a two-step process. First you define the radius of the fillet arc. Then
you select the two lines you want to fillet. AutoCAD fillets them using the information you
specified.
To specify the fillet information, choose Fillet from the Modify toolbar. You cannot select
objects before the command with Fillet. AutoCAD responds with the Current settings: Mode =
TRIM, Radius =0.5000 Select first object or [Polyline/Radius/Trim]: prompt. Right-click and
choose Radius. At the Specify fillet radius<0.5000>: prompt, type the radius you want. The
default is either 0.5000 or the last radius you specified.
AutoCAD repeats the Select first object or [Polyline/Radius/Trim]: prompt. Select the first object
you want to fillet. At the Select second object prompt, select the second object you want to fillet.
AutoCAD creates the fillet.By default, FILLET trims the original lines that it fillets, but the
FILLET command recalls the last setting you used. If you want to keep the full original lines
when you create a fillet, right-click and choose the Trim option and then choose No Trim.
Filleting with a zero radius gives the same results as chamfering with distances set to zero.
The order in which you select the two objects to be filleted is not important. However, where you
pick the objects is quite important. If two objects intersect, AutoCAD keeps the objects on the
same side of the intersection as your pick point and fillets them. Those parts of the objects on the
far side of the intersection are erased.
When you fillet arcs and lines, if more than one fillet is possible, FILLET connects the endpoints
closest to your pick points. Filleting circles and lines can result in unexpected results. Sometimes
you need to experiment to find the proper pick points.
Example:Construct a rectangle 100 by 60 using either the Line or thePolyline tool. Then Call
Fillet (click the arrow to the right of the tool icon in the Home/Modify panel and select Fillet
from the menu which appears, pick its tool icon in the Modify toolbar, pick Fillet from the
Modify drop-down menu, or enter f or fillet at the command line)which then shows:
Command: _fillet
Current settings: Mode = TRIM, Radius = 1
Select first object or [Polyline/Radius/Trim/Multiple]: r (Radius)
Specify fillet radius < 0 >: 15
Select first object or [Undo/Polyline/Radius/Trim/Multiple]: pick
146
Select second object or shift-select to apply corner: pick
Command:
The Explode Command breaks a compound object into its component objects. It explodes a
compound object when we want to modify its components separately. Objects that cn be
exploded include blocks, polylines, and regions among others.
A click on the icon or entering ex atthe command line brings prompts into the command line:
Command: _explode
Select objects: pick a block on screen 1 found
Select objects: right-click
Command:
and the picked object is exploded into its original objects.
147
LAB EXERCISE 3
Using the necessary Draw and modify commands that we see in previous labs construct the
following figures.
#1 #2
#3 #4
148
#5#6
#7 #8
#9
149
#10
150
#11
151
#12
152
Lab Session 4
4.1 BLOCKS
A Block is a series of objects (lines, arcs, text etc.) grouped together to form a single entry. This
entry can be inserted in to a drawing any number of times without significantly increasing the
size the size of the drawing file. You can use blocks to create libraries of frequently used
symbols.
153
Blocks are drawings which can be inserted into other drawings. Blocks arecontained in the data
of the drawing in which they have been constructed.Wblocks (written blocks) are saved as
drawings in their own right, but canbe inserted into other drawings if required.
A block definition is a collection of objects grouped together to form a single object that can be
inserted in to a drawing any number of time. When inserted, blocks can be assigned different
scale and rotation factors.
Draw toolbar
The block command is used to create new blocks that will be defined with in the current drawing
file. The above commands will activate Block definition dialogue box.
154
Name: Specifies the name of the block up to 31 characters.
Basepoint: Indicates the insertion point for the block. Specify X, Y, Z co-ordinates or use the
pick point button to specify base point on the drawing.
Delete: If checked objects included in the block will be deleted from the drawing.
Description: Accepts a textural description up to 256 ASCII characters long for display in
content explorer.
Block insertion
Blocks can be inserted into a drawing by using the inserted dialogue box.
Draw toolbar
Browse: Choose Browse… to select from a list of available drawing files using the select
drawing file dialogue box.
155
Specify on the screen: select to use the pointing device to define the insertion point, scale and
rotation angle of the block on the drawing.
Explode: Select to insert the block as the individual objects that make up the block.
Draw toolbar
The attribute Definition dialogue box creates the attribute tag that appears in the drawing. When
a block is inserted, the attribute tag is replaced by the attribute value at the same location in the
block with the same text style and alignment.
Activate the attribute Definition dialogue box to create an attribute definition, which describes
the characters of the attributes. The characters include the tag prompt, value information, text
information and location.
4.2 HATCHING
Hatching in AutoCAD is a way of filling in areas of your drawing with a pre-formatted pattern to
represent certain materials. It is usually used in sectional views.
You can start the hatch command with one of the following options:
1. By typing H on the keyboard on the command line
156
Fig 4.2Hatch and gradient dialog box
The Boundary hatch dialogue box is accessed from the draw toolbar and contains the most
common patterns used in controlling hatch pattern definition.
Quick tab feature
Type: Sets the pattern type, there are three options:
User defined:- Allows you to define a pattern based on parallel line with spacing and
angle values, using the current line type.
Custom: -Allows you to select a hatch pattern definition not found in the supplied
acad.pat and acadiso.pat files
Pick point: Allows you to determine a boundary from a set of existing objects from which you
want to form an enclosed area. AutoCAD prompts you for a point inside the boundary to be
hatched.
The pick point will detect islands that are within the boundary generated. The space within the
island will not be hatched. This will also apply if the object(s) in question are text.
157
Select Object: Only the object selected will be hatched. The hatch will ignore objects that have
not been selected as boundaries.
Remove island select:objects that AutoCAD detects as island. This option is activated when a
hatch boundary is selected using "pick point" or "select object' option.
View selection:Hatch dialogue box disappears showing the current defined boundaries with hatch
setting that previewed.
There are few things that you have to do to get the hatch that you require. First you must select
the pattern that you want to use. Pick the PATTERN button to do this. Next you have to pick the
internal point that you need the hatch to fill. Use the PICK POINTS button to do this. You can
pick more than one internal point. The important thing to remember is that the entire boundary
must be visible on the screen, or AutoCAD will not be able to hatch it. Once you have picked
your pattern and points, pick on the PREVIEW button to see how the hatch will appear. If
everything is OK, press the
APPLY button. IF you need to change anything, you can adjust the scale and angle of the hatch
until it looks the way you want it to.
4.3 REGIONS
Regions are two-dimensional surfaces. They look like closed polylines, but AutoCAD can
calculate more information from regions than from polylines, such as the centroid, moments of
inertia, and other properties relating to mass. You can also create complex shapes by combining,
subtracting, and intersecting regions. While these commands are most often used for 3D
drawing, they are often used in 2D drawing as a preparation for 3D drawing. You create a region
from other objects. You can use closed polylines, closed splines, circles, ellipses, and
combinations of lines, arcs, and elliptical arcs that create a closed shape. The shape cannot
intersect itself like a figure below.
A complex region is shown below. Although it looks like a circle with seven circles inside it, it is
actually a circular surface with seven holes in it. When you select it, you can see that it is one
object.
158
The real proof of the pudding is when you try to extrude it to create a 3D object out of it. You
can then view it at an angle, hide background lines, and clearly see the holes, as shown in the
second figure.
To create a region, choose Region from the Draw toolbar. AutoCAD asks you to select
objects.
Select all the objects and press Enter to end object selection. If all the objects create a closed,
nonintersecting shape, AutoCAD tells you:
1 loop extracted.
1 Region created.
The original objects are deleted. If your objects aren’t perfectly end to end, AutoCAD merely
states:
0 loops extracted.
0 Regions created.
In order to draw your original objects end to end, remember to use Endpoint object snaps. Also,
don’t forget that you can start a line or arc at the end of the last point drawn by pressing Enter at
the first prompt.
If you had a hatch inside the objects, you lose hatch associativity. You can re-hatch the region if
you wish. When you create a region that is hatched, AutoCAD has no problem creating the
region but doesn’t quite know what to say about the hatch.
Here’s the response:
1 closed, degenerate or unsupported object rejected.
As mentioned earlier, you can combine, subtract, and intersect regions to create complex objects.
The three commands to accomplish these functions are UNION, SUBTRACT, and INTERSECT.
These commands are most often used in 3D drafting.
4.4 TEXT
159
Text conveys important information in your drawing. You use text for title blocks, to label parts of the
drawing, to give specifications, or to make annotations.
AutoCAD provides various ways to create text. For short, simple entries use line text. For longer entries
with internal formatting, use multiline text. Although all entered text uses the current text style, which
establishes the default font and format settings, you can customize the text appearance.
Multiline text
Edit text
Text style
Scale text
Justify text
between points
Convert distance
Using TEXT you can create one or more lines of text and end each line when you press ENTER.
Each text line is a separate object that you can relocate, reformat, or otherwise modify. To create
line text
2. Specify the insertion point for the first character. Press ENTER to locate the new text
immediately below the last text object you created, if any. If the text height is set to 0 in the
current text style, you are prompted to specify the height of the text.
160
3. Set the text height by dragging the pointing device until the distance between the cursor and
the insertion point indicates the text height you want. Or on the command line, enter a value in
drawing units.
4. Set a text rotation angle by dragging the pointing device until the angle between the cursor and
the insertion point represents the text rotation angle you want. Or on the command line, enter the
X, Y coordinate.
5. Enter the text. Press ENTER to end one line of text and begin another. The TEXT command
displays the text in the drawing as you type. Each line of text is a separate object. If you select
another point in the drawing while TEXT is active, the cursor moves to that point, and you can
continue entering text from there.
You can format text as you create it using the options on the command line. Justify determines
how the characters in the text line align with the insertion point. Style sets the default format
characteristics.
You cannot apply formats to individual words and characters using TEXT. If you want to apply
formats to individual words and characters, use MTEXT.
As you create text, you can align it horizontally. That is, you can justify it using one of the
alignment options shown in the following illustration. Left alignment is the default. To left-align
text, do not enter an option at the Justify prompt
Text alignment
When using Dtext Command the default alignment option is bottom left of text. There are a
variety of text alignment options available to enable you to replace text more precisely. When
you activate the Dtext command you will be presented with the following command line
options:-
161
Specify start point of text or [justify / Style]: Enter J to activate the text justify option
Align: Specifies both text height and text orientation by designating the end points of the
baseline. The text will be fitted between the two points, the text height reducing as the text string
becomes longer.
Fit: Fits text with in an are and at an orientation defined by two points
Center: Aligns text from the horizontal center of the baseline, which you specify with a point.
Middle: Aligns text at the horizontal center of the base line and the vertical center of the height
you specify with a point
Right: Specifies the right end point of text base line.As well as the text placement options
discussed ,you can specify justification based upon the 9 locations.
Multiline Text
Mtext creates paragraph that fit with in a text boundary. the boundary defines the width of the
paragraph to be entered onto the drawing. Mtext also allows you to specify text justification,
style, height, width, colour spacing and other text attributes. You can select any font within the
character tab, irrespective of the text style created using the text style dialogue box for use with
the Dtext.
Single-line text is awkward when you want to type quite a bit of text. The main disadvantage is
that single-line text does not use word wrap, a feature that wraps text to the next line to keep a
neat right margin. Multiline text (also called paragraph text and not to be confused with
162
multilines) solves this problem and also offers many more formatting options compared to
single-line text. The entire paragraph of multiline text is one object.
The edit box you use to create multiline text resembles Windows word processors and is
resizable.
You use this box both to create and also to edit text and its properties.
To create paragraph text, choose Multiline Text from the Draw toolbar. This starts the MTEXT
command. AutoCAD tells you the current style and text height. For example:
Current text style: ROMANS. Text height: 0.2 of a bounding box to specify where to place the
text.
At the Specify opposite corner or [Height/Justify/Line spacing/Rotation/Style/Width]: prompt,
specify the diagonally opposite corner of the bounding box. You can also choose one of the other
options to specify the text properties before you type in the text. The Multiline Text Editor is
shown in below.
Text Editing
LAB EXERCISE 4
#1 Using make block command create the following 3 objects and insert them in your current
drawing file using insert block.
163
# 2 Using Wblockwrite the following figure and insert it by opening new drawing file.
#3Draw this shape and hatch each possible section. It could looksomething like this when it is
done (check that you hatched all areas and the scale iscorrect.
164
#5 Draw the following figure using the necessary draw and modify commands.
165
#6Using the text style Arial of height 20and enclosing the wording within a polylinerectangle of
Width=5 and Fillet=10,construct the drawing shown below.
166
Lab Session 5
5.1 Layers
Drawing can be controlled by the use of layers, line types and colors. A complex drawing may
include text, construction line, and hidden details, dimensions various views, etc., all of which
combined would present the reader with to much information. A drawing could easily become
cluttered. By assigning aspects of your drawing to a particular drawing to a particular layer, i.e.,
text to the text layer, you can make visible only the information you wish to present. This chapter
will show you how to create new layers, allocating each layer its own specific color and line
type.
Complex drawing may contain a large number of elements. AutoCAD allows you to create as
many layers as is necessary to organize your drawing.
Think of a layer as a sheet of overhead transparency onto which you can place specific objects
such as text or dimensions. By switching these layers on or off you can determine the visibility
of specific elements within the drawing.
Controlling Layer
Layers are created and controlled from the layer properties manager dialogue box, which can be
located on the object toolbar ( ) or by selecting Layers… from the format pull down menu.
This dialogue box is used to assign each layer a specific name, line type and color.
167
Layer Properties
Layer Name - The name of layer, can be up to 31 characters in length, made up from
characters, digits or special characters (dollar $, hyphen and underscore_).
Freeze / Thaw - Controls the regeneration of the layer when a display is regenerated.
Thawed layers are regenerated. Freezing unneeded lavers increases regenerationspeed.
Locked / Unlocked - Objects on locked layers are visible but cannot be edited. Locked
layers can be current, can be drawn upon and line type and color can be changed.
Layer Plot table- Layers can be potable or non-plot table. A non-potable layer will be
visible on the screen but will not appear in a hard plot.
Color Number - The color number determines the color for visible layers. Default layer
color is 7 (white, though appears black on the screen!). Objects can override color assigned to
layers.
168
Linetype - Name of line type defined for that layer. Several layers can use the same line type.
Objects can override the line type assigned to a layer.
Lineweight- Displays the available line weights that can be applied to a layer
Press the layer button to activate the layer properties Manager Dialogue box.
Press the new button and enter the layer name Construction line.
Set the line type continuous on the construction line. This will activate the select linetype
dialogue box. Press Load… button to activate the load or reload line type dialogue box. Use the
scroll bar on the right of the box to look at the variety of linetypes available for selection.
Fig 5.2 Select line type and load and reload line type
dialog box
Color selection
169
When you start anew drawing, you will see in the colour control box in the object properties tool
bar that the colour is set to Bylayer, that is the colour set to layer 0,I.e white.You can change this
to any colour at any time irrespective of the colour setting on the current layer by selecting the
select colour dialogue box.Selection of colour will make it current and override that is set to the
current layer.
5.2DIMENSIONING
Dimensioning is one of the most important and time-consuming feature of drawing. a complex
drawing mar require a variety of dimensioning such as linear, radial and angular dimensions.
Parts of dimensioning
Dimension line: is a line that indicates the direction and extent of a dimension.
Extension line: extend from the feature to the dimension line
Arrowhead: are added to each end of the dimension line
Dimension text: is an optional text string that usually indicates the actual measurement.
Leader line: is a solid line leading from some annotation to the referenced feature.
170
Dimension tool bar
There are several ways in which the dimensions tools can be called:
2. From the Dimension toolbar. The toolbar can be called to screen with a right-click in any
toolbar on screen followed by a click on Dimension in the pop-up menu which appears.
3. Click Dimension in the menu bar. Tools can be selected from thedrop-down menu which
appears.
4. By entering an abbreviation for a dimension tool at the command line.
Any one of these methods can be used when dimensioning a drawing, butsome operators may
well decide to use a combination of the four methods.
Linear
171
Used to draw exactly horizontal and vertical dimensions
Example: Construct a rectangle 180x110 using the Polylinetool. Then Click on Linear in the
Dimensiontoolbar. The command line shows:
Command: _dimlinear
Specify first extension line origin or <selectobject>: pick
Specify second extension line origin: pick
Non-associative dimension created.
Specify dimension line location or [Mtext/Text/ Angle/Horizontal/Vertical/Rotated]: pick
Dimension text = 180
Command:
Figure below shows the 180 dimension. Follow exactly the same procedurefor the 110
dimension.
Aligned
Example:Construct the outline shown below using the Line tool. Left-click the Aligned tool
icon and dimension the outline. The prompts and replies are similar to the linear example.
172
Arc Length
Example:Construct two arcs of different sizes as in the following figure. Then click on Arc Length in the
Dimension toolbar or enterdimarc at the command line. The command line shows:
Command: _dimarc
Command:
Jogged radius
173
You can create jogged radius dimensions, also called “foreshortened radius dimensions,” when
the center of an arc or circle is located off the layout and cannot be displayed in its true location.
Example:Draw a circle and an arc as indicated in Figure below. Then Call the Jogged tool with
a click on Joggedin the Dimension toolbar or by entering jog at the command line.
Thecommand line shows:
Command: _dimjogged
Select arc or circle: pick the circle or the arc
Specify center location override: pick
Dimension text = 60
Specify dimension line location or [Mtext/Text/Angle]: pick
Specify jog location: pick
Command:
The results of placing as jogged dimension on a circle and an arc areshown below.
Dimension Style
Every dimension style has a dimension style associated with it. You can use default dimension
style or define your own. Dimension style manager dialogue box is used to modify existing or
create new dimension style. To activate this dialogue box, select Dimension style from the
Format menu.
174
Fig 5.4Dimension StyleManager dialog box
Dimension style dialogue box shows the current setting for the various linear, radial and angular
dimension. In case of the ISO-25 style shown, this means that dimensions are set to 2 decimal places and
dimensions are aligned along the dimension line using the standard text style.
Set current: To make selected style current if we have many dimension styles.
Press the new button on the dimension style manager dialogue box. Enter style name then press Continue
You will get new dimension style dialogue box.
175
Fig 5.5New dimension style dialog box
Is used to set the color and thickness of the dimension and extension lines
The size and type of arrow heads, selectable from the list, used for the dimension line and
leader.
The size types and visibility of a center mark for the circles.
Base line spacing for base line dimension style.
Text tab
Use this tab to set text style, color and position on the dimension line
Text alignment options includes
176
Forced horizontal
Aligned with the horizontal line
Set to the ISO standard
Fit tab
Use this tab to set the placement of the dimension text, line and arrows between the
extension lines. If there is limited room between the extension lines, these options allow
you to determine weather the text or arrows are forced out side the extension line.
Sets text placement when it is not possible to accept the default text position.
Overall scaling factor. Used to scale all the elements of the dimension to suit the drawing
scale.
Primary tab
Used to set alternate units format and placement. Dimension text will include both Metric
and imperial equivalent dimensions.
Tolerance tab
Use this tab to select and set one of three tolerance formats. These includes:-
Symmetrical, Deviation, Limits, Basic.
Before simple tolerances can be included with dimensions, new settings will need to be made in
the Dimension Style Manager dialog as follows:
1. Open the dialog. The quickest way of doing this is to enter d at the command line
followed by a right-click. This opens up the dialog.
177
2. Click the Modify … button of the dialog, followed by a left-click on the Primary
Units tab and the resulting sub-dialog make settings as shown in Figure below. Note
the changes in the preview box of the dialog.
To open the Object Property Manager window, click Properties on the Standard toolbar.
The
Properties window opens on your screen.
178
The Properties window can be used to directly edit objects, called Geometry in theProperties
window, but can be used for editing other object properties as well:
You can change the layer, color, linetype, linetype scale, and lineweight of objects.
You can edit text and text properties.
You can edit plot styles.
You can edit hyperlinks.
The Properties window contains two tabs. The Categorized tab organizes the types of properties
you can edit by category. In the properties window above, you see the result of opening the
Properties window with one line selected. Use the Geometry category to edit the line. The
Alphabetic tab contains the same information organized alphabetically.
To change either endpoint of the selected line, just type new coordinates in the Properties
window and press Enter. Of course, this method of editing a line is only useful when you know
the absolute coordinates. When you select a geometric property, such as Start X, the X
coordinate of the line’s start point, an arrow button appears. You can click this button and then
pick a new start point directly on your screen. The new point becomes the new start point of the
line, changing both the X and Y coordinates of the start point if your pick point requires it.
The information you see in the Properties window depends on whether objects are selected:
If you open the Object Properties Manager with no object selected, you see only
properties that apply to the entire drawing, such as UCS, current layer, and viewport data.
You can select an object while the window is open to display data on that object.
179
If one object is selected, you see both general information and geometrical information
on that object.
If more than one object is selected, you see general information such as layer, color, and
linetype data, but no geometry data.
If more than one object is selected and you choose one type of object from the drop-down
list at the top of the window, you see information applying only to that type of object.
This dropdown list provides a quick way to filter the type of objects you can edit.
LAB EXERCISE 5
#1. By opening a layer properties manager dialog box, create the following layers with the given
properties.
#2.Open any of the drawings previously saved from exercises and add appropriate dimensions.
#3.Construct the drawing shown below but inplace of the given dimensions add
dimensionsshowing tolerances of 0.25 above and below.
180
#4.Give the dimension for the following drawing which you construct in previous lab exercise.
Use appropriate layer for each line type.
#5.Give the dimension for the following figure which you construct in Lab exercise 2.
181
Lab Session 6
182
6.1 Orthographic projection
Orthographic projection involves viewing an article being described in a technical drawing from
different directions – from the front, from a side, from above, from below or from any other
viewing position. Orthographic projection often involves:
The drawing of details which are hidden, using hidden detail lines
Sectional views in which the article being drawn is imagined as being cut through and the
cut surface drawn
Centre lines through arcs, circles spheres and cylindrical shapes.
Example:
Taking the solid shown in Fig. 6.1, to construct a three-view orthographic projection of the solid:
1. Draw what is seen when the solid is viewed from its left-hand side and regard this as the
front of the solid. What is drawn will be a front view (Fig. 6.2).
183
Fig. 6.3 Front and end views of the
solid
184
Fig 6.5 Making the layer Center current from the Layers panel
7. Make the Text layer current and add border lines and a title block.
8. Make the Dimensions layer current and add all dimensions.
185
6.2 Sectional views
In order to show internal shapes of a solid being drawn in orthographic projection the solid is
imagined as being cut along a plane and the cut surface then drawn as seen. Common practice is
to hatch the areas which then show in the cut surface. Note the section plane line, the section
label and the hatching in the sectional view ( Fig. 7.10 ).
Adding hatching
186
Fig 6.8The Hatch and Gradient dialog and the A NSI Hatch Pattern Palette
3. In the dialog left-click the Pick an internal point button. The dialog disappears.
4. In the front view pick points as shown in the left-hand drawing of Fig. 6.9. The dialog
reappears. Click the Preview button of the dialog and in the sectional view which
reappears; check whether the hatching is satisfactory. In this example it may well be that
the Scale figure in the dialog needs to be entered as 2 in place of the default 1. Press the
Esc key of the keyboard and the dialog returns. Change the figure and Preview again. If
satisfied right-click.
187
Fig 6.9The result of hatching
6.3Isometric Drawings
An isometric drawing is a 2D drawing drawn to look like a 3D drawing. By drawing
parallelograms instead of squares, the drawing gives the impression of being in three dimensions.
AutoCAD enables you to do the same thing.
188
Understanding isometric planes
AutoCAD uses the ISOPLANE (short for isometric plane) command to rotate the crosshairs to
the special angles required for isometric drawing. You then toggle the ISOPLANE setting from
left to right to top to draw on each of the three “planes.” As you do so, AutoCAD changes the
angles of the crosshairs, snap, and grid to the appropriate angles.
These angles are 30 degrees for the X axis, 90 degrees for the Z axis, and 150 degrees for the Y
axis. As you toggle among the planes, you see the crosshairs take on various configurations of
these angles. The figure below shows the standard isometric cube. You can see three sides—left,
right, and top. In the figure, the crosshairs are set to the right isometric plane.
Isometric drawing is not often used for precise drawing because it can be difficult to specify the
exact points you need. Also, true 3D drawing has mostly supplanted isometric drawing. It is,
however, used for piping work as well as for illustrations.
There are three isometric angles – Isoplane Top,Isoplane Left and IsoplaneRight. These can be
set either by pressing the F5 function key or by pressing the Ctrl and E keys.Repeated pressing
of either of these ‘toggles’ between the three settings. Figure below is an isometric view showing
the three isometric planes.
189
The isometric circle
Circles in an isometric drawing show as ellipses. To add an isometriccircle to an isometric
drawing, call the Ellipse tool. The command lineshows:
Command: _ellipse
Specify axis endpoint of ellipse or [Arc/Center/Isocircle]:enter i (Isocircle)right-click
Specify center of isocircle:pick or entercoordinates
Specify radius of isocircle or [Diameter]: entera number
Command:
And the isocircle appears. Its isoplane position is determined by whichof the isoplanes is in
operation at the time the isocircle was formed.Figure below shows these three isoplanes
containing isocircles.
Example 1:
190
1. Working to the shapes and sizes given in the orthographic projection in Fig. 6.10, set
Snap on (press the F9 function key) and Grid on (F7).
2. Set Snap to Isometric and set the isoplane to Isoplane Top using F5.
3. With Line, construct the outline of the top of the model (Fig. 6.11) working to the
dimensions given in Fig.6.10.
4. Call Ellipse tool and set to isocircle and add the isocircle of radius 20 centered in its
correct position in the outline of the top (Fig. 6.11).
5. Set the isoplane to Isoplane Right and with the Copy tool;copy the top with its ellipse
vertically downwards three times asshown in Fig. 6.12.
6. Add lines as shown in Fig. 6.11.
7. Finally using Trim remove unwanted parts of lines and ellipsesto produce Fig. 6.12.
191
Fig. 6.11
Example 2:
Figure 6.4 is an orthographic projection of the model of which the isometric drawing is to be
constructed. Figure 6.5 shows the stages in its construction. The numbers refer to the items in the
list below.
Fig 6.13
192
1. In Isoplane Right construct two isocircles of radii 10 and 20.
Fig 6.14
LAB EXERCISE 6
Figure 1 below is an isometric drawing of a slider fitment on which the three exercises 1,2 and 3
are based.
193
Fig 1
#1 Figure 2 below shows a first angle orthographic projection of part of the fitment shown in the
isometric drawing in Fig. 1. Construct a three-view third angle orthographic projection of the
part.
Fig .2
#2 Figure 3 below shows a first angle orthographic projection of the other part of the fitment.
Construct a three-view third angle orthographic projection of the part.
194
#3Construct an isometric drawing of the part shown in Fig. 3 below.
Fig. 3
#4 .Figure 4 shows a pictorial drawing of the component shown in the three-view orthographic
projection of Figure.5. Construct the three views but with the font view as a sectional view based
on the section plane A – A.
Fig.4
195
Fig. 5
196
197
198
#6. Construct an isometric drawing of the angle plate shown in Figs 6 and 7.
199
Fig. 6 Fig. 7
# 7. Copy the following figure of Cotter joint with socket and spigot ends.
200
# 8.The two views of a model are given below. Copy the two views and generate a full sectional view by
replacing one of the views by chosing apropriate cutting line.
201
Lab session 7
3-DIMENSIONAL DRAWINGS
Objectives
following figure.
202
Poly solid tool
1. Make sure layer 0 is current.
2.Click Top in the ViewCube( Fig. 12.5 ) or in the view tool. The screen switches to a Top
view.
3. Construct an octagon of edge length 60 using the Polygon tool.
4.Set layer 0 current and click the house icon in the ViewCube or SE isometric in the view
toolbar. The screen switches to an Isometric view.
5.Call the Polysolidtool with a click on its tool icon in the 3D Modeling panel. The command
line shows:
Command: _Polysolid
Height = 0, Width = 0, Justification = Center
Specify start point or [Object/Height/Width/Justify] <Object>:enter h (Height)
Specify height <4 >: 60
Height = 60, Width= 0, Justification = Center
Specify start point or [Object/Height/Width/Justify] <Object >:enter w (Width)
Specify width <0 >:5
Height= 60, Width = 5, Justification = Center
Specify start point or [Object/Height/Width/Justify] < Object >:
Specify next point or [Arc/Undo]: pick one cornerof octagon
Specify next point or [Arc/Undo]: pick secondcorner
Specify next point or [Arc/Close/Undo]: pick third
203
Specify next point or [Arc/Close/Undo]: pick fourth
Specify next point or [Arc/Close/Undo]: pick fifth
Specify next point or [Arc/Close/Undo]: pick sixth
Specify next point or [Arc/Close/Undo]: pick seventh
Specify next point or [Arc/Close/Undo]: pick last
Specify next point or [Arc/Close/Undo]: enter c (Close)
Command:
And the Polysolidforms as shown in the above figure.
When constructing as a basis for constructing some forms of 3D model, select a tool from the
Home/Draw panel, or enter tool names or abbreviations for the tools at the command line. If
constructed using tools such as Line,Circle and Ellipse, before being of any use for 3D modeling,
outlines must be changed into regions with the Region tool. Closed polylines can be used without
the need to use the Region tool.
Example 1 – Line outline and Region
1. Construct the left-hand drawing of Figure below using the Linetool.
2. Click the Region tool from the Home/Draw panel or from the draw toolbar, or enterregat the
command line.
Command: _region
Select objects: window the drawing 12 found
Select objects: right-click
1 Region created
Command:
And the Line outline is changed to a region – right-hand drawing of the figure below.
204
Example 2: Union,Subtractregions
1. In the Top view, construct drawing 1 of Fig. below and withthe Copy tool
(Home/Modifypanel), copy the drawing three times toproduce drawings 2,3 and 4.
2. With the Region tool change all the outlines into regions.
3. Drawing 2 – call the Union tool from the Home/Solid Editing panel. The command line
shows:
Command: _union
Select objects: pick the left-hand region 1 found
Select objects: pick the circular region 1 found,2 total
Select objects: pick the right-hand region 1found, 3 total
Command:
4. Drawing 3 – with the Solid, Union tool form a union of the left-handregion and the circular
region.
5. Drawing 4 – call the Subtract tool, also from the Home/Solid Editingpanel. The command
line shows:
Command: _subtract Select solids and regions to subtract from …
Select objects: pick the region just formed 1 found
Select objects: right-click
Select solids and regions to subtract: pick the right-hand region 1 found
Select objects: right-click
Command:
205
Example 3: Intersect and Region
1. Construct drawing 1 of Figbelow.
2. With the Region tool, change the three outlines into regions.
3. With the Copy tool, copy the three regions.
4. Drawing 2 – call the Intersect tool from the Home/3D Modelingpanel. The command line
shows:
Command: _intersect
Select objects: pick one of the circles 1 found
Select objects: pick the other circle 1 found, 2 total
Select objects: right-click
Command:
And the two circular regions intersect with each other to form a region.
5. Drawing 3 – repeat using the Intersect tool from the Home/SolidEditing panel on the
intersection of the two circles and the rectangularregion.
206
The Extrude tool
With EXTRUDE, you can create solids by extruding (adding thickness to) selected objects. You
can extrude closed objects such as polylines, polygons, rectangles, circles, ellipses, closed
splines, donuts, and regions. You cannot extrude 3D objects, objects contained within a block,
polylines that have crossing or intersecting segments or plotlines that are not closed. You can
extrude an object along a path, or you can specify a height value and a tapered angle.
Use EXTRUDES to create a solid from a common profile of an object, such as a gear or
sprocket. EXTRUDE is particularly useful for objects that contain fillets, chamfers, and other
details that might otherwise be difficult to reproduce except in a profile. If you create a profile
using lines or arcs, use the Join option of PEDITto convert them to a single polyline object or
make them into a region before you use EXTRUDE.
Tapering the extrusion is useful specifically for parts that need their sides defined along an angle,
such as a mold used to create metal products in a foundry. Avoid using extremely large tapered
angles. If the angle is too large, the profile can taper to a point before it reaches the specified
height.
The Extrudetool can be called with a clickon its tool icon in theHome/3D Modeling panel, from
the Modeling toolbar, from the Draw drop-down menu, or by enteringextrude or its abbreviation
ext at the command line.
Example 1: the use of extrude tool
207
From the first example of forming a region:
1. Call the Extrude tool. The command line shows:
Command: _extrude
Current wire frame density: ISOLINES = 4
Select objects to extrude: pick region 1 found
Select objects to extrude: right click
Specify height of extrusion or [Direction/Path/Taper angle] <45> :enter 50 right-
click
Command:
2. Select SE Isometric . The extrusion appears in an isometricview.
3. Call Zoom and zoom to 1.
N.B:Note the Current wire frame density: ISOLINES = 4 in theprompts sequence when
Extrude is called. The setting of 4 is suitablewhen extruding plines or regions consisting of
straight lines, butwhen arcs are being extruded it may be better to set ISOLINES to ahigher
figure as follows:
Command: - enter isolines right-click
Enter new value for ISOLINES <4>: enter 16 right-click
Command:
Example 2: From the second example of forming a region:
1. Set ISOLINES to 16.
2. Call the Extrude tool. The command line shows:
Command: _extrude
Current wire frame density: ISOLINES =16
Select objects to extrude: pick the region 1 found
Select objects to extrude: right-click
Specify height of extrusion or [Direction/Path/Taper angle]:
enter t right-click
Specify angle of taper for extrusion: enter 5right-click
Specify height of extrusion or [Direction/Path/Taper angle]: enter 100 right-click
Command:
3.Click on the SE isometric View.
208
4. Zoom to 1.
The result is shown in Figure above.
Example 3:From the third example of forming a region:
Revolve tool
With REVOLVE, you can create a solid by revolving a closed object about the X or Y axis of the
current UCS, using a specified angle. You can also revolve the object about a line, polyline, or
two specified points. Similar to EXTRUDE, REVOLVE is useful for objects that contain fillets
or other details that would otherwise be difficult to reproduce in a common profile. If you create
a profile using lines or arcs that meet a polyline, use the PEDIT Join option to convert them to a
single polyline object before you use REVOLVE.
You can use REVOLVE on closed objects such as polylines, polygons, rectangles, circles,
ellipses, and regions. You cannot use REVOLVE on 3D objects, objects contained within a
block, polylines that have crossing or intersecting segments, or polylines that are not closed.
209
TheRevolvetool can be called with a click on its tool icon in theModeling toolbar, by a click on
its tool icon in the Home/3D Modelingpanel, by a click on its name in the Modeling sub-menu
of the Drawdrop-down menu, or by entering revolve at the command line, or itsabbreviation rev
.
Example 2:
210
1. Construct the pline (left-hand drawing of the figure belo ). The drawingmust be either a
closed pline or a region.
2. Call Revolve and form a solid of revolution through 180 °.
3. Place the model in the SE Isometric view. Zoom to 1.
The result is shown in the right-hand side of Figure below.
Box tool
You can use BOXto create a solid box. The base of the box is always parallel to the XY plane of
the current UCS.
The RECTANGor PLINEcommand creates a rectangle or closed polyline from which you can
create a box using EXTRUDE. The 3D command creates a box shape defined by surfaces only.
Example:
1. Place the window in the Front view.
2.Click the Box tool icon in the Home/3D Modelingpanel .The command line shows:
Command: _box
Specify first corner or [Center]: 90,90 enterright-click
Specify other corner or [Cube/Length]: enter110, – 30 right-click
Specify height or [2Point]: enter 75 right-click
211
Command: right-click
BOX Specify first corner or [Center]: 110, 90 right-click
Specify other corner or [Cube/Length]: 170, 70right-click
Specify height or [2Point]: 75right-click
Command: right click
BOX Specify first corner or [Center]: 110,–10
Specify other corner or [Cube/Length]: 200,–30
Specify height or [2Point]: 75
Command:
3. Place in the SEIsometric view. Zoom to 1.
4. Call the Union tool from the Home / Solid Editing panel.
The commandline shows:
Command: _union
Select objects: pick one of the boxes 1 found
Select objects: pick the second of box 1 found, 2 total
Select objects: pick the third box 1 found, 3 total
Select objects: right-click
Command:
And the three boxes are joined in a single union as shown in the figure.
Cone tool
You can use CONE to create a solid cone defined by a circular or an elliptical base tapering to a
point perpendicular to its base. By default, the cone's base lies on the XY plane of the current
UCS. The height, which can be positive or negative, is parallel to the Z axis. The apex
determines the height and orientation of the cone.
To create a truncated cone or a cone that requires a specific angle to define its sides, draw a 2D
circle and then use EXTRUDE to taper the circle at an angle along the Z axis. To complete the
truncation, you can subtract a box from the tip of the cone with the SUBTRACT command.
CIRCLE creates a circle from which you can create a cone using EXTRUDE with its Taper
option. The 3D command creates a conical shape defined by surfaces only.
212
Cylinder tool
You can use CYLINDER to create a solid cylinder with a circular or an elliptical base. The base
of the cylinder lies on the XY plane of the current UCS.
If you want to construct a cylinder with special detail, such as grooves along its sides, create a
2D profile of its base with a closed PLINE and use EXTRUDE to define its height along the Z
axis. CIRCLE creates a circle from which you can create a cylinder using EXTRUDE.
Sphere Tool
You can use SPHERE to create a solid sphere based on a center point and a radius or diameter.
Its latitudinal lines are parallel to the XY plane, and the central axis is coincident with the Z axis
of the current UCS.
To create a dome or dish, combine a sphere with a box and use SUBTRACT. If you want to
create a spherical object that has additional detail, create 2D profile and use REVOLVE to define
a rotation angle about the Z axis. The 3D command creates a spherical shape defined by surfaces
only.
Torus tool
You can use TORUS to create a ring-shaped solid similar to the inner tube of a tire. The torus is
parallel to and bisected by the XY plane of the current UCS.
To create a lemon-shaped solid, use a negative torus radius and a positive number of greater
magnitude for the tube radius. For example, if the torus radius is -2.0, the tube radius must be
greater than 2.0.
A torus may be self-intersecting. A self-intersecting torus has no center hole because the radius
of the tube is greater than the radius of the torus. The 3D command creates a toroidal shape
defined by surfaces only.
Wedge tool
You can use WEDGE to create a solid wedge. The base of the wedge is parallel to the XY plane
of the current UCS with the sloped face opposite the first corner. Its height, which can be
213
positive or negative, is parallel to the Z axis. The 3D command creates a wedge shape defined by
surfaces only.
214
Example: Cylinder, Cone andSphere
1. Call the Cylinder tool and with a centre 170,150 construct a cylinderof radius 60 and height
15 .
2. Click the Cone tool in the Home/3D Modelingpanel. The commandline shows:
Command: _cone
Specify center point of base or [3P/2P/Ttr/Elliptical]: 170,150
Specify base radius or [Diameter]: 40
Specify height or [2Point/Axis endpoint/Topradius]: 150
Command:
3. Call the Sphere tool and construct a sphere of centre170,150 andradius 45 .
4. Place the screen in the Front view and with the Move tool, move thecone and sphere so that
the cone is resting on the cylinder and thecentre of the sphere is at the apex of the cone.
5. Place in the SE Isometric view, Zoom to 1 and with Unionform a single 3D model from the
three objects.
215
1. Click the Box tool icon in the Home/3D modelingpanel and constructtwo boxes, the first from
corners 70,210 and 290,120 of height 10, thesecond of corners 120, 200, 10and 240, 120, 10and
of height 80.
2. Place the screen in the Front view and Zoom to 1.
3. Click the Wedge tool icon in the Home/3D modelingpanel. Thecommand line shows:
Command: _wedge
Specify first corner or [Center]: 120,170,10
Specify other corner or [Cube/Length]: 80,160,10
Specify height or [2Point]: 70
Command: right-click
WEDGESpecify first corner of wedge or [Center]:240, 170, 10
Specify corner or [Cube/Length]: 280, 160, 10
Specify height or [2Point]: 70
Command:
4. Place the screen in the SE Isometric view and Zoom to 1.
5. Call the Union tool from the Home/Solid Editing panel and inresponse to the prompts in
the tool’s sequences pick each of the 4objects in turn to form a union of the 4 objects.
1. Using the Cylinder tool from the Home/3D modelingpanel, constructa cylinder of
centre180,160 , of radius 40 and height 120 .
2. Click the Torus tool icon in the Home/3D modelingpanel. Thecommand line shows:
Command: _torus
Specify center point or [3P/2P/Ttr]: 180, 160,10
Specify radius or [Diameter]: 40
Specify tube radius or [2Point/Diameter]: 10
Command: right-click
TORUSSpecify center point or [3P/2P/Ttr]: 180,160,110
Specify radius or [Diameter] < 40 >: right-click
Specify tube radius or [2Point/Diameter] <10 >: right-click
216
Command:
3. Call the Cylinder tool and construct another cylinder of centre180,160, of radius 35 and
height 120.
4. Place in the SE Isometric view and Zoom to 1.
5. Click the Union tool icon in the Home/Solid Editingpanel and form aunion of the larger
cylinder and the two tori.
6. Click the Subtract tool icon in the Home/Solid Editing panel andsubtract the smaller cylinder
from the union.
Sweep tool
With the SWEEP command, you can create a new solid or surface by sweeping an open or
closed planar curve (profile) along an open or closed 2D or 3D path. SWEEP draws a solid or
surface in the shape of the specified profile along the specified path. You can sweep more than
one object, but they all must lie on the same plane.To call the tool click on its tool icon in the
Home/3D Modelingpanel
Example – Sweep
1. Construct the pline outline ( Fig. A) in the Top view.
2. Change to the Front view, Zoom to 1 and construct a pline as shown in Fig. B as a path
central to the ellipse.
3. Place the window in a SE Isometric view and click the Sweep tool icon. The command
line shows:
Command: _sweep
Current wire frame density: ISOLINES = 4
Select objects to sweep: pick the ellipse 1 found
Select objects to sweep: right-click
Select sweep path or [Alignment/Base point/Scale/Twist]: pick the pline
Command:
The result is shown in Fig. C.
217
Fig A Fig B Fig C
Loft tool
With the LOFT command, you can create a new solid or surface by specifying a series of cross
sections. The cross sections define the profile (shape) of the resulting solid or surface. Cross
sections (generally, curves or lines) can be open (for example, an arc) or closed (for example, a
circle). LOFT draws a solid or surface in the space between the cross sections. You must specify
at least two cross sections when you use the LOFT command.
To call the tool, clickon its icon in the Home/3D modeling panel.
Example:Loft
1. Construct the seven circles shown in Fig. D at vertical distances of30 units apart.
3. Call the Loft tool with a click on its tool icon in the Home/3Dmodeling panel
Command: _loft
Select cross-sections in lofting order: <Snapoff >pick the bottom circle 1 found
218
Select cross-sections in lofting order: pick the next circle 1 found, 2 total
Select cross-sections in lofting order: pick the next circle 1 found, 3 total
Select cross-sections in lofting order: pick the next circle 1 found, 4 total
Select cross-sections in lofting order: pick the next circle 1 found, 5 total
Select cross-sections in lofting order: pick the next circle 1 found, 6 total
Select cross-sections in lofting order: pick the next circle 1 found, 7 total
5.Click the Smooth Fit radio button to make it active, followed by a clickon the OK button. The
loft appears.
219
Fig. D Fig. E
LAB EXERCISE 7
#1.Figure 1A below shows the pline outline fromwhich the polysolid outline of Fig. 1B hasbeen
constructed to a height of 100 andWidth of 3 . When the polysolid has beenconstructed,
construct extrusions can thenbe subtracted from the polysolid. Sizes of theextrusions are left to
220
your judgment.
Fig. 1A Fig. 1B
#2Thefigure below shows a 3D model constructedfrom four polysolids which have been
formedinto a union using the Union tool from theModify panel. The original polysolid
wasformed from a hexagon of edge length 30. The original polysolid was of height 40 andWidth
5. Construct the union.
221
# 3Figure below shows the 3D model fromExercise 2 acted upon by the Press pull tool,which
can be called by entering Respell atthe command line. With the 3D model fromExercise 2 on
screen and using the Press pulltool, construct the 3D model shown inbelow. The distance of the
pull can beestimated.
# 4Figure below shows the outline from whicha solid of revolution can be constructed.Use the
Revolve tool from the Home/3Dmodeling panel to construct the solid ofrevolution.
222
# 5Working to the dimensions given in fig below, construct an extrusion of the plate to a
heightof 5 units.
#6Construct a 3D solid model of a bracketworking to the information given in the following fig.
223
#7Working to the polylines shown in Fig.7Aconstruct the Sweep shown in Fig. 7B.
Fig. 7A
Fig. 7B
224
Fig. 8A Fig. 8B
Lab Session 8
225
Objectives
1. Click New in the View/Viewports panel or from the menu bar click View →
Viewports→ New. The Viewports dialog appears as shown below.
In the dialog:
226
2. Click the New Viewports tab and a number of named viewports systems appear in the
Standard Viewports list in the dialog.
3. Click the name Four: Equal, followed by a click on 3D in the Setup pop-up list. A
preview of the Four: Equal viewports screen appears showing the views appearing in
each of the four viewports.
4. Click in each viewport in the dialog in turn, followed by selecting Conceptual from the
Visual Style pop-up list.
5. Click the OK button of the dialog and the AutoCAD 2009 drawing area appears showing
the four viewport layout.
6. Click in each viewport in turn and Zoom to All.
227
2.Click in each viewport in turn, making the selected viewport active, andZoom to 1.
3.Using the Polyline tool, construct the outline of the plan view of theplate of the support,
including the holes in the Top viewport (Fig. 8.2).Note the views in the other viewports.
4.Call the Extrude tool from the Home/3D modelingpanel and extrudethe plan outline and the
circles to a height of 20.
5.With Subtract from the Home/Solids Editing panel, subtract the holesfrom the plate (Fig.
8.3).
6.Call the Box tool & in the centre of the plate construct a box ofWidth=60, Length=60 and
Height =30.
7.Call the Cylinder tool and in the centre of the box construct a cylinderof Radius=20 and of
Height=30.
Fig 8.1
228
Fig 8.2
229
Fig 8.3
12. Click in the Right viewport and with the Move tool, move the twowebs into their correct
position between the box and plate. Then, withUnion, form a union between the webs and the
3D model.
13. In the Right viewport, construct the other two webs and in the Frontviewport, move, mirror
and union the webs as in steps 12 and 13.
230
Fig 8.4
1. Open the Four: Left viewport layout from the Viewports dialog.
2. Make a new layer of color magenta and make that layer current.
3. In the Top viewport construct an outline of the web of the SupportBracket shown in Fig. 8.5. With the
Extrude tool, extrude the partsof the web to a height of 20.
Fig 8.5
231
4. With the Subtract tool, subtract the holes from the web.
5. In the Top viewport, construct two cylinders central to the extrusion,one of radius 50 and
height 30, the second of radius 40 and height 30.With the Subtract tool, subtract the smaller
cylinder from thelarger.
6.Click in the Front viewport and move the cylinders verticallyby 5 units. With Union form a
union between the cylinders andthe web.
7. Still in the Front viewport and at one end of the union, construct two cylinders, the first of
radius 10 and height 80, the second of radius 15and height 80. Subtract the smaller from the
larger.
8. With the Mirror tool, mirror the cylinders to the other end ofthe union.
9. Make the Top viewport current and with the Move tool, move thecylinders to their correct
position at the ends of the union. Form aunion between all parts on screen.
10. Make the Isometric viewport current. From the Home/View panelselect Realistic.
232
Fig 8.6
Example 3: Three: Right viewports
1. Open the Three: Right viewport layout from the Viewports dialog.Make sure the 3D setup is
chosen.
2. Make a new layer of color Green and make that layer current.
3. In the Front viewport (top left), construct a pline outline to thedimensions in Fig. 8.7.
4. Call the Revolve tool from the Home/3D modeling panel and revolvethe outline through 360
°.
5. In each of the three viewports in the Home/View panel selectConceptual from its pop-up list.
233
Fig 8.7
Fig 8.8
8.2 Creating 3D Model Libraries
In the same way as 2D drawings of parts such as electronics symbols,engineering parts, building
symbols and the like can be saved in a file asblocks and then opened into another drawing by
dragging the appropriateblock drawing from the Design Center, so can 3D models.
234
1.Construct 3D models of the parts for a lathe milling wheel holder todetails as given in Fig. 8.9,
each on a layer of different colors.
2.Save each of the 3D models of the parts to file names as given inFig. 14.1 as blocks using
Create from the Blocks & Reference/Blockpanel. Save all seven blocks and delete the drawings
on screen. Savethe drawing with its blocks to a suitable file name (e.gFig01.dwg).
235
Fig 8.10
5.In the Design Centerclick the directory Lab 8(the directory that you saved your files for this
lab), followed by another click on Fig01.dwgand yet another click on Blocks. The saved blocks
appear as icons in the right-hand area of the DesignCenter.
6.Drag and drop the blocks one by one into one of the viewports on screen. Figure 8.11 shows
the Nut block ready to be dragged into the Right viewport. As the blocks are dropped on screen,
they will needmoving into their correct positions in suitable viewports using the Move tool from
the Home/Modify panel.
Fig 8.11
7. Using the Move tool, move the individual 3D models into their final places on screen and
shade the Isometric viewport using Conceptual shading from the Home/View panel
(Fig. 8.12).
236
Fig
8.12
Note:
1. It does not matter which of the four viewports any one of the blocksis dragged and dropped
into. The part automatically assumes theview of the viewport.
2. If a block destined for layer 0 is dragged and dropped into the layerCenter (which in our
acadiso.dwtis of colourred and of linetypeCENTER2 ), the block will take on the colour (red)
and linetype ofthat layer ( CENTER2 ).
3. In this example, the blocks are 3D models and there is no need touse the Explode tool option.
237
Example 2: A library of fastenings
3. Such blocks of 3D models can be dragged and dropped into position inany engineering
drawing where the fastenings are to be included.
238
LAB EXERCISE 8
#1A two-view orthographic projection of arotatable lever from a machine is given in Fig. 1A, together
with an isometric drawing ofthe 3D model constructed to the details givenin the drawing of Fig.
1B.Construct the3D model drawing in a Four: Equalviewportsetting.
Fig. 1A Fig. 1B
239
# 2Working in a Three: Left viewport setting, construct a 3D model of the faceplate to the
dimensions given in Fig. 2A. With the Mirror tool, mirror the model to obtain an opposite
facing model. In the Isometric viewport call the Hide tool (Fig. 2B).
Fig. 2A Fig. 2B
240
Lab session 9
To give examples of the use of the tools from the Home/Solid Editing panel:
3D Array – Rectangular &Polar 3D arrays
3D Mirror
3D Rotate
To give examples of the use of the Section tool from the Home/Solid Editing panel;
To give examples of the use of the Helix tool;
241
Fig 9.1 Fig 9.2
2. Click on the 3D Array icon in the Modify/3D Operations menu (Fig. 9.2). The
command line shows:
Command: _3darray
Select objects: pick the extrusion 1 found
Select objects: right-click
Enter the type of array [Rectangular/Polar]< R >:right-click
Enter the number of rows (—) <1 >:enter 3 right-click
Enter the number of columns (III): enter 3 right-click
Enter the number of levels (...): enter 4 right-click
Specify the distance between rows (—): enter 100 right-click
Specify the distance between columns (III): enter 100 right-click
Specify the distance between levels (...): enter 300 right-click
Command:
3. Place the screen in theIsometric view.
4. Shade using the Home/View/Conceptual visual style. The resulting figure is shown above.
242
Example 2: APolar Array
Command: _3darray
Command:
9.23DMirror Tool
Example:3D Mirror
243
1. Working on a layer color green, construct the outline in Fig. 9.3.
Command: _3dmirror
Command:
244
Fig 9.4
Example 2: 3D Mirror
1.Construct a solid of revolution in the shape of a bowl in the Front view working on a layer of
color yellow (Fig. 9.5).
2.Click 3D Mirror in the Modify/3D Operations drop-down menu. The command line shows:
Command: _3dmirror
Select objects: pick the bowl 1 found
Select objects: right-click
Specify first point on mirror plane (3 points): pick
Specify second point on mirror plane: pick
Specify third point on mirror plane: enter .xy right-click (need Z): enter 1 right-click
Delete source objects? : [Yes/No] : < N >: right-click
Command:
The result is shown in Fig. 9.6.
3. Place in the Isometric view.
4.Shade using the Home/View/Conceptual visual style (Fig. 9.6).
245
Fig. 9.5The3D model Fig 9.6 3D Mirror – the result in a Isometric view
Example 1: 3D Rotate
1.Use the same 3D model of a bowl as for the last example. Call the 3DRotatetool from the 3D
Operations sub-menu of the Modify dropdownmenu. The command line shows:
Command: pick 3D Rotate from the Modify drop-down menu
3DROTATE
Command:
3. Place in the Isometric view and in Conceptual shading. The result is shown in the above
figure.
246
9.4 Slice Tool
Example:Slice
1.Construct a 3D model of the rod link device shown in the two-view projection in Fig. 9.7 on a layer color
green.
Fig 9.7
Fig 9.8
Command: _slice
Select objects: pick the 3D model
Select objects to slice: right-click
Specify start point of slicing plane or
[planarObject/Surface/Zaxis/View/XY/YZ/ZX/3points]<3points >: pick
Specify second point on plane: pick
Specify a point on desired side or [keep Bothsides] < Both >:right-click
Command:
247
Figure 9.9 shows the picked points.
Fig 9.9
4. With the Move tool, move the lower half of the sliced model away fromthe upper half.
6. Shade in Conceptual visual style. The result is shown in Fig. 8.10 below.
Fig 9.10
9.5SECTION TOOL
Example: Section
1. Construct a 3D model to the information given in Fig. 14.27 on layersof different colors. Note
there are three objects in the model - a box,a lid and a cap.
248
Fig 9.11
4. Click the Section Plane tool icon in the Home/3D Modeling panel(Fig. 9.12). The command
line shows:
Command: _section
Select objects: window the model 3 found
Select objects: right-click
Select first point on Section plane by [Object/Zaxis/View/XY/YZ/ZX/3points _ 3points _
:pick first point
Specify second point on plane: pick first point
249
Specify third point on plane: enter .xy right-click
of (need Z): enter 1 right-click
Command:
5. Place the drawing in the Front view.
6. Close all layers except Hatch.
7. Shade in realistic mode.
Fig 9.13
The Helix tool can be called with a click on its tool icon in the extension ofthe Home/3D
Modelingpanel (fig 9.14)
Example:Helix
1. Construct the triangular outline shown in Fig. 9.15(left side) using the Polylinetool. Make sure
the pline outline is placed at right angles to the bottomend of the helix as shown in Fig.
9.15(right side). This may mean moving and rotating the outline in a selection of the ViewCube
views.
250
3. Call the Helix tool from the Home/3D Modeling panel (Fig. 9.14) orfrom the Modeling
toolbar. The command line shows:
Command: _Helix
Specify helix height or [Axis endpoint/Turns/turnHeight/tWist] < 1 >: enter 100 right-
click
Command:
4. Call the Extrude tool form the 3D Modeling panel and extrude theoutline along the path of
the helix. The command line shows:
Command: _extrude
Command:
5. Add three cylinders, one to fi t inside the helix, the second to form theshank of the screw, the
third for the head of the screw. Subtract a boxfrom the head for the screw slot. Then union the
four parts of the screw.
6. Shade the screw using the Conceptual visual style.
251
The result is shown in Fig. 9.17.
LAB EXERCISE 9
#1Construct a 3D model drawing of theseparating link shown in the two-viewprojection (figure
below). With the Slice tool,slice the model into two parts and remove therear part. Place the front
half in an isometric view using the View Cube. Shade the resultingmodel.
252
# 2Working to the dimensions given in the two orthographic projections (Fig.2A), andworking
on two layers of different colors,construct an assembled 3D model of theone part inside the
other. With the Slice tool,slice the resulting 3D model into two equalparts, place in an isometric
view and call theHide tool as indicated in Fig.2B. Shade theresulting model in Realistic mode.
253
Fig. 2A
254
Fig. 2B
255
Lab Session 10
Objectives
1. Click the Workspace Switching button and click 3D Modeling fromthe menu which appears
(Fig. 10.1).
256
Fig 10.1 Fig 10.2The 3D modeling work space
Command:
4. Open the Options dialog with a right-click in the Command palette,followed by a click on
Options … in the menu which appears.
257
5. Click the Colors tab. The Drawing Window Colors dialog appears. Set Uniform Background
color to White (Fig.10.3).
Fig 10.3In the Options dialog set all background colors to White
6. Set Units to a Precision of 0, Snap to 5 and Grid to 10. Set Limits to420,29. Zoom to All .
7. In the Options dialog click the Files label and click Default TemplateFile Name for QNEW (
Fig. 10.4 ) followed by a click on the Browsebutton which brings up the Select Template dialog,
from which theacadiso3d.dwt can be selected. Now when AutoCAD is openedfrom the desktop,
the acadiso3D.dwt template will open.
8. Set up 5 layers of different colors. In my template these have beennamed after the colors
( Fig. 10.5 ).
9. Save the template to the name acadiso3D and then enter a suitabledescription in the Template
Definition dialog.
258
Fig 10.4 Setting the default template setting in the Options dialog
10.2 Pallets
259
Click the Tool Palettesicon in the View/Palettes panel (Fig. 10.6). TheTool Palettes – All
Palettespalette appears docked at the right-hand edgeof the AutoCAD window. Drag the palette
away from its docked position.
Right-click in the title bar of the palette and a right-click menu appears(Fig. 10.7). In Fig. 10.7
the Draw palette is showing.
Fig 10.7The Tool Palettes – All Palettes palette with its right-click menu
260
To choose the tool palette required for the work in hand, either click onthe name of the required
palette in the tabs at the right-hand side of AllPalettes palette or, if the required name is not
showing, select the palettename from the right-click menu appearing with a right-click in the
bottomleft-hand corner of the All Palettes palette (Fig. 10.8).
The All Palettes palette can be docked against the side of the AutoCADwindow if needed.
261
Applying materials
Materials can be applied to a 3D model directly from icons in a selectedpalette. Three examples
follow – applying a masonry material, applying awood material and applying a metal material.
Examples of applying materials:
In the two examples which follow, lighting effects are obtained by turning Sun Status on, by
clicking the Sun Status icon in the Visualize/Sun panel (Fig. 10.9). The Lighting – Viewport
Lighting Mode dialog appears (Fig. 10.10). Click Turn off the default lighting
(recommended).
262
Fig 10.11The Render icon from the Output / Render panel
Example 1:applying a masonry material
Construct the necessary 3D model. In the All Palettes palette click the tablabelled Masonry –
Materials Sample. Right-click on the icon representingthe material to be applied to the model
and from the menu which appears,click Apply Materials To Objects. A small icon similar to a
paint brushappears with a small square. Move the square until it is on part of the modelto which
the material is to be applied and left-click, followed by a right-click.
Then render the model. Figure 10.12 shows the resulting rendering.
263
Example2: applying a metal material
Construct the necessary 3D model. From the All Palettes palette clickthe tab labelled Metals –
Materials Sample. Right-click on the iconrepresenting the material to be applied to the model
and from the menuwhich appears, click Apply Materials To Objects. Left-click the model tobe
rendered, followed by a right-click and render the model. The renderingis shown in Fig. 10.13.
The tool icons and menus in the Output/Render panel are shown in Fig. 10.14.
264
The LIGHTS tools
The different forms of lighting from light palettes are shown in Fig. 10.15 .There are many forms
of lighting available when using AutoCAD; the most frequently used include the following:
Ambient lighting is taken as the general overall light that is all around and surrounding
any object. Usually left at 30%.
Point lights shed light in all directions from the position in which the light is placed.
Distant lights send parallel rays of light from their position in the direction chosen by the
operator.
Spotlights illuminate as if from a spotlight. The light is in a direction set by the operator
and is in the form of a cone, with a ‘ hotspot ’ cone giving a brighter spot on the model
being lit.
Photometric lighting is lighting in which lights of a selected wattage can be placed in a
lighting scene. The set variable LIGHTINGUNITS must be set to 1 or 2 for photometric
lights to function.
Viewport lighting mode in Default lighting or User light/sunlight. Sun light, which
can be edited.
Sky background and illumination.
Other forms of lighting are shown in Fig. 10.15. In this book, examples of lighting methods
shown in examples will only be concerned with the use of Point and Direct lights, together with
Default lighting.
265
Fig 10.15The Lights tools palettes
LAB EXERCISE 10
Fig. 1A
266
Fig.
1B
# 2 Construct the 3D model of the two parts of stand and support projection given in Fig 2A.Add
different materials to the parts of the assembly as shown in Fig 2B and render theresult.
267
Fig 2A
Fig 2B
268
Lab session 11
Objectives
To introduce the use of tools from the Solid Editing panel;
To show examples of a variety of 3D solid models;
The Solid Editing tools can be called from the Home/Solid Editing panel or from the Solid
Editing toolbar.Examples of the results of using some of the Solid Editing tools are shown in
this lab session. These tools are of value if the design of a 3D solid model needs to be changed
(edited), although some are useful for constructing parts of 3D solids which cannot easily be
constructed using other tools.
Fig 11.1
4. In the ViewCube / Top move the pline to lie central to the cylinder.
269
5. Place the screen in the Isometricview.
6. Click the Extrude faces tool icon in the Home / Solid Editing panel. The command line
shows:
Command: _solidedit
Solids editing automatic checking: SOLIDCHECK = 1
Enter a solids editing option [Face/Edge/Body/Undo/eXit] <eXit>: _face
Enter a face editing option
[Extrude/Move/Rotate/Offset/Taper/Delete/Copy/coLor/mAterial/Undo/eXit] <eXit>:
_extrude
Select faces or [Undo/Remove]: 2 faces found.
Select faces or [Undo/Remove/ALL]: enter r right-click
Remove faces or [Undo/Add/ALL]: pick 1 face found,1 removed.
Specify height of extrusion or [Path]: enter pright-click
Select extrusion path: pick the path pline
Solid validation started.
Solid validation completed.
Enter a face editing option
[Extrude/Move/Rotate/Offset/Taper/Delete/Copy/coLor/mAterial/Undo/eXit]<eXit>:
right-click
Command:
7. Repeat the operation using the view at the other end of the cylinder.
8. Add lights and a material and r ender the 3D model (Fig. 11.2).
270
Fig 11.2
1. Construct the 3D solid drawing shown in the left-hand drawing of Fig. 11.3 from three boxes
which have been united using the Union tool.
2. Click on the Move faces tool in the Home/Solid Editing panel. The command line shows:
Command: _solidedit
[Prompts]: _face
Enter a face editing option[prompts]: _move
Select faces or [Undo/Remove]: pick face 1 face found.
Select faces or [Undo/Remove/ALL]: right-click
Specify a base point or displacement: pick
Specify a second point of displacement: pick
[Further prompts]:
And the picked face is moved – right-hand drawing of Fig. 11.3
271
Fig.11.3
272
Fig 11.4
1. Construct the 3D model as in the left-hand drawing of Fig. 11.5. Place in Isometricview.
2. Call Taper faces. The command line shows:
Command: _solidedit
[Prompts]: _face
[Prompts]: _taper
Select faces or [Undo/Remove]: pick the upper face of the base 2 faces found.
Select faces or [Undo/Remove/All]: enter r right-click
Select faces or [Undo/Remove/All]: pick highlighted faces other than the upper face 2
faces found, 1 removed
Select faces or [Undo/Remove/All]: right-click
Specify the base point: pick a point on the right-hand edge of the face
Specify the taper angle: enter 10 right-click
And the selected face tapers as indicated in the right-hand drawing (Fig. 11.5).
273
Fig 11.5
Fig 11.6
2. Click on the Copy faces tool in the Home/Solid Editing toolbar. The command line shows:
Command: _solidedit
[Prompts]: _face
[Prompts]: _copy
Select faces or [Undo/Remove]: pick the upper face of the solid model 2 faces found.
Select faces or [Undo/Remove/All]: enter r right-click
274
Select faces or [Undo/Remove/All]: pick highlighted face not to be copied 2 faces found,
1 removed
Select faces or [Undo/Remove/All]: right-click
Specify a base point or displacement:pick anywhere on the highlighted face
Specify a second point of displacement: pick a point some 50 units above the face
3. Add lights and a material to the 3D model and its copied face andrender (Fig. 11.7).
Fig 11.7
275
Fig 11.8
2. Click the Color faces tool icon in the Home/Solid Editingtoolbar. The command line shows:
Command: _solidedit
[Prompts]: _face
[Prompts]: _color
Select faces or [Undo/Remove]: pick the inner face of the wheel 2 faces found
Select faces or [Undo/Remove/All]: pick highlighted faces other than the required face 2
faces found, 1 removed
3.Add lights and a material to the edited 3D model and render (fig 11.9).
Fig 11.9
276
LAB EXERCISE 11
# 1 Construct the polyline (left-hand drawing) in the following figure. With the Revolve tool
create solid of revolution from the pline. Add suitable lighting and a colored glass material and
render it to get – right-hand illustration in the following figure.
277
# 2Working to the dimensions given in theorthographic projections of the three partsof this 3D
model (Fig. 2A), construct theassembled parts as shown in the rendered 3Dmodel of Fig. 2B .
Fig 2A
278
Fig. 2B
279
Lab session 12
Objectives
The aims of this lab session are:-
To describe the settings required for printing an auto cad drawing file;
To introduce how we can print out an Auto Cad drawing that we produce in 2D and 3D;
To give an example of producing hard copy of an Auto cad drawing file;
280
You can right-click a layout tab to display a shortcut menu with options to
Create a new layout
Import a layout from a template drawing
Delete a layout
Rename a layout
Change the order of the layout tabs
Create a new layout based on an existing layout
Select all layouts
Create a page setup for the current layout
Plot a layout
281
Fig. page setup manager dialog
3. In order to get in to set up click on the modify button. The following dialog appears.
Here you can specify layout settings such as plot area, plot scale, plot offset, drawing
orientation, and paper size.
282
Paper Size and Paper Units: Displays standard paper sizes available for the selected plotting
device. Printable Area displays the actual area on the paper that is used for the plot based on
the currently configured paper size.
Actual paper sizes are indicated by the width (X axis direction) and height (Y axis direction). If
no plotter is selected, the full standard paper size list is displayed and available for selection. A
default paper size is set for the plotting device when you create a PC3 file with the Add-a-
Plotter wizard. The paper size is saved with a layout and overrides the PC3 file settings.
Drawing Orientation: Specifies the orientation of the drawing on the paper for plotters that
support landscape or portrait orientation. You can change the drawing orientation to achieve a
0-, 90-, 180-, or 270-degree plot rotation by selecting Portrait, Landscape, or Plot Upside-
Down. The paper icon represents the media orientation of the selected paper. The letter icon
represents the orientation of the drawing on the page.
Portrait: Orients and plots the drawing so that the short edge of the paper represents
the top of the page.
Landscape: Orients and plots the drawing so that the long edge of the paper represents
the top of the page.
Plot Upside-Down: Orients and plots the drawing upside-down.
Note: The orientation of plots is also affected by the PLOTROTMODE system variable.
Plot Area: Specifies the area of the drawing to be plotted.
Layout/Limits: When plotting a layout, plots everything within the margins of the
specified paper size, with the origin calculated from 0,0 in the layout.
When plotting from the Model tab, plots the entire drawing area defined by the
drawing limits. If the current viewport does not display a plan view, this option has
the same effect as the Extents option.
Extents: Plots the portion of the current space of the drawing that contains objects.
All geometry in the current space is plotted. AutoCAD may regenerate the drawing
to recalculate the extents before plotting.
Display: Plots the view in the current viewport in the Model tab or in the current
paper space view in a layout tab.
View: Plots a view saved previously with the VIEW command. You can select a
283
named view from the list provided. If there are no saved views in the drawing, this
option is unavailable.
Window: Plots the portion of the drawing you specify by a windowed area. Choose
the Window button to use the pointing device to specify the two corners of the area
to be plotted, or enter coordinate values.
o Command: Specify first corner: Specify a point
o Specify other corner: Specify a point
Plot Scale: Controls the relative size of drawing units to plotted units. The default scale setting
is 1:1 when plotting a layout. The default setting is Scaled to Fit when plotting the Model tab.
When you select a standard scale, the scale is displayed in Custom.
Note: If the Layout option is specified in Plot Area, AutoCAD plots the actual size of the
layout and ignores the setting specified in Scale.
Scale: Defines the exact scale for the plot. The four most recently used standard
scales are displayed at the top of the list.
Custom: Defines a user-defined scale. You can create a custom scale by entering
the number of inches (or millimeters) equal to the number of drawing units.
Scale Line weights: Scales line weights in proportion to the plot scale. Lineweights
normally specify the line width of plotted objects and are plotted with the linewidth
size regardless of the plot scale.
Plot Offset: Specifies an offset of the plotting area from the lower-left corner of the paper. In a
layout, the lower-left corner of a specified plot area is positioned at the lower-left margin of the
paper. You can offset the origin by entering a positive or negative value. The plotter values are
in inches or millimeters on the paper.
Center the Plot: Automatically calculates the X and Y offset values to center the
plot on the paper.
X: Specifies the plot origin in the X direction.
Y: Specifies the plot origin in the Y direction.
Plot Options: Specifies options for line weights, plot styles, hidden lines, and the order in
which objects are plotted.
Plot with Line weights: Specifies whether line weights assigned to objects and layers are
284
plotted.
Plot with Plot Styles: Specifies whether plot styles applied to objects and layers are
plotted. When you select this option, Plot with Line weights is automatically selected
also.
Plot Paper space Last: Plots model space geometry first. Paper space geometry is
usually plotted before model space geometry.
Hide Objects: Plots model space views with hidden lines removed. Hidden line
removal for objects in layout viewports is controlled by selecting a viewport border and
then selecting Hide Plot in the Properties window. The effect of this setting is reflected
in the plot preview, but not in the layout.
Example1: printing a single copy
1. With a drawing to be printed or plotted on screen click the Plot tool icon in the Standard
toolbar (Fig.A).
2. The Plot dialog appears. Set the Printer/Plotter to a printer or plotter currently attached to the
computer and the Paper Size to a paper size to which the printer/plotter is set.
3. Click the Preview button of the dialog and if the preview is OK, right click and in the right-
click menu which appears, click Plot.
The drawing plots producing the necessary hard copy ( Fig.B ).
Fig .A Fig. B
285
Example 2:Multiple view copy
A 3D model to be printed is a Realistic view of a 3D model which has been constructed on three
layers – Red,Blue and Green in color. To print a multiple view copies proceed as follows:
1. Place the drawing in a Four: Equal viewport setting.
2. Make a new layer vportsof color cyan and make it the current layer.
3. Click the Layout button in the status bar. The drawing appears in Pspace. A view of the 3D
model appears within a cyan colored viewport ( Fig.C).
4. Click the Plot tool icon in the Output/Plot toolbar. Make sure the correct Printer/Plotter and
Paper Size settings are selected and click the Preview button of the dialog.
5. A preview of the 3D model appears.
6. If the preview is satisfactory (Fig. C), right-click and from the right-click menu click Plot. The
drawing plots to produce the required four-viewport hard copy.
286
LAB EXERCISE 12
#By opening the drawing files that you saved in the previous exercises try to produce a print out
of the drawings by altering different plot options settings in the page setup dialog box.
REFERENCES
1. Akintan Thomas, AutoCAD Training Manual 2D Level 1,Tom Computer Center, May
2006
2. Alf Yarwood, Introduction toAutoCAD 2009 2D and 3D Design, First edition,Macmillan
Company, 2008
3. Ellen Finkelstein,Top 25 AutoCAD Productivity Tips Every AutoCAD User Should
Know, retrived from www.ellenfinkelstein.com, (n.d), retrieved July 17 2014.
4. Jon McFarland, Auto Cad 2009 And Auto Cad Lt 2009 No Experience Required,Wiley
Publishing, Inc. India, 2008
5. Kristen S. Kurland, AutoCAD 3DTraining Manual,Autodesk, Inc.2004
MostefaBouchama, Engineering Graphics WithAuto Cad, King Fahd University of Petroleum &
Minerals, July 2004
287