LESSON 5 PREPARING THE AUTOLISP CODE It is assumed that you have completed. Therefore the following lesson will show you what happens when you press the.

Slides:



Advertisements
Similar presentations
JustinMind: Dynamic Panels
Advertisements

More Vectors.
AUTOLISP DRAWING (continued)
DRAWING THE PIN ME 426 INTERNAL COMBUSTION ENGINE DESIGN.
Lists in Lisp and Scheme a. Lists are Lisp’s fundamental data structures, but there are others – Arrays, characters, strings, etc. – Common Lisp has moved.
Chapter 2: Using Objects Part 1. To learn about variables To understand the concepts of classes and objects To be able to call methods To learn about.
Key Stone Problem… Key Stone Problem… next Set 7 Part 1 © 2007 Herbert I. Gross.
By Paul Richard and Jim Fitzgerald Chapter 9 - Drawing and Editing Complex Objects.
1 Creating and Tweaking Data HRP223 – 2010 October 24, 2011 Copyright © Leland Stanford Junior University. All rights reserved. Warning: This.
IS 1181 IS 118 Introduction to Development Tools VB Chapter 06.
PARAMETRIC EQUATIONS AND POLAR COORDINATES 9. Usually, we use Cartesian coordinates, which are directed distances from two perpendicular axes. Here, we.
ME 3861 CAD Review A solid modeling example January 24, 2001.
Information Technology Center Hany Abdelwahab Computer Specialist.
________CIVL114 LAB 4. Outline Exercise 1 – solving an intersection problem  Point Style  Rotate  Modify Dimension Style Exercise 2 – stirrups  Fillet.
1 Flash Programming Introduction Script Assist. 2 Course Description This course concentrates on the teaching of Actionscript, the programming language.
Python. What is Python? A programming language we can use to communicate with the computer and solve problems We give the computer instructions that it.
Working with Numbers in Alice - Converting to integers and to strings - Rounding numbers. - Truncating Numbers Samantha Huerta under the direction of Professor.
Chapter 6: Fundamentals V. After completing this Chapter, you will be able to use the following features: Multiline – Drawing and ModificationMultiline.
 2003 Prentice Hall, Inc. All rights reserved. CHAPTER 3 JavaScript 1.
IE 212: Computational Methods for Industrial Engineering
Karel J Robot An introduction to BlueJ and Object- Oriented Programming.
Functions Part I (Syntax). What is a function? A function is a set of statements which is split off into a separate entity that can be used like a “new.
Multiple Forms, Container Controls, AddHandler This presentation is based on the Forms and ContainerControls VB Projects 1.
EDT Chapter 41 Review - Linetypes Sacramento City College EDT 310.
CARLSON SOFTWARE CONFERENCE DANIEL V. SYPERSMA VICTOR GRAPHICS.
Chapter 3: Fundamentals II. After completing this Chapter, you will be able to do the following: Drafting Settings Command Enhancer Dynamic Input, On-Screen.
© The McGraw-Hill Companies, 2006 Chapter 4 Implementing methods.
TECH 104 – Technical Graphics Communication Week 13: 3D Modeling Basics.
1 Functions 1 Parameter, 1 Return-Value 1. The problem 2. Recall the layout 3. Create the definition 4. "Flow" of data 5. Testing 6. Projects 1 and 2.
1 Lists in Lisp and Scheme. 2 Lists are Lisp’s fundamental data structures. Lists are Lisp’s fundamental data structures. However, it is not the only.
CSC3315 (Spring 2009)1 CSC 3315 Programming Paradigms Scheme Language Hamid Harroud School of Science and Engineering, Akhawayn University
Introduction to Arrays. definitions and things to consider… This presentation is designed to give a simple demonstration of array and object visualizations.
What is AutoCAD? A software drafting tool Particularly useful for Mechanical drawings Architectural drawings.
Getting Started With AutoCAD ENGR 2 Week #1 Laboratory.
 2003 Prentice Hall, Inc. All rights reserved. CHAPTER 3 JavaScript 1.
