Scriptsheets.com

User guide

You can reduce your learning curve by reading the user guide. Also study the samples on this website and start with something which is little programming.

How it works

Writing command scripts

Instead of writing AutoCAD commands directly in a text file you type them into the right part of a spreadsheet, always starting in colum M.
Each row will become a line in the actual script file and will only be written to the file if the preceding value in column L is something else then FALSE.

Combining spreadsheet calculations

The left part of the scriptsheet is free to calculate values of your liking in practice mainly X and Y coördinates, angles or distances. Which of course are referenced in the cells where you write AutoCAD commands.
There is also a parameter-sheet in the workbook which is meant to specify input values.
The blackbord-sheet -in the midle of the parameter-sheet and one or more scriptsheets- is a sheet to make common calculations. Usefull when you have more than one scriptsheet in the workbook and don’t want to make the same calculations a second time.

Adding program flow

The Scriptsheets Add In will expose a new command in the Add-In tab of the Excel Ribbon.
This command walks down the active spreadsheet – one row at a time – and reads all text in the right part of the spreadsheet begining in column M.
When it finds the word START it will open an empty scriptfile and start processing what it reads until it finds the word STOP.
Other than just AutoCAD commands -which are directly written to the script file- rows can contain program flow statements like GOTO and RETURN forcing the Add In to make a jump and continue processing at an other row.
Also the statements FOR and NEXT can be used to forcing the group of rows between them to be processed more than once.

Additional functions

; (semicolon)

If you specify a semicolon in a cell at the end or in between cells with AutoCAD commands you force a newline in the scriptfile. You sometimes need this to exit AutoCAD commands or explicitly end the input of text values.

/* comment */

All data in cells that start with /* will be skiped and interpreted as comment

=POINT(X, Y)

Pairs up the X and Y coördinate and returns a text which is allways valid in a AutoCAD scriptfile.
The X and Y values are seperated by a komma and the decimal seperator will allways show up as a dot. Regardles of the Regional Settings of your Windows system!

X is the X coördinate of a point
Y is the Y coördinate of a point

=NUMBER(N)

Returns a text which is allways valid in a AutoCAD scriptfile. Again the the decimal seperator will allways show up as a dot. Regardles of the Regional Settings of your Windows system!

N is the number to be returnd as a text

=ANGLE(X1, Y1, X2, Y2)

Returns an angle in radians between two points

X1 is the X coördinate of the first point
Y1 is the Y coördinate of the first point
X2 is the X coördinate of the second point
Y2 is the Y coördinate of the second point

=DISTANCE(X1, Y1, X2, Y2)

Returns the distance between between two points

X1 is the X coördinate of the first point
Y1 is the Y coördinate of the first point
X2 is the X coördinate of the second point
Y2 is the Y coördinate of the second point

=ROTATE(X, Y, a, Output)

Rotates a point around 0,0 (UCS origin) and returns the X or Y value

X is the X coördinate of the point
Y is the Y coördinate of the point
a is the angle in radians, positive values will result in CCW (counter clockwise) rotation
Output is either 1 or 0 resulting in returning the the X or the Y coördinate of the rotated point

Program flow

START

START statement in column M. When this statement is processed an empty scriptfile is opened and from that moment on all rows containing data other than statements or commentsis interpreted as AutoCAD command syntax and is written into the opened scriptfile.

STOP

STOP statement in column M to close the scriptfile and end the processing of rows. The rows between the START and a STOP buildt up the the main program.

GOTO <row>

GOTO statement in column M forcing processing of rows to continue on the row specified by the <row> argument. You use this to jump out of your main program to a subroutine.
All values in the cells in columns A to K and on the same row as the GOTO statement are copied to the corresponding cells of the row where you jump to.
<row> the actual number of the row which will be processed next. This value needs to be in the cell directly next to the GOTO statement (column N)!

RETURN

RETURN statement in column M forcing processing of rows to continue with the next row directly below the row which stated the last GOTO. You typicly use this to end a subroutine and jump back into the main program.

FOR <> IS <start> TO <end> STEP <step>

FOR repeats (loops) a group of rows a specified number of times.
<> cell used by the FOR statement as a counter. (cool to reference in your calculations!)
<start> this is the inital value of <>
<end> this is the final value of <>
<step> this is the amount <> is changed each time trough the loop.

NEXT

NEXT statement in column M forcing processing of rows to jump back and continue with the row which stated the last FOR. (You can nest FOR NEXT loops 16 times).

Stack operators

PUT

PUT statement in column M which saves all values in the cells in columns A to K on the same row as the PUT statement on a memory stack.

GET

GET statement in column M which writes values -saved on top of the memory stack- in the cells in columns A to K on the same row as the GET statement.

POP

POP statement in column M to remove the saved values -by the last PUT statement- from the top of the memory stack.