External Commands Script Files Slide Shows

External Commands Script Files Slide Shows Sacramento City College EDT 310 EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows 1 S...
0 downloads 0 Views 780KB Size
External Commands Script Files Slide Shows Sacramento City College EDT 310

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

1

Slides and Slide Shows

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

2

Slides and Slide Shows ‹A

slide in AutoCAD

‹ Is

similar to a slide in photography. ‹ Is a snapshot of graphics screen display. ‹ Cannot be edited or plotted. ‹ Can be viewed one at a time on the screen. ‹ A continuous slide show can be created.

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

3

Slides and Slide Shows ‹ Slides

are excellent for

‹ Demonstrations. ‹ Presentations. ‹ Displays.

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

4

Slides and Slide Shows ‹A

slide show

‹ is

a group of slides that are displayed at preset time intervals.

‹ The

display of the slides is controlled by a script file. ‹A

script file is a logical sequence of valid AutoCAD commands stored in a .txt file.

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

5

Slides and Slide Shows ‹ To

make slides

‹ Display

the drawing for which you need a

slide. ‹ Select the MSLIDE command ‹ Pick the drive and folder in which the file is to be stored. ‹ Enter the file name in the File name: text box for the slide ‹ Pick the Save button. ‹ AutoCAD

automatically attaches an .sld file extension.

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

6

Slides and Slide Shows ‹ Choose

stored.

location where slides will be

‹ AutoCAD

by default stores slides in the AutoCAD directory. ‹ This is not a good location for slides. ‹ Keep

the AutoCAD directory free of drawing, slides, and AutoLISP files.

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

7

Slides and Slide Shows ‹ Good

locations for slides

‹ Local

hard disk drive ‹ USB media ‹ Create

a separate folder in the location where you choose to store slides.

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

8

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

9

Naming Slides

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

10

Slides and Slide Shows ‹ Slide

names should follow a pattern. ‹ Name the slide to reflect the ‹ Client

name or ‹ Project number ‹ Examples: ‹ weyersld01,

weyersld02, etc. ‹ 4305sld01, 4305sld02, etc.

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

11

Slides and Slide Shows ‹ To

view a slide, type VSLIDE

‹ Command:

VSLIDE ‹ The Select Slide File dialog box appears. ‹ Pick the slide you want to display ‹ Pick OK. ‹ The

slide is displayed in the graphics window.

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

12

Creating Script Files to Automate AutoCAD

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

13

Slides and Slide Shows ‹A

Script File

‹ is

a list of valid AutoCAD commands stored in a text file. ‹ Is created using a wordprocessor. ‹ Notepad ‹ MS

‹ Has

DOS EDIT

a .scr file extension

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

14

Slides and Slide Shows ‹ Running

the Script file

‹ When

the script file is read by AutoCAD, the entire list of commands is performed without additional input from the user.

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

15

Slides and Slide Shows ‹A

Script File contains valid AutoCAD commands in a specific sequence. ‹ VSLIDE

(AutoCAD command - displays slide) ‹ DELAY (A slide display time) ‹ VSLIDE ‹ DELAY ‹ RSCRIPT (AutoCAD command to cause the show to repeat.) ‹ Three blank lines at the end of the file. EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

16

Creating Script Files ‹ Scripts

enable nonprogrammers to automate AutoCAD functions.

‹ Scripts

can be used for specific functions, such as ‹ Plotting

a drawing with the correct PLOT command values and settings ‹ Creating a slide show.

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

17

Writing Script File - Basic Rules

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

18

Creating Script Files ‹ When ‹ 1.

writing a script file,

Use one command or option per line.

‹ Makes

the file easier to fix if the script does not work properly.

‹ 2.

Press [Enter] after typing a command. ‹ 3. A blank line = [Enter] ‹ If

the next option of a command is a default value to be accepted, press [Enter] again. ‹ This leaves a blank line in the script file, which represents pressing [Enter].

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

19

Creating Script Files ‹ When

writing a script file,

‹ 4.

