CHAPTER 1
INTRODUCTION
1.1.AutoCAD AutoCAD is a commercial software application for 2D and 3D computeraided design (CAD) and drafting — drafting — available available since 1982 as a desktop application and since 2010 as a mobile web- and cloud-based app marketed as AutoCAD 360. Developed and marketed by Autodesk, Inc., AutoCAD was first released in December 1982, running on microcomputers with internal graphics controllers. Prior to the introduction of AutoCAD, most commercial CAD programs ran on mainframe computers or minicomputers, with each CAD operator (user) working at a separate graphics terminal. AutoCAD is used across a wide range of industries, by architects, project managers, engineers, designers, and other professionals. It is supported by 750 training centers worldwide as of 1994. As Autodesk's flagship product, by March 1986 AutoCAD had become the most ubiquitous CAD program worldwide. As of 2014, AutoCAD is in its twenty-ninth generation, and collectively with all its variants, continues to be the most widely used CAD program throughout most of the world.
1
1.2.AutoLISP LISP is the acronym for LIST PROCESSING. AutoLISP is a dialect of Lisp programming language built specifically for use with the full version of AutoCAD and its derivatives, which include AutoCAD Map 3D, AutoCAD Architecture and AutoCAD Mechanical.Neither the application programming interface nor the interpreter to execute AutoLISP code are included in the AutoCAD LT product line. AutoLISP is a small, dynamically scoped, dynamically typed LISP dialect with garbage collection, immutable list structure and settable symbols, lacking in such regular LISP features as macro system, records definition facilities, arrays, functions with variable number of arguments or let bindings. Aside from the core language, most of the primitive functions are for geometry, accessing AutoCAD's internal DWG database, or manipulation of graphical entities in AutoCAD. The properties of these graphical entities are revealed to AutoLISP as association lists in which values are paired with AutoCAD "group codes" that indicate properties such as definitional points, radii, colors, layers, linetypes, etc. AutoCAD loads AutoLISP code from .LSP files. AutoLISP code can interact with the user through Autocad's graphical editor by use of primitive functions that allow user to pick points, choose objects on screen, input numbers and other data. AutoLisp also has a built-in GUI minilanguage, the Dialog Control Language, for creating modal dialog boxes with automated layout, within AutoCAD. AutoLISP was derived from an early version of XLISP, which was created by David Betz.[4] The language was introduced in AutoCAD Version 2.18 in January 1986, and continued to be enhanced in successive releases up to Release 2
13 in February 1995. After that, its development was neglected by Autodesk in favor of more fashionable development environments like VBA, .NET and ObjectARX. However, it has remained AutoCAD's primary user customization language. Vital-LISP, a considerably enhanced version of AutoLISP including an IDE, debugger and compiler, and ActiveX support, was developed and sold by third party developer Basis Software. Vital LISP was a superset of the existing AutoLISP language that added VBA-like access to the AutoCAD object model, reactors (event handling for AutoCAD objects), general ActiveX support, and some other general Lisp functions. Autodesk purchased this, renamed it Visual LISP, and briefly sold it as an add-on to AutoCAD 14 released in May 1997. It was incorporated into AutoCAD 2000 released in March 1999, as a replacement for AutoLISP. Since then Autodesk has chosen to halt major enhancements to Visual LISP in favor of focusing more effort on VBA and .NET and C++. As of January 31, 2014, Autodesk no longer supports versions of VBA older than 7.1. This is part of a long-term process of switching over from VBA to .NET for customization. AutoLISP has such a strong following that other CAD application vendors add it to their own products. Bricscad, IntelliCAD and others have AutoLISP functionality, so that AutoLISP users can consider using them as an alternative to AutoCAD. Most development involving AutoLISP since AutoCAD 2000 is actually performed within Visual LISP since the original AutoLISP engine was replaced with the Visual LISP engine. There are thousands of utilities and applications that have been developed using AutoLISP or Visual LISP (distributed as LSP, FAS and VLX files).
3
A simple Hello world program in AutoLisp would be: (defun hello () (princ "\nHello World!") ) Above written program must be saved in a notepad with the AutoLISP extension “ *.lsp” so that it can be acknowledged by AutoCAD.
4
CHAPTER 2
PROBLEM STATEMENT
Design and Drafting of hollow shaft subjected to bending using AutoLISP. A hollow transmission shaft, having inside diameter 0.6 times the outside diameter is made of plain carbon steel 40c8 (Syt= 380 N/mm2) and the factor of safety is 3. A belt pulley , 1000mm in diameter is mounted on the shaft , which overhangs the left hand bearing by 250mm.The belts are vertical and transmit power to the machine shaft below the pulley. The tension on the tight and slag sides of the belt are 3KN and 1KN, while the weight of the pulley is 500N. The angle of wrap of the belt on the pulley is 1800. Calculate the outside and inside diameters of the shaft. GIVEN DATAS: Length of the shaft, L = 200mm Length of the pulley, l = 50mm Permissible shear stress, τ = 63.33 N/mm2 Tension in tight side, P1= 3000N Tension in slag side, P2= 1000N TO FIND: Inner diameter of shaft,Di= ? Outer diameter of shaft,Do= ?
5
. CHAPTER 3
ANALYTICAL CALCULATION
In this chapter, we are going to solve the problem analytically.
GIVEN DATAS: Length of the shaft, L = 200mm Length of the pulley, l = 50mm 2
Permissible shear stress, τ = 63.33 N/mm Tension in tight side, P 1= 3000N Tension in slag side, P 2= 1000N TO FIND: Inner diameter of shaft,Di= ? Outer diameter of shaft,Do= ?
6
SOLUTION: Torsional moment, Mt = (P1-P2) R = (3000 - 1000) 5000 3
= 1000 x 10 N-mm Bending moment, M b = (P1+ P2+ W) L = (3000 + 1000 + 500) 250 3
= 1125 x 10 N-mm Diameter ratio, C = 0.6 √
D0 =
D0= 51.81mm ≈ 52mm Di = 0.6 x 51.81 = 31.09 ≈ 32 mm RESULT: Inner diameter of shaft, D i = 32mm Outer diameter of shaft, Do = 52mm
7
CHAPTER 4 AUTOLISP PROCEDURE
In this session, we are going to see the procedure of AutoLISP programming and various commands used and the calculation part and drawing part for this particular given problem.
6.1.Data Types 6.1.1. Integer This type includes both positive and negative numbers ranging from -32768 to +32767 6.1.2. Real This refers the numbers with decimal points that can be both positive and negative. 6.1.3. Strings They are the groups of alphanumeric characters. They must be included within “” 6.1.4. Entity Names AutoCAD assigns a unique entity name to each entity in the current drawing editor. AutoLISP can access any entity in the database with this entity name.
8
6.1.5. Constants There is a predetermined constant pi evaluating 3.14159 and a symbol T evaluating it to TRUE.
6.2. Arithmetic Functions 6.2.1. Addition (+) +
(+ num1 num2)
This function returns the sum of the all operands, which can be a real or integer value. 6.2.2. Subtraction (-) -
(- num1 num2)
This function returns the result after subtracting num2 from num1. 6.2.3.Multiplication (*) *
(* num1 num2)
This function returns the result after multiplying the nim1 with num2. 6.2.4. Division (/) /
(/ num1 num2)
This function returns the result of dividing num1 by num2.
9
6.3. Basic AutoLISP functions 6.3.1. Expt (expt [base] [power]) returns [base] raised to the power of [power] 6.3.2. Sqrt (sqrt [num]) returns the square root of the [num]
6.4. User Define Functions 6.4.1. Defun (defun [symbol name] [args list] [expr] _ _ _) This function defines [symbol name] as a new function for the current drawing session. The [args list ] represents the arguments supplied to the function. The [expr] is a set of instructions to be carried out whenever the function is executed. 6.4.2. Command (Command [args] [ {pause}]….) Executes corresponding AutoCAD commands. An argument represents autoCAD sub commands. Pauses for user inputs if pause is present.
We have to use functions like +, -, *, /, sqrt (square root), expt (exponential) to frame the calculation sequence in such a specific manner. For an example, addition of 2 numbers may be written as,
10
1 + 2 => (+ 1 2) For an example, multiplication of 2 numbers may be written as, 1 x 2 => (* 1 2) 6.5. User Interactive Functions 6.5.1. Getpoint (getpoint {pt}{[prompt]} ) Pause for user input of point a list of 2 reals. 6.5.2. Getreal (getreal {[prompt]}) Pauses for user input of real numbers and sreturns real numbers.
11
CHAPTER-5 AUTOCAD COMMAND HISTORY
Command: _line Specify first point: Specify next point or [Undo]: 200 Specify next point or [Undo]: 52 Specify next point or [Close/Undo]: 200 Specify next point or [Close/Undo]: 52 Specify next point or [Close/Undo]: 10 Specify next point or [Close/Undo]: 200 Specify next point or [Close/Undo]: 32 Specify next point or [Close/Undo]: 200 Command: _line Specify first point: Specify next point or [Undo]: 26 Specify next point or [Undo]: 50 Specify next point or [Close/Undo]: 500 Specify next point or [Undo]: 50 Specify next point or [Undo]: 1000
12
CHAPTER 6 AUTOLISP PROGRAM FOR HOLLOW SHAFT SUBJECTED TO BENDING USING AUTOLISP
AutoLISP Coding (defun hollowshaft() (command “erase” “all” “ ” “ ” ) (setq pt1 (get point “enter the larger diameter shaft start point”) pt6 (get point “enter the smaller diameter shaft start point”) pt11 (get point “enter the pulley start point”) P1 (get real “enter the tension in tight side in N:”); P1= tension in tight side P2 (get real “enter the tension in slag side in N:”); P1= tension in slag side 2
S (get real “enter the shear stress in N/mm :”); S= shear stress L (get real “ enter the length of the shaft in mm:”); L= length of the shaft l (get real “ enter the length of the pulley in mm:”); l= length of the pulley W (get real “ enter the width of the pulley in mm:”); W= width of the pulley C (get real “ enter the diameter ratio:”);C= shaft diameter ratio B (get real “ enter the diameter of the pulley in mm:”); B= diameter of the pulley Mt (* (- P1 P2) (R)); Mt= Torsional moment Mb (* (+ P1 P2 W) (+ L l));Mb= Bending moment
13
a (- (1) (* C C C C));a= calculation b (* S Pi a);b=easy calculation e (sqrt (+ (* Mt Mt) (* Mb Mb)));e= simple calculation D (/ (* 16 e) (b));D=calculation simple Do (expt 0.3333 D); Do= outer diameter of shaft Di (* 0.6 Do);Di= inner diameter of shaft ) (setq pt2 (polar pt1 0 L) pt3 (polar pt2 (d2r 90) Do) pt4 (polar pt3 0 pi L) pt5 (polar pt4 (d2r 270) Do) pt7 (polar pt6 0 L) pt8 (polar pt7 (d2r 90) Di) pt9 (polar pt8 0 pi L) pt10 (polar pt9 (d2r 270) Di) pt12 (polar pt11 0 l) pt13 (polar pt12 (d2r 90) B) pt14 (polar pt13 0 pi L) pt15 (polar pt14 (d2r 270) B) 14
) (command “line” pt1 pt2 pt3 pt4 pt5 “”) (command “line” pt6 pt7 pt8 py9 pt10 “”) (command “line” pt11 pt12 pt13 pt14 pt15 “”) ; End of program
15
CHAPTER-7 2D DRAWING
RESULT:
Thus the hollow shaft subjected to bending is designed and drafted using AUTOLISP program.
16