SOLIDWORKS: Lesson II – Revolutions, Fillets, & Chamfers UCF Engineering.
§ 4.2 Compound Inequalities. Blitzer, Intermediate Algebra, 5e – Slide #2 Section 4.2 Compound Inequalities A compound inequality is formed by joining.
C++ Basics C++ is a high-level, general purpose, object-oriented programming language.
CONTENTS Processing structures and commands Control structures – Sequence Sequence – Selection Selection – Iteration Iteration Naming conventions – File.
Piñata Game: Keeping Score in Alice By Maggie Bashford Professor Susan Rodger Duke University July
Chapter 11: Block References and Attributes. After completing this Chapter, you will be able to use the following features: Create and insert block references.
Basic Program Construction
Faculty of Electrical Engineering 1 Lecture : En. Syahrom Bin Zakaria EC202 COMPUTER AIDED DESIGN.
Chapter 2: Variables, Functions, Objects, and Events JavaScript - Introductory.
AUTOLISP Prof.Dr. Demir Bayka. AUTOLISP 1.Declare and set values to variables 2.Pick the elements of lists 3.Implement AutoCad commands 4.Select Entities.
Strategy Using Strategy1. Scan Path / Strategy It is important to visualize the scan path you want for a feature before you begin taking points on your.
Chapter 8: Plotting. After completing this Chapter, you will be able to use the following features: Planning the Plot Sheet Plotting Environments Plotting.
EDT Chapter 13 - Obtaining Drawing Information1 Obtaining Information About The Drawing Sacramento City College EDT 310.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
Milos Hauskrecht (PDF) Hieu D. Vu (PPT) LISP PROGARMMING LANGUAGE.
1© 2006 Autodesk AutoCAD: Secrets Every User Should Know Chapter 9 – AutoLISP by Example: Getting Better.
Introduction to LISP Atoms, Lists Math. LISP n LISt Processing n Function model –Program = function definition –Give arguments –Returns values n Mathematical.
Introduction to Computer Programming - Project 2 Intro to Digital Technology.
Controlling Program Flow with Decision Structures.
LAYERS AND OBJECT PROPERTIES. Topics OBJECT PROPERTIES LAYERS OBJECTS AND LAYERS Creating and Naming Layers Making a Layer Current Sorting Layers Controlling.
Functions in C++ Top Down Design with Functions. Top-down Design Big picture first broken down into smaller pieces.
Train Body The next series of slides will guide you through the construction of the train body. Start a new drawing and save it as Train Body.
- draw a diameter - make a radius - join diameter and radius -join other end of diameter and radius - put in any angle for one of the angles formed - fill.
UNIT 4: AutoCAD Drawing Commands Objectives: Be able to identify, describe and/or apply… AutoCAD tools (Line, polyline, arcs, circles, rectangles, hatch.
From AutoCAD to ArcView. From AutoCAD to Arcview Purpose Display a site plan drawn in AutoCad on a view drawn in ArcView Given Campus site plan drawing.
1 Agenda  Unit 7: Introduction to Programming Using JavaScript T. Jumana Abu Shmais – AOU - Riyadh.
TECH 104 – Technical Graphics Communication Week 12: 3D Modeling Basics.
Variables, Expressions, and IO
BASIC DRAWING COMMANDS FOR AUTOCAD
Visual Basic Programming Chapter Four Notes Working with Variables, Constants, Data Types, and Expressions GROUPBOX CONTROL The _____________________________________.
Lisp Tutorial Click on Xlisp icon – you enter the interpreter
CS 36 – Chapter 11 Functional programming Features Practice
Lab 2 HRP223 – 2010 October 18, 2010 Copyright © Leland Stanford Junior University. All rights reserved. Warning: This presentation is protected.
Lists in Lisp and Scheme
Presentation transcript:

LESSON 5 PREPARING THE AUTOLISP CODE It is assumed that you have completed. Therefore the following lesson will show you what happens when you press the and other buttons. In this project we will be using AutoCad R14 for creating the drawings. AutoCad can export drawings as bitmap images. Your program will activate AutoCad and after AutoCad has finished its task, you will be able to display the different drawing views as bitmap images.

is a call to this procedure with the parameters (obtained from and (number of screenshots of the animated view)

The directory path that is imported is known as in this procedure. Don’t mix it with the local variable used for establising the directory path of the autolisp file.

Some local variables are defined. However, some variables such as “Diameter” may also be used. The file is created and opened. A set of initial instructions to AutoCad are written automatically

is in unit and has REPLACED the function and the array. I forgot to, but you can delete array.

You don’t have to write any new code. However you have to change ; Statement[1] := ’(arxload “geom3d”)’; To Writeln(F,’(arxload “geom3d”)’);

ALL AUTOLISP COMMANDS ARE IN PARENTHESES (....) In AutoLisp there is a function which is used for assigning values to variables. Therefore when a variable is assigned a value by it is also being DECLARED as well. Delphi can also EXPORT variables to autolisp. The “string values” of string variables can be writen by WRITELN procedure. e.g. x : string; (declaration) x := ’10.5’; (assigned value) Writeln(F,‘+x+’); Output : 10.5 This feature will allow our drawings to be parametric.

You may put comments in autolisp code. Comments are preceeded by (;). Eg. ;SET LINER PARAMETRES

First we will change the numerical value of the global variable (divided by 2) to a string variable (local to our code) str(Diameter*1000/2:5:2,R1) Then we will declare a numerical variable (local to the autolisp code) and assign it the value corresponding to the string representation of in this code. Writeln(F,’(setq R1 ‘+R1+’)’); If R1 := ’10.5’ (by str) then autolisp program will have the line (setq R1 10.5) this declares R1 and sets its value to 10.5

In autolisp the arithmetic operations are performed as ; (setq ( )) This can be interpreted as ; Variable = value1 (operator) value2 Examples: (setq x (+ 10 5))x = 15 (setq x (- 10 5))x = 5 (setq x (* 10 5))x = 50 (setq x (/ 10 5))x = 2 (setq a 10) (setq b 5) (setq x (* a b))x = 50

In autolisp arrays can also be assigned to variables. Then ofcourse that variable will have a first, second,third... and so on values. Arrays may be expressed by preceeding with e.g. An array (1,5,67,99.5,3) may be represented as ; (list ) If this array is asigned to a variable (say x) then; (setq x (list )) QUESTION : How do we pick out the first or third element of x ?

There are two functions that can be used for this purpose: 1.car(picks the first element of the list) 2.cdr(picks all elements EXCEPT the first) If you want to pick out the third element then you can call once (now you have a list starting with the second element) call again (now you have a list starting with the third element) call and pick out the first element which is the third element of the original list. EXAMPLES (setq x (car (list )))x=1 (setq x (car (cdr (cdr (list )))))x=67 (list ) (list ) 67

This looks very cumbersome but that’s how it is. However, there is a SHORTCUT ! It is possible to NEST and possible nests are : caaaar cadaar cdaaar cddaar caaadr cadadr cdaadr cddadr caaar cadar cdaar cddar caadar caddar cdadar cdddar caaddr cadddr cdaddr cddddr caadr caddr cdadr cdddr caar cadr cdar cddr However for our purposes picking out the first (x coordinate), second (y coordinate) and third (z coordinate) elements of a variable that represents the 3D position of a point is enough.

The way you interpret a nested combination is FROM RIGHT TO LEFT. Example caddr means (car (cdr (cdr First operation Second operation Third operation Therefore : (setq p3D (list )) (setq x (car p3D))x = 50 (setq x (cadr p3D))x= 4 (setq x (caddr p3D))x = 205 JUST REMEMBER car cadr caddr (x)(y)(z)

These are the parametric variables that are obtained as a result of calculation in your program. Their values have been assigned in autolisp as : (calculated as R1+t in autolisp)

AutoCad commands can be given in AutoLisp commands. The syntax is : (command “CommandName” parameters) For example when you start the drawing you would probably want to set one of the the layers that you already defined (in WriteInitialLines). Now you need to know the syntax of the command in AutoCad. So start there and open AutoCad Help and look up the Command.

You will use the option. So try it out in Autocad R14 and see what prompts you get and note how you respond. Simulate your actions in AutoLisp.

The code will be as follows ; writeln(F,'(command "Layer" "Set" "0_centerline" "")'); This is the name of the command This is the option Of that is selected This is the name of the layer The interaction with can continue. However it is good policy to give your commands in steps. So to end dialog send empty return “”.

Now set the end points of the x and y axis and join them by a line (the linetype for layer was __ _ __ _ __ For the x axis define and and for the y axis define and All of the points are in 3D space. Therefore they have x,y,z values. In the a center point was defined and the origin of the universal coordinate system (UCS) was set at which had the coordinate values of (0,0,0). Therefore is in fact a variable representing a list of elements. is (1.5xR1) to the left of the origin is (1.5xR1) to the right of the origin is (1.5xR1) to the top of the origin is (R1+H) to the bottom of the origin

The corresponding autolisp commands are : (setq cenx1 (list (- (car cen) (* R1 1.5)) 0 0)) First element of second element third element A = 1.5 x R1 since (car cen) = 0  0 – A = - A cenx1 = (-A,0,0) After and are set a line is drawn between them Code for drawing the centerlines

We have learned; 1.How to declare and set values to variables 2.How to pick the elements of lists with (car, cadr, caddr) 3.How to implement AutoCad commands Now we will look at another feature ; SELECTION OF ENTITIES The “entities” could be “a point”, “a line”, “a set of lines”, “a polyline”,“a set of polylines”, “a profile”, “a circle”, “a rectangle”, “a solid”.....etc. There are various methods. We will look into 2 of these. Namely (ssget “L”) and (ssget “X”) functions.

(ssget “L”) method is used to select the LAST entity that was created. For example lets draw half of a circle. You may do this by drawing an ARC that has a center point, starting point and an angle (180). The points should be 2D (polylines and arcs are drawn on the XY plane) (setq p0 (list (+ (car cen) R2) (cadr cen) (caddr cen)))p0=(R2,0,0) (setq arccen (list (car cen) (cadr cen)))arccen=(0,0) (setq arc1 (list (car p0) (cadr p0)))arc1=(R2,0) (command "arc" "c" arccen arc1 "a" "180") You have to check from AutoCad Help about the use of the ARC command Now that the arc is drawn you can assign it (the whole list of properties of an arc) to a variable say. In order to do this you must first select it and then use the function. (setq PLarc1 (ssget "L"))

Code for the top view of the liner profile (half of the liner)

Now we have drawn the profile of the top view of the liner. This profile has 2 arcs ( and ) and two polylines ( and ). We can combine them all into a single polyline by the Autocad command. (command "pedit" (ssget "X") "Y" "join" (ssget "X") "" "exit") (setq TopProfile (ssget "L")) As you have noticed in the command we have selected all the entities,,, by (ssget “X”). However after the single polyline was formed we selected only that polyline and assigned it to.

Finally the drawing is zoomed out to the extents of the display (command “z” “e”) and the path and name of the bitmap image is set. Everything is selected and assigned to and finally the the AutoCad command is used to send the display as a bitmap image.