A space = [Enter] ‹ 5. A blank line = [Enter] ‹ 5. Three blank lines are required at the end of the script file.

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

20

Writing a Slide Show Script File

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

21

Writing a Slide Show Script File ‹A

slide show script file

‹ Contains

only three AutoCAD commands.

‹ VSLIDE. ‹ DELAY. ‹ VSLIDE. ‹ DELAY. ‹ VSLIDE. ‹ DELAY. ‹ RSCRIPT.

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

22

Writing a Slide Show Script File ‹A

slide show script file

‹ Can

be a single pass or continuous show. ‹ If RSCRIPT and three blank lines are included ‹ The

‹ If

slide show will repeat

not included

‹ The

slide show will run one time only.

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

23

Writing a Slide Show Script File ‹ VSLIDE ‹ The

displays a slide.

name of the slide follows the command.

‹ VSLIDE

kenslide01

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

24

Writing a Slide Show Script File ‹ An

asterisk (*), in front of the slide file name causes the next slide to be preloaded. ‹ VSLIDE

kenslide01 ‹ VSLIDE *kenslide02 ‹ DELAY ‹ VSLIDE ‹A

VSLIDE command that is not followed by a slide name displays the pre-loaded slide.

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

25

The DELAY Command ‹ DELAY ‹ Specifies

the display time in milliseconds ‹ Maximum delay = 33 seconds (33,000) ‹ Examples: ‹ DELAY

33000 (33 second delay) ‹ DELAY 4000 (4 second delay)

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

26

The RSCRIPT Command ‹ RSCRIPT

is used at the end of a script file.

‹ RSCRIPT

‹ Exactly

causes the script file to repeat.

three blank lines

‹ MUST

be entered at the end of the script file. ‹ The script will NOT run correctly without them.

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

27

The RESUME Command ‹ RESUME ‹ Restarts

the slide show where it left off

‹ (Sometimes) ‹ Does

not always work correctly.

‹ Any

script file can (theoretically) be interrupted and restarted using RESUME.

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

28

Writing A Script File - Example

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

29

Writing a Slide Show Script File ‹ The

following script uses four slides.

‹ Each

slide appears for three seconds. ‹ The script repeats. ‹ The next slide is preloaded while the previous one is viewed.

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

30

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

31

Writing a Slide Show Script File ‹ When

storing slide files, include in the script file, the ‹ disk

drive letter and ‹ path in front of the file name.

‹ Example: ‹ Use

F:cadlsld2

this method with each VSLIDE command.

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

32

Viewing the Slide Show

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

33

Viewing the Slide Show ‹ Start

the slide show by

‹ Entering

SCR or SCRIPT at the Command:

prompt ‹ OR

‹ Picking

Run Script... from the Tools pull-down

menu. ‹ OR

‹ Select

the script file name show.scr from the Select Script File dialog box.

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

34

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

35

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

36

Viewing the Slide Show ‹ The

commands in the script file are displayed at the Command: prompt window as the slides appear.

‹ To

stop the show,

‹ Press

the [Backspace] key or ‹ [ESC] key.

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

37

Troubleshooting the Slide Show

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

38

Troubleshooting the Slide Show ‹ To

correct, problems in your script file. ‹ 1. Run the script to see where it crashes (quits working). ‹ 2.

Check the command line for the last command that was executed.

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

39

Troubleshooting the Slide Show ‹ 3.

Look for error messages, such as:

‹ Can't

open slide file xxxxx (Incorrect slide file name). ‹ xxxxx Unknown command (Command spelled incorrectly or a space left at the end of the line). ‹ Requires an integer value (Delay value not all numerical characters. Possibly a space at the end of the line).

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

40

Troubleshooting the Slide Show ‹ 4.

Correct the problem in the script file and save the file.

‹ 5.

Test the script.

‹ The

most common errors are

‹ Misspelled

commands. ‹ Spaces at the end of lines.

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

41

Troubleshooting the Slide Show ‹ The

process of “debugging” the script file is performed by ‹ AutoCAD

open in one window ‹ Script file open in a NOTEPAD window.

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

42

Troubleshooting the Slide Show ‹ Alt-TAB

between the windows

‹ Run

Script file ‹ Find location where it stops ‹ Switch to NOTEPAD window with Alt-TAB ‹ Correct mistake ‹ SAVE the script file! ‹ Go back to AutoCAD using Alt-TAB ‹ Run script file again. ‹ Repeat steps over and over until script works. EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

43

Troubleshooting the Slide Show ‹ Watch

for extra spaces!

‹ If

you suspect there is a space at the end of a line, it is best to delete the line and retype it.

‹ If

you use Notepad or EDIT,

‹ It

is easy to see if a space exists. ‹ The flashing cursor, when placed at the end of a line, does not rest on the last character.

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

44

Using Text Editors

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

45

Using Text Editors ‹ Word

processing or text editor programs can be used to write scripts.

‹ The

program must be capable of saving the file in “ASCII” format.

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

46

Using Text Editors ‹ ASCII

is an acronym for

‹ American

Standard Code for Information Interchange.

‹ Computer

with:

ASCII text files can be created

‹ The

MS-DOS EDIT text editor ‹ Windows Notepad ‹ Windows WordPad. EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

47

Using Text Editors ‹ Word

processing files must be saved in ASCII format to be readable by AutoCAD.

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

48

Using Text Editors ‹ Typical

commercial wordprocessing programs: ‹ Windows

WordPad. ‹ Microsoft Word. ‹ Corel WordPerfect. ‹ Ami Pro. ‹ Do NOT save in ASCII format by default! ‹ You

must choose option to save as .txt file

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

49

Using Wordprocessors ‹ If

you choose to use a word processor, save the document as a text file.

‹ This

prevents the inclusion of special formatting codes.

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

50

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

51

ASCII ‹ ASCII

was established in 1950’s

‹ Many

computer manufacturers were designing computers.

‹ No

standard representation existed of

‹ Alphabet

(A-Z) ‹ Numbers (0-9) ‹ Special characters (, . [ ] { } ( ) +, - =) etc.

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

52

ASCII Character Set

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

53

ASCII ‹ ASCII ‹ Work

on ASCII formally began October 6,

1960. ‹ The first edition of the standard was published during 1963, ‹ A major revision during 1967. ‹ The most recent update during 1986

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

54

ASCII ‹ Established

a standard set of characters that was recognized by ALL computer manufacturers and the US government. ‹ Allowed interchange of information much more readily.

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

55

ASCII ‹

On March 11, 1968, U.S. President Lyndon B. Johnson mandated that all computers purchased by the United States federal government support ASCII, stating: ‹

‹

I have also approved recommendations of the Secretary of Commerce regarding standards for recording the Standard Code for Information Interchange on magnetic tapes and paper tapes when they are used in computer operations. All computers and related equipment configurations brought into the Federal Government inventory on and after July 1, 1969, must have the capability to use the Standard Code for Information Interchange and the formats prescribed by the magnetic tape and paper tape standards when these media are used.

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

56

ASCII ‹ Other

international standards bodies have ratified character encodings such as ISO/IEC 646 that are identical or nearly identical to ASCII, with extensions for characters outside the English alphabet and symbols used outside the United States, such as the symbol for the United Kingdom's pound sterling (£).

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

57

ASCII ‹ Almost

every country needed an adapted version of ASCII since ASCII only suited the needs of the USA and a few other countries. ‹ Canada ‹ had

its own version that supported French characters. ‹ ISCII (India), ‹ VISCII (Vietnam), ‹ YUSCII (Yugoslavia). ‹ Although these encodings are sometimes referred to as ASCII, true ASCII is defined strictly only by ANSI standard. EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

58

Command Aliases The ACAD.PGP File

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

59

Command Aliases ‹ AutoCAD

allows you to abbreviate commands. ‹ Feature

introduced with AutoCAD 11.

‹ Abbreviating

commands is called Command Aliasing.

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

60

Command Aliases ‹ AutoCAD

comes with predefined aliases.

‹ Aliases

are listed in the acad.pgp file. ‹ Over 160 commands are aliased. ‹ Appendix F in the text gives a complete list.

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

61

Command Aliases ‹ You

can easily create your own aliases by editing the acad.pgp file.

‹ To

enter an alias PP for PLOT, add the following line to the acad.pgp file. ‹ PP

*PLOT ‹ The * means that this is an alias. ‹ Save the acad.pgp file.

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

62

Command Aliases ‹ To

cause the alias to be in effect:

‹ Restart

AutoCAD OR ‹ Type REINIT and select the PGP file check box.

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

63

Editing the ACAD.PGP File ‹ To

edit the ACAD.PGP file ‹ Use a text editor: ‹ DOS

EDIT ‹ Windows NOTEPAD ‹ Any other text editor ‹ The

ACAD.PGP file is stored in

‹ \AUTOCAD\SUPPORT\ACAD.PGP

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

64

External Commands The ACAD.PGP File

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

65

The ACAD.PGP File ‹ External

Commands invoke functions that are not part of AutoCAD. ‹ These external commands are defined in a file called acad.pgp (program parameters). ‹ This

file is placed in the AutoCAD \Support folder during the AutoCAD installation procedure.

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

66

The ACAD.PGP File ‹ Windows

Notepad can be initiated directly from AutoCAD. ‹ Enter the following to open acad.pgp in Notepad: ‹ Command: ‹ File

NOTEPAD

to edit:

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

67

AutoCAD External Commands ‹ AutoCAD

contains 11 external commands in the acad.pgp file. ‹ Catalog ‹ DEL ‹ DIR ‹ EDIT ‹ SH ‹ SHELL ‹ START ‹ TYPE

DIR /W, DEL, DIR, START EDIT, , , START, TYPE,

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

68

AutoCAD External Commands ‹ AutoCAD

contains 11 external commands in the acad.pgp file. ‹ EXPLORER ‹ NOTEPAD ‹ PBRUSH

START EXPLORER, START NOTEPAD, START PBRUSH,

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

69

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

70

AutoCAD External Commands ‹ The

first word is the command name which you type at AutoCAD’s Command: prompt to execute the command.

‹ The

second word represents the DOS command or program to be executed. ‹ Each

field is separated by a comma.

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

71

AutoCAD External Commands ‹ EDIT. ‹ The

command.

‹ START

EDIT

‹ The

command or program name which is executed after the command name is typed.

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

72

AutoCAD External Commands ‹ 1. ‹ Bit

flag value which specifies the way the program starts. ‹ Begins an application but doesn’t wait for it to finish. ‹ Other settings ‹ wait

for the application to finish ‹ minimize the application.

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

73

AutoCAD External Commands ‹ File

to edit:

‹ This

is the prompt that appears after the command is typed.

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

74

The SH and SHELL Command ‹ SH

or SHELL is similar to the MS-DOS Command Prompt.

‹ The

following prompt appears:

‹ OS

Command: (Enter an external command or press [ENTER])

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

75

The SH and SHELL Command ‹ SH

or SHELL is similar to the MS-DOS Command Prompt. ‹ Only

one external command can be entered. ‹ When the command is completed you are returned to AutoCAD. ‹ Pressing [ENTER] at the OS Command: prompt opens an MS-DOS window.

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

76

Assignments

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

77

Command Aliases Assignment ‹ Create

5 command aliases

‹ Modify

ACAD.PGP file. ‹ Demonstrate to instructor that command aliases work. ‹ Each

command alias MUST work correctly on the FIRST ATTEMPT to receive full credit !

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

78

Slide Show Assignment ‹ Create

a 12 slide, repeating slide show.

‹ Use

any of your drawings for the slides. ‹ Save all slides on ‹

USB Media ; local hard disk drive

‹ Save ‹

.scr file on

USB media; local hard disk drive

‹ Demonstrate

to instructor that slide show works correctly AND repeats!

‹ Slide

show MUST run correctly on the FIRST ATTEMPT to receive full credit !

EDT 310 - Chapter 28 - External Commands, Script Files, Slide Shows

79