Copyright: Copyright © 1998 Visio Corporation. All rights reserved.
Citation: 'IntelliCAD Developer Reference. Copyright © 1998 Visio Corporation. All rights reserved.


Programming Overview of LISP (LISt Processing) Language

LISP is an acronym for LISt Processing, a separate programming language that provides hooks into the IntelliCAD® program for customization. LISP is similar to AutoLISP®. LISP greatly extends the commands and functionality that are available in IntelliCAD.

LISP Functions

Each LISP command performs a function. For example, LISP functions can:

Load other LISP, DCL, or SDS programs and IntelliCAD files.

Prompt the user for input or alert the user to a situation.

Execute standard IntelliCAD commands.

Process alphanumeric strings.

Perform mathematical calculations.

Store values for later use.

Read and write files.

Test for given conditions and respond accordingly.

Select entities in a drawing.

Modify entities in a drawing.

Print information to the screen or to a file.

By writing programs that combine various LISP functions, you can create custom solutions that extend the CAD tools in IntelliCAD, integrate your drawings with other applications, and automate your work. Using LISP in tandem with IntelliCAD, you can enhance your CAD workstation by creating high-powered add-on applications for any advanced needs appropriate to your specialty, firm, profession, or industry.

NOTE For more information about compatibility between IntelliCAD's implementation of LISP and implementations found in other CAD systems, see LISP Compatibility.

LISP Symbols

Integer Numbers

An integer is a number that lacks the decimal point. For example, the numbers 0, 1, -512, and 9597 are all integers. In LISP, the value of an integer ranges from --2,147,483,648 to +2,147,483,647. When a function causes an integer to exceed that range, it is automatically converted to the opposite sign—i.e., -2,147,483,649 becomes 2,147,483,647. Note that you could think of this as wrapping around, so that when you add -1 to -2,147,483,649, you wrap to a +2,147,483,647, as visualized in the following diagram:

Real Numbers

A real number (also known as a "floating point" number) is a number containing the decimal point. Even though LISP displays a real number with six significant numbers (such as 2.00000), real numbers are stored in double-precision floating-point format. This the same as saying there are 14 significant digits of precision—for example, as in 2.0000000000000.

You will see that very large and very small real numbers are expressed in scientific notation, such as 3.44861E-07, which is the same as 0.000000344861. Real numbers in the range between -1 and 1 must contain a leading zero, such as 0.9, 0.0, and -0.1. LISP predefines pi as a real number with the value of 3.14159. LISP provides many functions for working with and converting real numbers.

NOTE A decimal point must be prefixed by a digit. For example, 0.5 is valid but .5 results in an IntelliCAD error message, "Error: invalid argument list."

Strings

A string is a group of alphanumeric characters surrounded by quotation marks, such as "VPORT" and "Please type your name:". The maximum string IntelliCAD supports is 132 characters long. A string that consists of "" is called empty.

To use control codes (also known as escape codes), use the backslash ( \ ) character as a prefix. For example, \n is the control code for starting a new line. To show a quotation mark within a string, use \", as in "The screw is 1\" long." LISP provides many functions (all those beginning with str, plus numerous others) for manipulating strings.

Entity Names

An entity name is a unique hexadecimal label given to every entity in the drawing, such as <Entity name: 6abc1236> . In LISP, you never work with the actual entity. Rather, you first find out its entity name; then you work with that entity name. LISP uses the term entity rather than object for historical reasons; however, the two words mean the same thing.

Lists

All of LISP consists of lists. A list is comprised of any numbers or text separated by spaces and surrounded by parentheses, such as (1 2 3), (* pi 2), (cen rad), and ("The answer is: " ANS).

A list of two numbers is commonly used as a 2D x,y-coordinates, such as (1.0 2.0). A list of three numbers is commonly used a 3D x,y,z-coordinates, such as (10.0 11.0 12.0). A special kind of list, called the dotted pair, is used to describe entity data, such as (62 . 1). Dotted pair data is very similar to (though not exactly the same as) DXF codes. For example, (62 . 1) means the entity is colored (group code 62) red, color #1. LISP provides many functions (all those beginning with "ent") for examining entity data.

Selection Sets

A selection set is a grouping of one or more entities. LISP provides many functions (all those beginning with the prefix ss) for creating and working with selection sets.

File Descriptors

A file descriptor is a hexadecimal label assigned to a file when it is opened by LISP, such as <File: #82011>. As with entity data, you never refer directly to the file's name; rather, you work with the file descriptor. LISP can open a file for reading, writing, or appending; it can only work with ASCII files (no binary files) and only provides sequential access (no random access).

See Also

LISP Compatibility

Copying Code Examples from the IntelliCAD Programmer's Reference


LISP Compatibility

Functions Unique to IntelliCAD® LISP

The following functions are unique to the implementation of LISP included with IntelliCAD:

Function	Comments
lpad	Pads a text string with spaces to the left.
rpad	Pads a text string with spaces to the right.
tan	Returns the tangent.
trim	Trims spaces from a string.
LISP-Compatible Functions with Enhanced Features

The following functions in IntelliCAD's implementation of LISP have enhanced features:

Function	Comments
osnap	IntelliCAD supports these additional entity snap modes:
Mode	Meaning
"po"	POint
"pla"	PLAnview (2D intersection)
"vis"	VISible (apparent intersection)
ssget and ssadd	IntelliCAD recognizes these additional selection set parameters:
Mode	Meaning	Points	Example
"CC"	Crossing Circle	point1 point2	(ssget "CC" '(1 1) '(2 2))
"O"	Outside	points-list	(ssget "O" ptlist)
"OC"	Outside Circle	point1 point2	(ssget "OC" '(1 1) '(2 2))
"OP"	Outside Polygon	points-list	(ssget "OP" ptlist)
"PO"	POint	point1	(ssget "PO" '(1 1))
Functions Partially Compatible with LISP in Other CAD Systems

The following function is partially compatible with the LISP found in other CAD systems:

Function	Comments
menucmd	IntelliCAD supports P0 (cursor menu) and P1 through P16 (the pulldown menus). IntelliCAD does not support A (aux menus), B (button menus), I (icon menus), M (diesel expressions), S (screen menu), or T (tablet menus).
Functions Not Supported by IntelliCAD

IntelliCAD does not support the following functions found in other CAD systems: arx, arxload, arxunload, autoarxload, dictadd, dictnext, dictremove, dictrename, dictsearch, entgetx, initdia, namedobjdict, ssnamex, and tablet.

See Also

Programming Overview of LISP

Copying Code Examples from the IntelliCAD Programmer's Reference


(+)
(+ number1 number2 ...)

"Add all these numbers together."	LISP Function

This function returns the sum of all numbers. You can use real numbers or integers. Adding all integer numbers returns an integer number. When there is a combination of real numbers and integers, the result is a real number.

Examples

This expression	Returns
(+ 6 7)	13
(+ 8 7.25)	15.2500
(+ 12 24 18)	54
(+)	0
(+ 2)	2
NOTE A decimal point must be prefixed by a digit. For example, 0.5 is valid, but .5 results in an IntelliCAD® error message, "Error: invalid argument list."

See Also

1+

- (Subtraction operator)

setq

Programming Overview of LISP

LISP Compatibility


(-)
(– number1 number2 ...)

"Subtract all following numbers from the first number."	LISP Function

This function returns the difference between the numbers. When you have only two numbers, the function subtracts number2 from number1. If there are more than two numbers, subtract the sum of the second through the last number (number2 through numbern) from the first, number1.

Examples

This expression	Returns
(- 5 2)	3
(- 6 [-5])	11
(- 9 3 11)	5
(-)	0
(- 2)	-2
(- 4 1.0)	3.00000
See Also

1-

+ (Addition operator)

setq

Programming Overview of LISP

LISP Compatibility


(*)
(* number1 number2 ...)

"Multiply all numbers together."	LISP Function

The multiply function returns the product of all numbers. You can use real numbers or integers.

Multiplying all real numbers returns a real number. The same is true for integers; multiplying all integers returns an integer. However, when there is a combination of real numbers and integers, the result is a real number.

Examples

This expression	Returns
(* 7 11)	77
(* 8 3.2 9)	230.400
(* 80 3.2 90)	23040.0
(*)	0
(* 2)	2
(* 2 -3)	-6
See Also

/ (Division operator)

setq

Programming Overview of LISP

LISP Compatibility


(/)
(/ number1 number2 ...)

"Divide the first number by the following numbers."	LISP Function

This function returns the quotient between the two numbers. If you have two numbers, divide number1 by the number2. If there are more than two numbers, divide the number1 by the product of all the following numbers.

You can use real numbers or integers. Dividing all real numbers returns a real number. The same is true for integers; dividing all integers returns an integer. However if there is a combination of real numbers and integers, the integers are recognized as real, and the result is a real number.

Examples

This expression	Returns
(/ 8 4)	2
(/ 6.0 12 5)	0.100000
(/ 600.0 5)	120.000
(/ 8 10 5)	0
(/ 6 -3)	-2
(/)	0
(/ 0.5)	0.500000
NOTE A decimal point must be prefixed by a digit. For example, 0.5 is valid but .5 results in the IntelliCAD® message, "Error: invalid argument list."

See Also

* (Multiplication operator)

rem

fix

float

setq

Programming Overview of LISP

LISP Compatibility


(~)
(~ number)

"Apply the 1s compliment."	LISP Function

This function returns the bitwise NOT of a number. The number must be an integer.

Examples

This expression	Returns
(~ 10)	-11
(~ 0)	-1
(~ -25)	24
See Also

and

boole

not

or

Programming Overview of LISP

LISP Compatibility


(=)
(= item1 item2 ...)

"Return T if they're the same."	LISP Function

This function tells you whether two (or more) items are equal:

If they are equal, the result is a T (true).

If not, this function returns nil (false).

If the function contains more than two items, this function returns T (true) when each item to the right is equal to the item on its left. The items can be numbers or strings.

Examples

This expression	Returns
(= 8 8)	T
(= 10 10.0 10)	T
(= "x" "y")	nil
(= "door" "door")	T
(= a b)	T (when a and b are the same)
(= 10)	T
Notes

Don't confuse the = function with the equal function. Here's the difference: The = function compares numbers and strings; the equal function compares lists.

Both = and equal perform comparisons; neither performs the "equals" function you might expect from arithmetic, such as 1 + 2 = 3. In LISP, that service is provided by the setq function.

See Also

eq

/= (Not Equal To operator)

< (Less Than operator)

<= (Less Than or Equal To operator)

> (Greater Than operator)

>= (Greater Than or Equal To operator)

if

cond

while

Programming Overview of LISP

LISP Compatibility


(/=)
(/= item1 item2 ...)

"The two aren't equal."	LISP Function

This function tells you if two items are not equal:

If item1 does not equal item2, this function returns a T (true).

If the two items are equal, this function returns nil (false).

When more than two items are given, each item must be different to return a T. The items can be numbers or strings.

Examples

This expression	Returns
(/= 5 4)	T
(/= 8.0 8)	nil
(/= "x" "x" "x")	nil
(/= "x" "x" "y")	nil
(/= "x" "y" "z")	T
(/= 5)	T
NOTE Comparison statements (such as = (equal to operator), /= (not equal to operator), and < (less than operator) are typically used together with conditional statements, such as if...then, while, and cond. The comparisons let you test a pair of conditions (for example, does i= 0) to know when to exit the conditional (for example, while i > 0).

See Also

<= (Less Than or Equal To operator)

> (Greater Than operator)

>= (Greater Than or Equal To operator)

if

cond

while

Programming Overview of LISP

LISP Compatibility


(<)
(< item1 item2 ...)

"The first is less than the others."	LISP Function

The less-than function returns a T (true) or a nil (false):

If the item1 is less than item2 (and so on), this function returns a T.

If item2 is greater or equal to the first, this function returns nil.

If this function contains more than two items, the function returns T when each item to the right is less than the item on its left. The items can be numbers or strings.

Examples

This expression	Returns
(< 9 11)	T
(< 25 20)	nil
(< 2 6 7)	T
(< 2)	T
(< -2)	T
(< "x" "x")	nil
(< "x" "y" "z")	T
NOTE This function is the opposite of the >=(Greater Than or Equal To operator) function.

See Also

= (Equal To operator)

/= (Not Equal To operator)

<= (Less Than or Equal To operator)

> (Greater Than operator)

if

cond

while

Programming Overview of LISP

LISP Compatibility


(<=)
(<= item1 item2 ...)

"The first is less than or equal to the others."	LISP Function

This function is the less-than or equal-to operator:

If item1 is less than or equal to item2, this function returns a T (true).

If item1 is greater than item2, this function returns nil (false).

If this function contains more than two items, the function returns T when each item to the right is less-than or equal to the item on its left. The items can be numbers or strings.

Examples

This expression	Returns
(<= 8 12)	T
(<= 7 16 16)	T
(<= 7)	T
(<= "x" "x" "z")	T
(<= "x" "y" "x")	nil
NOTE This function is the opposite of the > (Greater Than operator) function.

See Also

= (Equal To operator)

/= (Not Equal To operator)

< (Less Than operator)

>= (Greater Than or Equal To operator)

if

cond

while

Programming Overview of LISP

LISP Compatibility


(>)
(> item1 item2 ...)

"The first is greater than the others ."	LISP Function

The greater-than function displays a T (true) or a nil (false):

If the first item is greater than the second item (and so on), this function returns a T.

If the second item is less than or equal to the first, this function returns nil.

If this function contains more than two items, the function returns T when each item to the right is greater than the item to its left. The items can be numbers or strings.

Examples

This expression	Returns
(> 6 4.9)	T
(> 7 8)	nil
(> 6 4 4)	nil
(> 6)	T
(> "y" "x")	T
NOTE This function is the opposite of the <= (Less Than or Equal To operator) function.

See Also

= (Equal To operator)

/= (Not Equal To operator)

< (Less Than operator)

> (Greater Than operator)

if

cond

while

Programming Overview of LISP

LISP Compatibility


(>=)
(>= item1 item2 ...)

"The first is greater than or equal to the others."	LISP Function

This function is the greater-than or equal-to operator:

If item1 is greater than or equal to item2, this function returns a T (true).

If it is less than, this function returns nil (false).

If this function contains more than two items, the function returns T when each item to the right is greater-than or equal to the item on its left. The items can be numbers or strings.

Examples

This expression	Returns
(>= 3.1 3.0)	T
(>= 6 5 5)	T
(>= 6)	T
(>= "x" "y" "z")	nil
NOTE This function is the opposite of the < (Less Than operator) function.

See Also

= (Equal To operator)

/= (Not Equal To operator)

<= (Less Than or Equal To operator)

> (Greater Than operator)

if

cond

while

Programming Overview of LISP

LISP Compatibility


(1+)
(1+ number)

"Add 1 to the number."	LISP Function

This function adds 1 to the number. You can use a real number or an integer. This function takes exactly one argument.

Examples

This expression	Returns
(1+ 22)	23
(1+ 5.02)	6.02000
(1+ -36)	-35
NOTE This function is useful as an increment counter.

See Also

1-

+ (Addition operator)

setq

Programming Overview of LISP

LISP Compatibility


(1-)
(1- number)

"Subtract 1 from the number."	LISP Function

This function subtracts 1 from the number. You can use a real number or an integer. This function takes exactly one argument.

Examples

This expression	Returns
(1- 8)	7
(1- 9.75)	8.75000
(1- -18)	-19
NOTE This function is useful as an decrement counter.

See Also

1+

- (Subtraction operator)

setq

Programming Overview of LISP

LISP Compatibility


(abs)
(abs number)

"Specify that number's distance from 0 (zero), disregarding direction (positive or negative)."	LISP Function

This function returns the absolute value of the number. You can use a real number or an integer. This function takes exactly one argument.

Examples

Code	Returns
(abs 56)	56
(abs -2.3)	2.30000
(abs -49)	49
Notes

Use this function to convert a negative number to a positive number, or to ensure the number is positive.

When you need to make sure a number is negative, first apply the abs function, and then subtract the number from 0.

See Also

fix

float

minusp

Programming Overview of LISP

LISP Compatibility


(acad_colordlg)
(acad_colordlg [color-number] [flag])

"Display the Select Color dialog box."	LISP Function

This function displays the Color dialog box. This function returns the color number that the user selects from the dialog box or nil when the user clicks the Cancel button.

The function accepts two optional arguments:

Argument	Meaning	Example	Range
color-number	Color Number	1	0 - 256
flag	Flag	nil	nil
Notes

The color-number argument lets you provide a default color. When clrno is 0, the default is BYBLOCK; when clrno is 256, the default is BYLAYER.

The flag argument has only one value: nil. When nil, the dialog box disables the BYBLOCK and BYLAYER buttons.

Examples

Code	Result
(acad_colordlg)	Displays dialog box.
(acad_colordlg 1)	Displays dialog box with color 1 (red) selected as the default.

NOTE The first eight color numbers have the following meanings:

Number	Color
1	Red
2	Yellow
3	Green
4	Cyan (light blue)
5	Blue
6	Magenta (pink)
7	Black
8	Gray
See Also

command

help

getvar

setvar

Programming Overview of LISP

LISP Compatibility


(acad_strlsort)
(acad_strlsort list)

"Sort strings in alphabetical order."	LISP Function

This function sorts the list of strings in alphabetical order. The list contains one or more strings, which have been previously defined or returned with the quote (') function.

Examples

Code	Returns
(acad_strlsort '("ssg" "hlg" "kng"))	("hlg" "kng" "ssg")
(setq holiday '("Sun" "Mon" "Sat")) (acad_strlsort holiday)	("Mon" "Sat" "Sun")
Note: The ' (quote) prefix is actually a LISP function that prevents another LISP function from evaluating the list.

See Also

list

listp

reverse

Programming Overview of LISP

LISP Compatibility


(action_tile)
(action_tile key expression)

"Respond when the user clicks a dialog box tile."	LISP Function

This function assigns the expression to evaluate when the user selects the tile referenced by key. Both expression and key are strings; key is case-sensitive. Expression is typically another LISP function; key refers to the tile. This function operates on tiles that are user-selectable elements of a dialog box, such as radio buttons, check boxes, or buttons.

The expression refers to the tile, using the following arguments:

Argument	Meaning
$value	Current  value
$key	Tile name
$data	Application specific data
$reason	Callback reason
$x	Image x-coordinate
$y	Image y-coordinate
Example

Code	Returns
(action_tile "xpt" x_coord)	nil
Notes

The expression assigned by action_tile overrules the default action of the dialog box (which is assigned via the new_dialog function) and the tile's action attribute.

The command function cannot be called by action_tile.

See Also

client_data_table

Programming Overview of LISP

LISP Compatibility

Programming Overview of DCL


(add_list)
(add_list string)

"Add some text to an existing dialog box string."	LISP Function

This function adds (or replaces) a string in the currently active dialog box. This function must follow the start_list function, which determines: (1) which string is affected; and (2) whether the string is added to or replaces another string.

Example

See start_list for example usage.

NOTE You also use this function when creating list boxes and drop-down list boxes in DCL. For examples using this function in conjunction with DCL, see list_box and popup_list (drop-down list box).

See Also

end_list

Programming Overview of LISP

LISP Compatibility

Programming Overview of DCL


(ads)

"Check what SDS™ applications are loaded into IntelliCAD®."	LISP Function

This function tells you the names of SDS applications currently loaded into IntelliCAD. The name includes the complete path. The names of all SDS applications are strings, forming a list.

Examples

Code	Returns
(ads)	nil (When no SDS apps are loaded.)
(ads)	("tower" "c:\\intellicad\\endpoint")
See Also

xload

xunload

Programming Overview of LISP

LISP Compatibility


(alert)
(alert string)

"Display this alert for the user."	LISP Function

This function displays a dialog box with your string (a custom message) and the OK button. To display more than one line of text, use the new-line character (\n) in the string. to separate lines of text.

Examples

Code	Returns
(alert "You must select an option")	You must select an option
(alert "Select an option: \n M or F")	Select an option:  M or F
Note: Since all dialog boxes must accommodate small, 640 x 480-pixel displays, it's a good idea to keep the alert text brief and to the point.

See Also

*error*

Programming Overview of LISP

LISP Compatibility


(alloc)
(alloc integer)

"Set the memory segment size for LISP."	LISP Function

This function sets the number of segments (a measurement of memory) for LISP operations, as specified by integer. The function returns the amount of memory previously allocated, as shown by the examples below.

Examples

Code	Returns
(alloc 2)	514
(alloc 0)	2
(alloc 512)	0
See Also

expand

gc

Programming Overview of LISP

LISP Compatibility


(and)
(and expression ...)

"Apply the logical AND."	LISP Function

This function performs a logical AND to the expression that precedes it. If both statements return T (true), the and function returns T. If either or both of the statements returns nil (false) the and function returns nil.

Examples

Code	Returns
(setq d 9) (and (> d 12) (< d 13))	nil
(setq d 12.25) (and (> d 12) (< d 13))	T
See Also

~

boole

not

or

Programming Overview of LISP

LISP Compatibility


(angle)
(angle point1 point2)

"Determine the angle between these points."	LISP Function

This function returns the angle between point1 and point2 in the current UCS. The first point determines the line parallel to the x-axis. When point2 is plotted and connected to point1, the resulting angle is returned in radians.

Examples

Code	Returns
(angle '(1 1) '(3 3))	0.7854
(angle '(2.0 3.3 1.3) '(5.2 8.9 6.0))	1.0517
Notes

This function is different from the getangle function. Getangle prompts the user to select two points defining an angle.

LISP always measures all angles in radians. Use the following LISP function to convert degrees to radians:

(defun dtor (d)
(* PI (/ d 180.0)
)

See Also

angtof

angtos

polar

rtos

Programming Overview of LISP

LISP Compatibility


(angtof)
(angtof string [mode])

"Change this angle to a real number."	LISP Function

This function converts a string that contains an angle to a real number in radian format. The optional mode specifies the format of the "number" in the string:

Mode value	String format
0	Decimal degrees
1	Degrees-minutes-seconds
2	Grad
3	Radian
4	Surveyor's units
NOTE This command fails if the text of the string is not recognizable as an angle measurement.

Examples

Code	Returns
(angtof "90")	1.57080
(angtof "90" 0)	1.57080
(angtof "90d30’10\"")	1.57957
Notes

The backslash denotes that there is a quote within the string. When LISP sees the second quote, it knows this is the end of the string.

The angtof function is the opposite of the angtos function.

See Also

angle

getangle

polar

rtos

Programming Overview of LISP

LISP Compatibility


(angtos)
(angtos angle [mode [precision]])

"Change this angle to a string."	LISP Function

The angtos function converts the angle in radians to strings. This is similar to the rtos function, but angtos converts angles to strings rather than converting numbers to strings. The optional mode argument (0 through 5) selects the format of the string:

Mode	Description	Example
0	Decimal degrees	360d
1	Deg-min-sec	47d29'15"
2	Grad	132g
3	Radian	6.28r
4	Surveyor's units	N 82d W
NOTE The optional precision argument allows you to select the number of places after the decimal point. The range is from 0 to 15.

Examples

Code	Returns
(angtos 1.570796)	"90"
(angtos 1.570796 2 4)	"100.0000g"
(angtos 0.654932 1 3)	‘37d31’29""
See Also

angle

angtof

getangle

polar

rtos

Programming Overview of LISP

LISP Compatibility


(append)
(append list1 list2 ...)

"Add everything in this list to an existing list."	LISP Function

This function adds list2 to list1. The list2 element is a list of a single item. You can append multiple lists.

Examples

Code	Returns
(setq m '(A B C D E F))	(A B C D E F)
(append m '(G))	(A B C D E F G)
(setq m (append m '(G H I) (LIST 1 2 3)))	(A B C D E F G H I 1 2 3)
(append)	nil
See Also

acad_strlsort

length

listp

nth

reverse

subst

Programming Overview of LISP

LISP Compatibility


(apply)
(apply function list)

"Make list do what func says."	LISP Function

This function performs a function to the list. The first argument, function, is either a pre-defined or user-defined function with a quote (') preceding it. The second argument must be a list. This function is useful when building a list dynamically.

Examples

Code	Returns
(apply '/ '(10 5))	2
(apply '> '(6 7))	nil
Notice that the following are equivalent to the previous examples:

Code	Returns
(/ 10 5)	2
(> 6 7)	nil
See Also

defun

lambda

Programming Overview of LISP

LISP Compatibility


(ascii)
(ascii string)

"Convert the first character of str to ASCII."	LISP Function

This function converts the first character of the string to its numerical ASCII code.

Examples

Code	Returns:
(ascii "X")	88
(ascii "x")	120
(ascii "Fun")	70
(ascii "FUN")	70
See Also

atoi

atof

angtof

chr

Programming Overview of LISP

LISP Compatibility


(assoc)
(assoc item list)

"Find the first matching item in the list."	LISP Function

This function finds and returns the first sublist in list whose first element matches the association item. If a non-list element is encountered within list, the search is halted for subsequent elements. The list may contain dotted pairs from the cons and entget functions.

Examples

Code	Returns
(setq bigl '((a b c)(d)(e f g))) (assoc 'e bigl)	(E F G)
(setq bigl '((a b c) d (e f g)) (assoc 'e bigl)	nil
(setq elist (entget (car (entsel "Select entity:")))) (princ (strcat "\nYou selected a " (cdr (assoc 0 elist))))
Note: This function is often used in conjunction with the dotted pairs returned by the cons and entget functions.

See Also

length

mapcar

member

nth

subst

Programming Overview of LISP

LISP Compatibility


(atan)
(atan number1 [number2])

"Calculate the arctangent."	LISP Function

This function returns the principle arc tangent of the quotient number1 divided by number2. If number2 is not supplied, it is assumed to be 1.0, thus returning the principle arctan of number1. The value returned is always between -pi/2 and pi/2 radians.

Examples

Code	Returns
(atan 0.25)	0.24498
(atan -2)	-1.10715
(atan 1.0 0.75)	0.927295
See Also

cos

pi

sin

tan

Programming Overview of LISP

LISP Compatibility


(atof)
(atof string)

"Convert the string to a real number."	LISP Function

This function converts a string into a real number. This command returns 0.0 if the text of the string is not recognizable as a number.

Examples

Code	Returns
(atof "59")	59.0
(atof "213.35")	213.350
(atof ".1")	0.100000
(atof "Hello")	0.000000
See Also

atoi

ascii

angtof

chr

Programming Overview of LISP

LISP Compatibility


(atoi)
(atoi string)

"Convert the string to an integer."	LISP Function

The atoi function converts a string into an integer. If the string contains numbers after the decimal point, it truncates them. This command returns 0 if the text of the string is not recognizable as a number.

Examples

Code	Returns
(atoi "-25")	-25
(atoi "37.8")	37
(atoi "Hello")	0
See Also

ascii

atof

angtof

chr

Programming Overview of LISP

LISP Compatibility


(atom)
(atom item)

"Determine whether or not an item is an atom."	LISP Function

Generally, an atom is considered a number or a variable. More specifically, it is anything other than a list. The atom function tests item to see if it is an atom. If item is a list, a nil is returned. If it is not a list, a T is returned.

Examples

Code	Returns
(atom '(1 2 3))	nil
(atom 5)	T
(atom '5)	T
See Also

atoms-family

listp

numberp

type

Programming Overview of LISP

LISP Compatibility


(atoms-family format [symbol1 symbol2 ...])

"Determine which function names are being used."	LISP Function

This function lists all the pre-defined and user-defined functions in the current session. The format argument specifies how the information is returned. Format is an integer value of 0 or 1.

Format	Meaning
0	Defined functions are returned as a list.
1	Defined functions are returned as a list of strings.
The optional argument [symbol1symbol2 …] is a list of strings representing symbols. It is used to confirm whether the function names are defined in the current session. If symbol1, symbol2, … are defined, LISP returns the symbols as strings, depending on the format chosen. If one is not defined, a nil is returned in place of the symbol.

Examples

Code	Returns
(setq hi "Greeting 1")
(setq bye "Greeting 2")
(atoms-family 0 '("hi" "bye"))	(HI BYE)
(atoms-family 0 '("hi" "hello" "bye"))	(HI nil BYE)
(atoms-family 1 '("hi" "bye"))	("HI" "BYE")
See Also

atom

defun

lambda

setq

Programming Overview of LISP

LISP Compatibility


(autoload)
(autoload application list)

"Automatically load the LISP application when one of its commands is used."	LISP Function

This function returns associates a list of command names with an application name. Then, when the user types a command name, IntelliCAD® searches for and loads the associated LSP file.

Example

Code	Returns
(autoload "routine" '("start" "run" "stop"))	nil
See Also

load

autoxload

Programming Overview of LISP

LISP Compatibility


(autoxload)
(autoxload application list)

"Automatically load the SDS™ application when one of its commands is used."	LISP Function

This function returns associates a list of command names with an application name. Then, when the user types a command name, IntelliCAD® searches for and loads the associated SDS file.

Example

Code	Returns
(autoxload "routine" '("start" "run" "stop"))	nil
See Also

ads

xload

xunload

Programming Overview of LISP

LISP Compatibility


(boole)
(boole function integer1 integer2 ...)

"Apply the bitwise Boolean function."	LISP Function

This function applies the bitwise Boolean function. The function argument is an integer between 0 and 15; it represents the 16 possible Boolean functions in two variables. Each bit of integer1 is paired with the corresponding bit of integer2.

The following shows the Boolean truth table:

integer1	integer2	function
1	1	1
1	0	2
0	1	4
0	0	8
The following values of function are the AND, XOR, OR, and NOR Boolean operators:

Function	Operation	Resulting bit is 1 when
1	AND	Both input bits are 1.
6	XOR	Only one of the two input bits is 1.
7	OR	Either or both of the input bits are 1.
8	NOR	Both input bits are 0 (1's complement).
Examples

Code	Returns
Logical AND: (boole 1 10 9)	8
Logical XOR: (boole 6 10 9)	3
Logical OR (boole 7 10 9)	11
Logical NOR: (boole 8 10 9)	-12
See Also

~

and

or

Programming Overview of LISP

LISP Compatibility


(boundp)
(boundp item)

"Determine whether an item has a value."	LISP Function

The boundp function determines if item has a corresponding value bound to it. If item does have a value bound to it, LISP returns T. If not, or if item is bound to nil, a nil is returned.

Examples

Code	Returns
(setq x nil y 7)
(boundp 'x)	nil
(boundp 'y)	T
(boundp 'z)	nil
NOTE The boundp function is the opposite of the null function.

See Also

atoms-family

atom

numberp

null

type

setq

Programming Overview of LISP

LISP Compatibility


(car)
(car list)

"Get the first item of the list."	LISP Function

This function takes a list apart and returns the first element of the list. For example, if you had a list of points such as (1.0 2.0 3.0), the car function would return the first element of the list, or 1.0.

Example

Code	Returns
(setq a '(first second third)	(“FIRST” “SECOND” “THIRD”)
(setq b (car a))	“FIRST”
See Also

cdr

append

cons

last

length

list

reverse

setq

Programming Overview of LISP

LISP Compatibility


(cdr)
(cdr list)

"Get everything in the list except the first item."	LISP Function

This is the secondary function for taking a list apart. Like the car function, this function returns a portion of the string. This portion includes the second element of the list, along with any remaining elements. For example, if your list contained the points (5.0 3.0 1.0), then using the cdr function would return 3.0 1.0.

Examples

Code	Returns
(setq a '(one two three four)	(“ONE” “TWO” “THREE” “FOUR”)
(setq b (cdr a))	(“TWO” “THREE” “FOUR”)
Note: The a of car and the d of cdr can be combined to create a whole host of cadr possibilities:

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
See Also

append

cons

last

length

list

reverse

setq

Programming Overview of LISP

LISP Compatibility


(chr)
(chr integer)

"Convert this integer to ASCII."	LISP Function

The chr function converts an ASCII code into the corresponding character. The ASCII code is an integer.

Examples

Code	Returns
(chr 88)	“X”
(chr 120)	“x”
(chr 0)	""
(chr 2)	"/002"
See Also

ascii

Programming Overview of LISP

LISP Compatibility


(client_data_table)
(client_data_table key data)

"Associate data with a dialog box tile."	LISP Function

This function associates user-defined data with a dialog box tile. The key specifies the tile; key is a case-sensitive string. The data is a string that specifies the data, which can be referred as $data.

See Also

action_tile

dimx_tile

dimy_tile

get_attr

get_tile

mode_tile

set_tile

Programming Overview of LISP

LISP Compatibility


(close)
(close file-descriptor)

"Close an open file."	LISP Function

This function closes access to a file that has been previously opened with the open function. Strictly speaking, it is not necessary to close files, since IntelliCAD® does that when it exits. However, for good housekeeping, it's a good idea to use the close function.

The file-descriptor argument represents the file descriptor assigned when the file was opened using the open function. The file descriptor remains after the file is closed but is not valid.

Example

Code	Returns
(close fil)	nil
NOTE The file-descriptor must be assigned to a symbol using setq, so the symbol must be used with the close function as the file-descriptor.

See Also

print

Programming Overview of LISP

LISP Compatibility


(command)
(command cmd [arguments] ...)

"Carry out this  IntelliCAD® command.

With this function, you can use any IntelliCAD command within a LISP program. Any of the arguments that follow will be used for that command. Any input needed should be stored as variables using setq. Points should be assigned to variables after using the function getpoint.

Some commands continue past the points you have specified. To exit from a command, type a space within quotes to represent an Enter, thus ending the command.

Examples

Code	Results
(command "arc" '(0 0) '(2 4) '(8 20))	Using preset points.
(command "arc" p1 p2 p3)	Using preset variables.
(command "line" p1 p2 p3 " ")	Space to end the command.
See Also

defun

help

menucmd

Programming Overview of LISP

LISP Compatibility


(cond)
(cond (statement1 result1 ...) ...)

"Do it, if it's true."	LISP Function

This function is a commonly used conditional in LISP. If statement1 evaluates to true, any functions that follow within that block are performed, and the result of the last function is returned.

If statement1 evaluates to nil, LISP continues to statement2. If true, it follows the same procedure.

If false (or nil), LISP continues to search for a true statement.

If no true statements are found, a nil is returned.

If there are no result functions in the block, the result of the condition is returned.

Examples

Code	Results
(cond ((zerop x) 0)	(T nil))
In the previous example, the cond function looks at (zerop x) and decides if it is not nil. If so, it returns zero (0). If not, it moves to the second test, (T nil). This test is already true (T) and would return a nil. Look at the following setqs of actual examples of the above condition.

Code	Results
(setq x 8)	nil
(setq x 0)	0
In the next example, if d is set to 5, LISP returns the string “Equal to.”  If set to 6, it returns “Greater than.”

Code

(cond ((< d 5) "Less than")

      ((= d 5) "Equal to")

      ((> d 5) "Greater than")

)

See Also

if

repeat

while

Programming Overview of LISP

LISP Compatibility


(cons)
(cons item list)

"Add this item to the beginning of the list."	LISP Function

This function constructs a new list using separate elements. This function also enables you to create a dotted pair, used by IntelliCAD® to access entity data. A dotted-pair is created only when the function is used to join two individual items together in the form (cons item item).

The first argument, item, is the item which will be added to the beginning of the list. The item may be a list itself, but will still be treated in the list as a single item.

Examples

Code	Returns
(cons 'a '(b c d))	(A B C D)
(cons 'a 'b)	(A . B)  (Dotted pair)
(cons  '(a b) '(c d))	((A B) C D)
See Also

append

length

member

Programming Overview of LISP

LISP Compatibility


(cos)
(cos angle)

"Calculate the cosine."	LISP Function

This function returns the cosine of an angle. The angle must be in radian form, and the result is a real number.

Examples

Code	Returns
(cos pi)	-1.000000
(cos 1.5)	0.0707372
(cos (/ pi 2))	0.000000
See Also

atan

sin

tan

pi

Programming Overview of LISP

LISP Compatibility


(cvunit)
(cvunit value from to)

"Convert this unit to that unit."	LISP Function

This function converts the value from one type of measurement to another. The value is the number you want to convert. The from and to arguments convert from one unit to another.

For example, (cvunit 10 "hour" "day") converts from hours to days). If the two units of measurement are incompatible, a nil is returned.

The units of measurements are found in the icad.unt file. For more information on customizing this file, see Chapter 17, "Customizing IntelliCAD," in the IntelliCAD User's Guide.

Examples

Code	Returns
(cvunit 1 "day" "second")	86400.0
(cvunit 2 "meter" "yard")	2.1872
(cvunit '(2 3) "mile" "feet")	(10560.0 15840.0)
Note: Points (or lists of numbers) can be converted, too, as shown by the above examples.

See Also

angtof

angtos

ascii

atof

atoi

chr

distof

fix

float

itoa

rtos

strcase

Programming Overview of LISP

LISP Compatibility


(defun)
(defun [c:] name ([arg1 arg2 ...] / [local-var1 local-var2 ...]) expression)

"Create a LISP function."	LISP Function

When you write a LISP file, the file itself is not actually the function. Rather, one LISP file contains one or more functions (or programs) that are all available when the file is loaded with the load function.

The name of a function must be defined in the first statement using the defun function. This function is the first actual command within the program. It begins with an open parenthesis, which closes at the end of the program.

The defun function is followed by the name of your function or program. Once a name is selected, you have a few choices:

First, you can do nothing by adding ( ). This indicates that any variables used in the program are global, meaning they don’t lose their value once the program ends. For example, the variable A defined as 12 would be 12 for any other program in the LISP file as well:

(defun newfunc ( )

...

)

Another option is to make all variables local to the program. For instance, if you defined N to equal 15, it would be 15 only for this particular program while it is running. To show that the variable is local, precede it with a forward slash (/) after the name of the program:

(defun newfunc ( / N)

...

)

Sometimes you may want to pass an argument to the program. This means that the variable will be assigned a value from outside of the currently running program. Place these variables before the slash:

(defun newfunc (A / N)

...

)

Once your function is defined with all its variables, you can choose to use the C: option. Prefixing the C: to the function name enables the command name to be entered without parenthesis at the command prompt of IntelliCAD. This makes it look like any other IntelliCAD command such as Line, Arc, and Circle.

(defun C:newfunc ( A / N)

...

)

NOTE The C: has nothing to do with your computer's C: drive. In LISP, it is short for "command" and tells IntelliCAD® to treat the LISP function like an IntelliCAD command.

Following the lists of variables, the expression that will make up the body of the program must be entered before the closing parenthesis.

Examples

Code	Results:
(defun newfunc ( ) . . .)	May use global variables.
(defun newfunc (var1 var2). . . )	Newfunc receives two outside values.
(defun newfunc (/ var1 var2). . .)	Newfunc has two local variables.
See Also

command

atom-family

ads

menucmd

Programming Overview of LISP

LISP Compatibility


(dimx_tile)
(dimx_tile key)

"Determine the x-dimension of a dialog box tile."	LISP Function

This function, together with dimy_tile function, returns the dimensions of the tile with the name key. The x,y dimensions are typically used by other dialog box functions, such as vector_image.

Example

Code	Returns
(dimx_tile "pickbox_image")	20
(dimy_tile "pickbox_image")	15
Notes

The dimension returned is one less than the size, since the dimension begins at 0. Thus, for the example above, the size of the tile is 16 x 16.

The key is a case-sensitive string.

See Also

fill_image

slide_image

Programming Overview of LISP

LISP Compatibility


(dimy_tile)
(dimy_tile key)

"Determine the y-dimension of a dialog box tile."	LISP Function

This function, together with dimx_tile function, returns the dimensions of the tile with the name key. The x,y dimensions are typically used by other dialog box functions, such as vector_image.

Example

Code	Returns
(dimx_tile "pickbox_image")	20
(dimy_tile "pickbox_image")	15
Notes

The dimension returned is one less than the size, since the dimension begins at 0. Thus, for the example above, the size of the tile is 16 x 16.

The key is a case-sensitive string.

See Also

fill_image

slide_image

Programming Overview of LISP

LISP Compatibility


(distance)
(distance point1 point2)

"Determine the distance between two points."	LISP Function

The distance function returns the distance between two points. Point1 and point2 are the x,y or x,y,z coordinates of the point.

Example

Code	Returns
(setq a '(2 3)) (setq b '(5 1)) (distance a b)	3.60555
See Also

angle

inters

polar

setq

Programming Overview of LISP

LISP Compatibility


(distof)
(distof string [mode])

"Convert a string to a real number."	LISP Function

This function converts a string that contains a real number to a real number (distof is short for DIStance TO Floating point). The distof is opposite the rtos function. The optional mode specifies a number format, like the rtos function:

Mode	Format
1	Scientific.
2	Decimal.
3	Engineering: feet and decimal inches.
4	Architectural: feet and fractional inches.
5	Fractional.
Examples

Code	Returns
(distof "2.3698E001")	23.698
(distof "2’-5.25\"" 3)	29.25
NOTE The backslash denotes that there will be a quote within the string. Once LISP sees the second quote, it knows it’s the end of the string.

See Also

atof

atoi

Programming Overview of LISP

LISP Compatibility


(done_dialog)
(done_dialog [flag])

"Dismiss that dialog box."	LISP Function

This function terminates a dialog box. It returns the x,y coordinates of the dialog box's position, which can be used by the start_dialog function to place the dialog in the same position.

Flag is an alternative return code that is returned by the start_dialog function; you can use this flag for any purpose you desire. When flag has a value greater than 1, the value is returned by the start_dialog function. Otherwise, the start_dialog function returns as follows:

Returns	Meaning
0	User clicked Cancel.
1	User clicked OK.
Example

Code	Returns
(done_dialog)	(0.000000 0.000000)
See Also

action_tile

new_dialog

Programming Overview of LISP

LISP Compatibility


(end_image)

"End the creation of a dialog box image."	LISP Function

This function signals the end of the creation of an image in the current dialog box, which was begun by the start_image function.

Example

Code	Returns
(end_image)	nil
See Also

new_dialog

load_dialog

Programming Overview of LISP

LISP Compatibility


(end_list)

"End the processing of a dialog box list.	LISP Function"

This function signals the end of processing a list in the current dialog box, which was begun by the start_list function.

Example

Code	Returns
(end_list)	nil
NOTE You also use this function when creating list boxes and drop-down list boxes in DCL. For examples using this function in conjunction with DCL, see list_box and popup_list (drop-down list box).

See Also

add_list

Programming Overview of LISP

LISP Compatibility

Programming Overview of DCL


(entdel)
(entdel entity-name)

"Erase that entity from the drawing."	LISP Function

This function deletes an entity (or entity) specified by entity-name if it exists in the drawing. Use the entnext or entget functions to get the entity's entity-name.

If the entity was deleted from the drawing earlier in the current editing session, the entity is restored. In other words, using entdel twice un-deletes the entity. This works until you exit the drawing. Once the drawing is reloaded, you can no longer use entdel to restore entities deleted in the previous drawing session.

Example

Code	Results
(setq a  (entnext))
(entdel a)	Delete entity.
(entdel a)	Undelete entity.
Notes

Only entities can be deleted with entdel, not attributes or polyline vertices. To delete attributes and polyline vertices, use the command function with the AttEdit and PEdit commands.

Entities within blocks may not be deleted. To delete entities within a block, use entmake to redefine the block without the entities you want erased.

See Also

entget

entlast

entmod

entsel

entupd

nentsel

nentselp

Programming Overview of LISP

LISP Compatibility


(entget)
(entget entity-name [application-list])

"Determine the DXF data of an entity."	LISP Function

This function retrieves the entity list from the drawing database. The list is assigned to a variable, and then is taken apart, using functions like car, cdr,and assoc.

The entity list returned is composed of element pairs called dotted pairs because a dot separates each half. In each pair, the first number represents the code number for a characteristic of the element; the second number is the data associated with the code.

Example

As an example, let’s draw a line and assign it the following variable values:

:Line

>Start point: 0,0

>Close/Undo/<Next point>: 5,5

:Change

Select entities: Pick line

Properties/<Change point>: P

(Color/Elev/LAyer/LType/ltScale/Thickness)? C

New color <BYLAYER>: 5

New Layer <0>: Electric

New Linetype <BYLAYER>: Continuous

Using the settings above, the following example applies:

Function	Returns	Code
(setq myline (entget (entlast)))	((-1 . <Entity name:	1fe0558>)
	(0 . "LINE")	0=Entity type
	(5 . "2B")	5=Handle
	(100 . "AcDbEntity")
	(8 . "Electric")	8=Layer name
	(62 . 5)	62=Color number
	(6 . "CONTINUOUS")	6=Linetype name
	(100 . "AcDbLine")
	(10 0.0 0.0 0.0)	10=x,y,z-coords
	(11 5.0 5.0 0.0)	11=Other x,y,z-coords
	(210 0.0 0.0 1.0))	210=x,y,z-extrusion
Notes

Entget does not return all information about an entity. Missing is dotted pair data about the entity's properties when they do not differ from default values: color, linetype, thickness, attributes-follow flag, and the entity handle.

While the data returned by entget is very similar to DXF format, there is one primary difference: x,y,z coordinates are returned by entget as a single value, rather than the separate values in DXF. Thus, you only see group code 10 with entget, instead of DXF group codes 10 (x-coordinate), 20 (y-coordinate), and 30 (z-coordinate).

See Also

entdel

entlast

entmake

entmod

entsel

entupd

nentsel

nentselp

Programming Overview of LISP

LISP Compatibility


(entlast)

"Get the last entity in the drawing."	LISP Function

This function retrieves the name of the last non-deleted entity in your database. This is useful if you want to use the last entity drawn.

Example

Code	Returns
(entlast)	<Entity name: bebb12f4>
Notes

The entity does not need to be currently on screen, unthawed, or unlocked to be selected. This behavior differs from the Last selection set option.

To find the first entity in the database, use the entnext function with no arguments.

See Also

entdel

entget

entmake

entmod

entsel

entupd

nentsel

nentselp

Programming Overview of LISP

LISP Compatibility


(entmake)
(entmake [entity-list])

"Add an entity to the drawing."	LISP Function

This function allows you to write the entity-list to the database. The entity-list must be in the dotted pair format, as shown by the entget function. Without a valid entity-list, entmake doesn't make the entity and returns nil.

Example

Code	Meaning:
(entmake
'((0 . "CIRCLE")	Entity = circle
(62 . 5)	Color = blue
(10 1.2 3.4 0.0)	Center point = 1.2,3.4
(40 . 5.6)	Radius = 5.6
)
)
Notes

This function is similar to entmod. The difference is that entmake allows you to write a new list that was not previously in the database; entmod creates a new entity by modifying an existing entity.

Entmake does not require that you provide all information about the entity. Not required are dotted pair data about the entity's properties when they do not differ from default values: color, linetype, thickness, attributes-follow flag, and the entity handle.

While the data specified by entmake is very similar to DXF format, there is one primary difference: x,y,z coordinates are specified by entmake as a single value, rather than the separate values in DXF. Thus, you specify group code 10 with entmake, instead of DXF group codes 10 (x-coordinate), 20 (y-coordinate), and 30 (z-coordinate).

See Also

entdel

entget

entlast

entmod

entsel

entupd

nentsel

nentselp

Programming Overview of LISP

LISP Compatibility


(entmod)
(entmod entity-list)

"Modify the entity in that drawing."	LISP Function

This function changes the entity defined by entity-list in the drawing database. You may have made changes to entity-list that you retrieved using entget, so the function entmod writes the changed list permanently into the database.

Example

Use the following LISP code example as a pattern to change any property of any entity:

Code	Meaning
(setq en (entnext))	Get the entity name of the first entity in the drawing.
(setq en1 (entget en))	Get the entity data from the entity name.
(setq en1 (subst (cons 62 5)
(assoc 62 en1)	Change the color to blue (color #5).
en1))
(entmod en1)	Modify the color of entity en1
Notes

Entmod checks that the following parameters are valid for every entity: layer name, linetype name, and color name or number.

Entmod automatically creates a layer if it does not already exist.

See Also

entdel

entget

entlast

entmake

entsel

entupd

nentsel

nentselp

setq

Programming Overview of LISP

LISP Compatibility


(entnext)
(entnext [entity-name])

"Get the next entity in the drawing."	LISP Function

This function returns the name of the first non-deleted entity in the database if no arguments are supplied. If an entity name is supplied, entnext returns the next entity following the given entity-name. When there is no next entity in the database, entnext returns nil.

Examples

Code	Returns
(setq a (entnext))	<Entity name: 1fe0540>
(setq b (entnext a))	Entity name following entity a
See Also

entdel

entget

entlast

entmake

entmod

entsel

entupd

nentsel

nentselp

setq

Programming Overview of LISP

LISP Compatibility


(entsel)
(entsel [prompt])

"Ask the user to select an entity."	LISP Function

The entsel function selects a single entity using a point-click, and then returns a list containing the entity name and the coordinates of the point used to select it. Any prior entity snap settings have no effect unless specifically requested during the function.

If a prompt is supplied, the user will be asked to select the entity with the wording of that prompt. If no prompt is supplied, the default prompt "Select Entity:" is displayed.

Examples

Code	Returns
(entsel) [pick an entity]	Select entity: (<Entity name: 1ff0548> (5.0 5.0 0.0))
(setq b (entsel “Select an line:“)) [pick a line]	Select an entity: (<Entity name: 1ff0564> (1.0 2.0 3.0))
Note: The function entsel works only with top-level entities. To select entities that belong to a block or a polyline, use nentsel.

See Also

entdel

entget

entlast

entmake

entmod

entupd

nentselp

setq

Programming Overview of LISP

LISP Compatibility


(entupd)
(entupd entity-name)

"Redraw the entity."	LISP Function

This function redraws the entity on the screen. After you modify a block attribute or polyline vertex, the block or polyline is not updated automatically because recalculating and displaying a multitude of changes might take a long time.

Instead, you force an update of complex entities on the screen after the computations are done using entupd. The entity-name of an entity within the block or polyline updates the whole entity group.

Example

Code	Meaning
(setq a (entnext))	Assigns the entity-name to a.
. . .	Change entity—see the endmod function.
(entupd a)	Regenerates entity group, which contains a.
Note: You can ensure that all entities on the screen are updated with the (command "regen") function.

See Also

entdel

entget

entlast

entmake

entsel

nentsel

nentselp

setq

Programming Overview of LISP

LISP Compatibility


(eq)
(eq statement1 statement2)

"Determine whether two expressions are bound to the same symbol."	LISP Function

This function determines whether two expressions are bound to the same symbol. If so, eq returns T; if not, eq returns nil.

Examples

Code	Comments
(setq s1 '(1 2 3))	Create symbol s1.
(setq s2 '(1 2 3))	Create symbol s2.
(setq s3 s2)	Bind s2 to s3.
(eq s1 s3)	nil because s1 and s3 are not the same list.
(eq s3 s2)	T because s3 and s2 are the same list.
Note: The eq function is not the same as the = (equal to operator) and equal functions. The = function returns T when two numbers or strings are equal. The equal function returns T when two expressions are equal. The eq function returns T when two expressions are bound to the same symbol.

See Also

boundp

setq

Programming Overview of LISP

LISP Compatibility


(equal)
(equal statement1 statement2 [tolerance])

"Determine whether two statements are the same."	LISP Function

This function compares statement1 and statement2. If they are equal, LISP returns a T; if not, a nil is returned. Whereas the equal function compares lists, the = (equal to operator) function compares numbers and strings.

Examples

Code	Returns
(setq x '(1 2 3 4))
(setq y x)
(equal x y)	T
(equal y '(1 2 3 4))	T
The tolerance is the amount that the two expressions are allowed to differ, which is very important when comparing real numbers (which tend to suffer from rounding error). In the following example, the two statements can differ by 0.01:

Code	Returns
(equal 5.6789 5.67 0.01)	T
Note: The equal function is not the same as the = (equal to operator) and eq functions. The = function returns T when two numbers or strings are equal. The equal function returns T when two expressions are equal. The eq function returns T when two expressions are bound to the same symbol.

See Also

setq

Programming Overview of LISP

LISP Compatibility


(*error*)
(*error* string)

"Display an error message."	LISP Function

This function allows you to define an error within your LISP routine. Errors can be caused by the programmer, or by user input. You need to be able to either test for these errors, or “trap” them when they occur.

Trapping Errors

Trapping an error refers to the process of looking at the error message and attempting to give the user feedback on why the error occurred, and what it means. The *error* function allows you to trap the errors that have occurred, and gives you an opportunity to handle them, and exit your program gracefully.

You may have only one *error* function in your program. However, because one function can be assigned to another with the setq function, you can have as many error handling functions in your program as you desire. Then to activate the error function you want, you set the *error* function to your error trap routine. Because there is only one active *error* function, you need to be kind to other programs or global settings. Before changing the *error* function, you should save the current error trap function in a temporary variable so that you may re-assign that function when you are done processing.

Defining the *error* Function

The definition of the *error* function is very specific. The function must be called *error* (or be set to *error* with a setq), and it must have one argument passing variable. You can name this variable whatever you like.

Examples

The following is an example of a simple error handling function:

(defun *error* (msg)

(princ (strcat "\nAn error has occurred in the program: " msg)

)

In the above example, when the error occurred, the error message is passed to the *error* function in the msg variable. The function then prints, “An error has occurred in the program:” followed by the error message.

Here is a more in-depth example of an error handling function in a real scenario. Notice that first we save the current *error* function in temperror before pointing it to our error handler routine. Then at the end of the myslope program, we return the *error* function to the previously saved function in temperror. It is important to notice that the last line of the myerror function also returns the *error* function to one we previously saved in temperror.

Code	Comments
(defun c:myslope ( )	Defining the program "myslope".
(setq temperror *error*)	Saving current error function to variable.
(setq *error* myerror)	Setting *error* to the error handling routine.
(setq p1 (getpoint "Select 1st point: "))	Setting p1 to the user specified point.
(setq p2 (getpoint p1 "Select 2nd point: "))	Setting p2 to the user specified point.
(setq slope (/ (-(cadr p2) (cadr p1))	Setting slope to the slope formula using p1 and p2.
(-(car p2) (car p1))))
(princ (strcat "Slope equals "	Printing what slope equals to two decimal places onto the screen.
(rtos slope 2 2)))
(setq *error* temperror)	Returning the error function to the variable.
)
The error handler:

Code	Comments
(defun myerror (msg)	Define the error handler "myerror".
(if (= msg "divide by zero")	If the passing variable msg is the same as "divide by zero",
(prompt "\n The line is vertical.")	then show this prompt,
(prompt (strcat "\n" msg)	else show this prompt
)
(setq *error* temperror)	Return the error function to the variable.
)
See Also

command

alert

exit

quit

setq

trace

untrace

Programming Overview of LISP

LISP Compatibility


(eval)
(eval statement)

"Evaluate the statement."	LISP Function

The eval function evaluates statement.

Examples

Code	Returns
(setq w 98)
(setq x 'w)
(setq y '(+ 5 6))
(setq z 'y)
(eval w)	98
(eval x)	98
(eval y)	11
(eval 'y)	(+ 5 6)
(eval z)	(+ 5 6)
See Also

apply

progn

setq

Programming Overview of LISP

LISP Compatibility


(exit)

"Terminate."	LISP Function

This function forces the current application to quit. IntelliCAD® displays the : prompt.

Example

Code	Returns
(exit)	error: quit/exit abort
See Also

alert

*error*

trace

untrace

quit

Programming Overview of LISP

LISP Compatibility


(exp)
(exp number)

"Calculate the natural exponent."

The exp returns the natural exponent (the inverse of the natural logarithmic function) raised to the power of the number (ex), where e = 2.71828. The result is a real number.

Examples

Code	Returns
(exp 0)	1.00000
(exp 2)	7.38906
(exp -3.2)	0.0407622
(exp pi)	23.1407
See Also

expt

log

log10

sqrt

Programming Overview of LISP

LISP Compatibility


(expand)
(expand integer)

"Expand the memory space."	LISP Function

This function expands the amount of node space (a form of memory used by LISP) by integer number of segments.

Example

Code	Returns
(expand 10)	10
See Also

mem

alloc

Programming Overview of LISP

LISP Compatibility


(expt)
(expt base power)

"Calculate the exponential."	LISP Function

This function returns the base raised to the power. When both the base and power are integers, the result is an integer. If either is a real number, the result is a real number.

Examples

Code	Returns
(expt 5 2)	25
(expt 2.2 6)	113.3800
See Also

exp

log

log10

Programming Overview of LISP

LISP Compatibility


(fill_image)
(fill_image x y width height color)

"Fill a dialog box's rectangle with color."	LISP Function

This function draws a rectangle (or square), and then fills it with a color. This function must be used between the start_image and end_image functions.

The x and y arguments specify the upper-left corner of the rectangle. The width and height arguments indicate the relative distance to the lower-right corner; these two arguments must be positive.

If you obtained the lower-right coordinates from the dimx_tile and dimy_tile functions, then the origin (0,0) is the upper-left corner.

The color argument is an IntelliCAD® color number or a logical color number:

Color number	Description
-2	Current background of the IntelliCAD graphics screen.
-15	Current dialog box background color.
-16	Current dialog box foreground color.
-18	Current dialog box line color.
Example

Code	Returns
(fill_image 0 0 20 27 -2)	nil
See Also

slide_image

vector_image

Programming Overview of LISP

LISP Compatibility


(findfile)
(findfile filename)

"Find that file."	LISP Function

This function searches your computer for the location of a file. This is important because if you specify the name of a file in your LISP program that doesn't exist, you crash the program. When the file exists, its path and filename are returned; if it doesn’t, the function returns nil.

Examples

Code	Returns
(findfile "sampledwg.dwg")	"c:\\icad\\sample\\sampledwg.dwg"
(findfile "junk.$$$")	nil
See Also

getfiled

load

open

startapp

xload

Programming Overview of LISP

LISP Compatibility


(fix)
(fix number)

"Convert that real number into an integer."	LISP Function

This function changes the number to an integer. Real numbers are changed to integers by truncating everything after the decimal point; no attempt is made to round off the number.

Examples

Code	Returns
(fix 3)	3
(fix pi)	3
(fix 7.999)	7
See Also

atof

atoi

float

itoa

Programming Overview of LISP

LISP Compatibility


(float)
(float number)

"Convert that integer into a real number."	LISP Function

This function changes the number to a real number. An integer is changed to a real number by adding a decimal point, followed by zeroes.

Examples

Code	Returns
(float 2)	2.00000
(float 8.65)	8.65000
Note: This function is the opposite of the fix function.

See Also

atof

atoi

itoa

Programming Overview of LISP

LISP Compatibility


(foreach)
(foreach variable list expression ...)

"Apply the expression to every item in the list."	LISP Function

This function performs an expression on each of the elements of the list. The first argument for foreach is variable. This is a temporary variable where the changed elements are stored. Next is the list argument, containing the elements to be affected. Following the list are one or more expressions, detailing the action to be performed on the list elements. The foreach function returns the result of the last evaluation.

Example

Code

(setq sample '(1.0 1.5 2.0 2.5))

(foreach var sample (progn

(setq var (* 2.0 var))

(princ (strcat "\nTwice the value is " (rtos var)))))

(princ)

Result

Twice the value is 2.0000

Twice the value is 3.0000

Twice the value is 4.0000

Twice the value is 5.0000

See Also

mapcar

Programming Overview of LISP

LISP Compatibility


(gc)

"Collect the garbage in memory."	LISP Function

This function frees up memory no longer being used (short for Garbage Collection). This function always returns nil.

Example

Code	Returns
(gc)	nil
Note: There is normally no need to use the gc function since LISP automatically performs garbage collection when it is getting low on node space.

See Also

alloc

expand

mem

Programming Overview of LISP

LISP Compatibility


(gcd)
(gcd integer1 integer2)

"Calculate the greatest common denominator."	LISP Function

This function returns the greatest common denominator between integer1 and integer2. Both numbers must be integers. Use the fix function to create integers out of real numbers.

Examples

Code	Returns
(gcd 39 45)	3
(gcd 40 45)	5
See Also

min

max

rem

Programming Overview of LISP

LISP Compatibility


(get_attr)
(get_attr key attribute)

"Determine the attribute of a dialog box's key."	LISP Function

This function returns the value of the dialog box attribute. Note that this value changes due to user input, as well as by calls made by the set_tile function. The key argument specifies the dialog box tile; key is a string and is case-sensitive.

Example

Code	Returns
(get_attr "pdsize_label" "Units")	"Units"
See Also

get_tile

LISP Compatibility


(get_tile)
(get_tile key)

"Determine the value of a dialog box's tile."	LISP Function

This function returns the value of the tile referenced by key; key is a string and is case-sensitive.

Example

Code	Returns
(get_tile "pdsize")	"pdsize"
See Also

get_attr

Programming Overview of LISP

LISP Compatibility


(getangle)
(getangle [point] [prompt])

"Ask the user to specify an angle."	LISP Function

This function prompts the user to enter an angle in the current angle units format, which is returned in radians. If a point (2D first point) is provided, getangle determines the angle between the current zero direction (as set in the ANGBASE variable) and the guide line; the angle increases in the counterclockwise direction.

When transforming the entered angle into radians, getangle ignores the ANGDIR variable and measures counterclockwise, with zero radians being the current setting of ANGBASE.

A prompt may be supplied to request a point or angle from the user.

The user cannot enter another LISP expression in reply to the getangle function.

Examples

Code	Returns
(getangle) [pick point]	Second point: 0.262427
(getangle "Rotation angle: ") [pick point]	Rotation angle: 0.25553
(getangle '(5.0 2.0)) [pick point]	no response 2.1588
(getangle '(1.0 3.5) "Rotation angle: ") [pick point]	Rotation angle: 1.33221
Note: The getangle function measures the angle from the 0-angle as defined by the Units command. To measure the angle from the absolute x-axis (0 = East), use the getorient function instead.

See Also

angle

getdist

getpoint

polar

Programming Overview of LISP

LISP Compatibility


(getcfg)
(getcfg parameter)

"Determine the value of the parameter."	LISP Function

This function returns data from the Visio/IntelliCAD/User section of the system registry. The parameter is a string with the following format:

"AppData/appname/sname/parameter" where:

Cfg Name	Means
AppData	The [AppData] section.
appname	The name of the application.
sname	The section name.
parameter	The parameter name.
Example

Code	Returns
(getcfg "appdata/appname/sname/parameter")	56
See Also

setcfg

getvar

getenv

Programming Overview of LISP

LISP Compatibility


(getcname)
(getcname [ _ ]command-name)

"Determine the localized command name."	LISP Function

This function returns the equivalent command name, depending on the presence of the underscore (_) prefix:

When prefixed by _, the localized command name is returned.

When not prefixed, the English command name is returned.

Examples

Code	Returns
(getcname "_zoom")	"zoom"
(getcname "zoom")	"zoom"
See Also

command

defun

menucmd

Programming Overview of LISP

LISP Compatibility


(getcorner)
(getcorner point [prompt])

"Ask the user to specify the second corner of a rectangle."	LISP Function

This function prompts the user to pick the second corner of a rectangle. The first corner argument (point) is required; the rectangle is drawn from that point as the user drags the cursor across the screen. Very often, this point is obtained from another function, such as getpoint.

The prompt is optional; it may be used to prompt the user for the corner point. Another LISP expression cannot be used in response to this prompt.

Examples

Code	Returns
(getcorner '(1.0 1.0)) [pick point]	no response 13.30 7.50 0.0
(getcorner '(2.0 1.5) "Select corner: ") [pick point]	Select corner: 7.50 8.19 0
NOTE The base point is based on the current UCS. Any z-coordinate entered is ignored, and the current elevation is used.

See Also

getangle

getdist

getpoint

Programming Overview of LISP

LISP Compatibility


(getdist)
(getdist [point] [prompt])

"Ask the user to specify two points."	LISP Function

This function prompts the user to enter a distance, or to pick one or two points to specify the distance. The distance returned is a real number, regardless of the current distance format specified by the Units command. You can specify a prompt string to be displayed, asking the user for input. Another LISP expression cannot be entered in response to getdist.

Examples

The examples in this section demonstrate the two ways to use the getdist function.

1.	Two-point method: leave out the point argument. The getpoint function prompts the user for two points. The prompt for the first point is specified by prompt; IntelliCAD® prompts, "Second point:" for the second pick point. A guide line stretches from the first point to the target to visually help in picking the second point.

Code	Returns
(getdist) [pick first point] [pick second point]	no prompt Second point: 7.2
(getdist "Length of street: ") [pick first point] [pick second point]	Length of street: Second point: 10.5
2.	One-point method: include the point argument. The getpoint function prompts the user for one point. The prompt for the second point is specified by prompt. A guide line stretches from the first point to the target to visually help in picking the second point.

Code	Returns
(getdist '(7.0 2.0)) [pick point]	no prompt 5.3
(getdist '(3.0 2.0) "Length of pipe: ")) [pick point]	Length of pipe: 2.8
Note: For more information, see the initget function.

See Also

getangle

getcorner

getpoint

Programming Overview of LISP

LISP Compatibility


(getenv)
(getenv variable)

"Determine the value of the operating system variable."	LISP Function

This function returns the value of a specified operating system environment variable—for example, as stored by the DOS PATH variable. If the variable exists, its value is returned as a string; if it does not exist, nil is returned.

Examples

Code	Returns
(getenv "PATH")	C:\\;C:\\WIN95;C:\\ICAD
(getenv "junk")	nil
See Also

setenv

getcfg

getvar

Programming Overview of LISP

LISP Compatibility


(getfiled)
(getfiled title filename ext flags)

"Display the Select File dialog box."	LISP Function

This function displays the operating system's file dialog box, which allows the user to select a file.

The title argument is the title of the file dialog box; this appears on the title bar. To create a blank titlebar, type “ “, but you cannot leave the argument blank.

The filename argument is the default filename that appears highlighted in the File name portion of the dialog box. For no filename, type “ “, but you cannot leave the argument blank.

The ext argument specifies the filetype, such as "dwg", "txt", or "lsp". When the argument is " " , no filetype is specified. To specify all filetypes, use "*" for the argument.

The flags argument is a bitcode that specifies options for getfiled.

Bit code	Meaning
1	Warn user about overwriting an existing file.
2	Disable "Type It" button.
4	The user can change the extension.
8	Use the IntelliCAD search path and only the name of the file, not the path spec.
You can sum the bits to specify more than one option. For example, bit code 5 is equal to the bits 1 and 4 added together, meaning the user will be warned about overwriting an existing file and is allowed to change the extension.

Examples

(getfiled "Drawing Files" " " "DWG" 2)

(getfiled "Lisp Files" "sample.lsp" "LSP" 6)

(getfiled "Hey! Pick a File:" "ICAD" "LSP" 4)

See Also

alert

findfile

load

open

Programming Overview of LISP

LISP Compatibility


(getint)
(getint [prompt])

"Ask the user to specify an integer."	LISP Function

This function asks the user to input an integer, and returns that integer. You can include a prompt argument to ask for the integer. The valid integer range is from -2,147,483,648 to +2,147,483,647.

Examples

Code	Returns
(getint)	7.0
(getint "Enter a number: ")	7.0
See Also

getreal

getstring

getkword

Programming Overview of LISP

LISP Compatibility


(getkword)
(getkword [prompt])

"Ask the user to type a word."	LISP Function

This function works along with initget to prompt for a response with restricted answers that you define ahead of time. For example, you may want the user to reply only "yes" or "no". Or, you may want to restrict the range of numbers that the user types to fall between 0 and 15.

Using this function is a two-step process: (1) first, use initget to set the valid response keywords; and (2) then, use getkword to prompt for input. IntelliCAD® displays a dialog box listing the valid responses set by initget, as well as the Cancel option.

If the input does not match the predetermined criteria, the function tells the user that the input is invalid with "Try again:" and cycles back to try again. If the input is null (the user pressed the Enter key), getkword returns nil unless a null input is not allowed.

If no keywords are preset with initget, nil is returned.

Example

Code	Returns
(initget 2 "Yes No") (getkword "Are you sure? ")	Displays dialog box.
See Also

getstring

Programming Overview of LISP

LISP Compatibility


(getorient)
(getorient [pt] [prompt])

"Ask the user to specify an angle."	LISP Function

This function is very much like getangle, except that the angle returned by getorient is independent of the variables ANGDIR and ANGBASE. The base is always at the zero-radian direction towards the right (or east). The angles increase in a counterclockwise direction. Angles returned by getortient are shown as radians.

This function is better used for absolute angles (orientation), rather than relative angles (rotation amount).

Another LISP expression may not be used as a response to a getorient request.

Examples

Code	Returns
(getorient) [pick first point] [pick second point]	no response Second point: 2.58172
(getorient '(3.5 2.0)) [pick point]	no response 0.430034
(getorient "Real Angle: ") [pick first point] [pick second point]	Real Angle: Second point: 0.3222
(getorient '(7.0 2.0) "Real Angle: ") [pick point]	Real Angle: 1.58751
See Also

angle

getangle

getdist

polar

Programming Overview of LISP

LISP Compatibility


(getpoint)
(getpoint [point] [prompt])

"Ask the user to specify a point."	LISP Function

This function waits for the user to input a point. You can use the point argument to specify a beginning point from which a guide line will be drawn, extending to the target. The user can either enter a coordinate or pick a point manually.

You can also include a prompt to prompt the user for the point.

Examples

Code	Returns
(getpoint) [pick point]	no response 11.40 7.05 0.0
(getpoint "Select a point: ") [pick point]	Select a point: 2.05 3.55
(getpoint '(5.0 5.0) "Next point: ") [pick point]	Next point: 6.70 7.30
See Also

inters

getint

getreal

Programming Overview of LISP

LISP Compatibility


(getreal)
(getreal [prompt])

"Ask the user to specify a real number."	LISP Function

This function waits for user input of a real number and returns that real number. You can supply a prompt argument asking the user to enter a number.

Examples

Code	Returns
(getreal) [type -5]	no response -5.0
(getreal "Scale factor: ") [type 5	Scale factor 5.0
See Also

getint

getstring

getpoint

Programming Overview of LISP

LISP Compatibility


(getstring)
(getstring [flag] [prompt])

"Ask the user to input some text."

Use this function to wait for user input of a string, and then to return it. Only the first 132 characters of a string are returned.

Set flag to a non-nil value to allow spaces in the string. If flag is non-nil (typically, T is used), the user must terminate the string using the Enter key. If flag is nil or absent, the input string is terminated at the first press of the spacebar or the Enter key.

Because the text entered in a string is taken literally, the user cannot enter another LISP expression as a response to getstring.

Examples

Code	Returns
(getstring “Enter street address: ")	"1244"
(getstring T "Enter street address: ")	"1244 E. Main"
NOTE If you want the user to enter one of several pre-defined words, use the getkword function instead.

See Also

getreal

Programming Overview of LISP

LISP Compatibility


(getvar)
(getvar sysvar)

"Determine the value of that system variable."	LISP Function

The getvar function retrieves and displays the current settings for IntelliCAD® system variables. Use the setvar function to change the value of a system variable.

Example

Code	Returns
(getvar "blipmode")	0
See Also

setvar

getenv

getcfg

Programming Overview of LISP

LISP Compatibility


(graphscr)

"Switch to the graphics window."	LISP Function

This function returns to the graphics window from the Prompt History window. This function has no effect if you are already in the graphics screen. It's a good idea to put this function at the beginning of your program to be sure the LISP program begins on the graphics screen.

Example

Code	Result
(graphscr)	Switches to the graphic window.
See Also

textscr

grclear

Programming Overview of LISP

LISP Compatibility


(grclear)

"Clear the viewport."	LISP Function

This function temporarily blanks out the graphic window of the current viewport. The redraw function brings the graphics back. The grclear function always returns nil.

Example

Code	Result
(grclear) (redraw)	Clears the graphics window. Returns the graphics.
See Also

grdraw

redraw

Programming Overview of LISP

LISP Compatibility


(grdraw)
(grdraw point1 point2 color [highlight])

"Draw a line."	LISP Function

This function draws a vector between two points in the current viewport. The first two arguments, pint1 and point2, represent 2-D or 3-D endpoints for the vector in terms of the current UCS. These are written as lists of real numbers. If the vector extends beyond the screen, IntelliCAD® automatically clips it.

The vector is drawn in the color specified, using the integer color argument. The integer -1 signifies the color XOR, which changes its color to complement whatever it draws over, or erases itself when overdrawn.

The highlight argument is optional. If provided, the vector will be drawn using the current highlighting method. If highlight is not provided or is set to zero, the normal display mode is used. The value must be an integer.

Examples

Code	Results
(grdraw '(0 0) '(4 8) -1)	Draws an XOR vector from 0,0 to 4,8
(grdraw '(3.5 3.0) '(10.2 7.8) 3 1)	Draws a highlighted vector in color 3 from 3.5, 3.0 to 10.2, 7.8
NOTE Use grvecs to draw multiple vectors.

See Also

grclear

Programming Overview of LISP

LISP Compatibility


(grread)
(grread [flag] [bits [cursor]])

"Read the data coming in from the input devices."	LISP Function

This function is another method to get user input. It reads successive input via input method. The flag option lets you obtain the user’s coordinates. When flag is non-nil, it follows the movements of the mouse or pointer and records the coordinates dynamically, which can generate a great amount of data.

The optional bits argument specifies the following:

Bits	Meaning
1	Returns the coordinates dynamically in the form of a list. The list consists of the value and the 3-D coordinate.
4	Turn this on if you are going to choose a cursor type.
8	Turns off the error message "console break" when you cancel out of the loop.
Add the bits above to obtain a combination if desired.

The cursor argument is an integer that corresponds to a cursor type:

Cursor	Meaning
0	Normal cursor-crosshairs.
1	No cursor.
2	Selection cursor-box.
The following chart describes how the information is returned. For example, if you entered the letter, l (keyboard input), the value 2 and the character code would be returned (2 108) in a list.

Type of Input	Returned Value (Definition)
Keyboard	2  (Character code)
Selected Point	3  (3-dimensional point)
Mouse (other pointer)	5  (3-dimensional point)
Example

(defun c:b ()

(while (print (grread 1 5 2)))

)

Explanation

In the above example, when you move the mouse, a list displays similar to (5 (2.3659 9.2846 0.0)), where the 5 represents the type of input (mouse) and where the coordinates are the exact coordinates of the mouse location. This changes dynamically as you move the mouse. When you select a point, a possible return would be (3 (2.3659 9.2846 0.0)), where 3 designates the type of input (selected point). When you entered a letter, let's say p, your return would be (2 112), where 2 denotes keyboard input, and 112 stands for the character code.

See Also

getpoint

getint

getreal

getstring

Programming Overview of LISP

LISP Compatibility


(grtext)
(grtext [flag text])

"Write text on the status line."	LISP Function

This function allows you to put text in the status line or the coordinate status area. The flag determines where the text is placed:

Flag	Meaning
-1	Status Line
-2	Coordinate Status Line

The text is a string. If the string is too long for the space provided, it is truncated.

If coordinate status is turned on (the Coords command is set to 1 or 2), the text previously entered into this field is overwritten with new coordinates as soon as the mouse is moved.

You can use the grtext function without any arguments to remove the text from the coordinate status line field when COORDS is turned off or from the status line field.

Examples

Code	Returns
(grtext -2 "This is mode -2")	This is mode -2 Places text in coordinate area.
(grtext)	nil Clears text from status line
See Also

grdraw

grvecs

Programming Overview of LISP

LISP Compatibility


(grvecs)
(grvecs vector-lists [trans])

"Draw one or more lines."	LISP Function

This function is like grdraw, except that it draws more than one vector at a time in the current viewport. These are temporary vectors that disappear with any command that refreshes the viewport.

The argument vector-lists represents lists for drawing vectors, complete with from and to points and color. The points must be passed as pairs, in two successive point lists:

'([color] from1 to1

  [color] from2 to2

  ...

 )

The color portion of the vector list must be within the range of 0–255. If the value is greater than 255, the color becomes XOR ink, which complements anything it draws over. If the color is less than 0, the vector becomes highlighted:

Color	Meaning
-1	Highlight ink.
0 - 255	Standard IntelliCAD colors.
256	XOR ink.
Examples

Code	Returns	Draws
(grvecs '( 2 (1.0 1.0) (3.0 6.0)))	nil	2 = Yellow vector.
(grvecs '( 1 (3.0 6.0) (6.5 10.5)	nil	1 = Red vector.
4 (0.0 0.0) (3.0 5.0)))		4 = Cyan vector.
See Also

grdraw

grclear

redraw

Programming Overview of LISP

LISP Compatibility


(handent)
(handent handle)

"Determine the entity name of that handle."	LISP Function

This function retrieves the entity name of an entity with a specific handle. Unlike the entity name, the handle name remains constant throughout the editing process.

Example

Assuming that the handle of the desired entity is “2D”, we could perform the following example:

Code	Returns
(handent "2D")	<Entity name: 1fe0568>
See Also

entget

tblsearch

Programming Overview of LISP

LISP Compatibility


(help)
(help [filename [topic [flag]]])

"Display the Help dialog box."	LISP Function

This function displays the IntelliCAD® help window. The optional arguments have the following effects:

filename is the name of the HLP (help) file, such as lcad.hlp and aliases.hlp. When this argument is missing, IntelliCAD loads the lcad.hlp file as the default.

topic is the name of a topic within the help file, such as a command name. When this argument is missing, IntelliCAD displays the first topic of the help file.

flag displays one of the following:

Flag	Meaning
help_contents	Display the initial topic in the HLP file.
help_helponhelp	Display help on using help.
help_partialkey	Display the Search dialog box using topic as the search text.
Example

Code	Result
(help "icadprog.hlp")	Displays the IntelliCAD Programmer's Reference (Help) window.
See Also

*error*

acad_colordlg

Programming Overview of LISP

LISP Compatibility


(if)
(if test statement1 [statement2])

"If it is true, do it; otherwise, do something else."	LISP Function

This function lets you test two conditions: if test is true, then perform statement1, else perform statement2. (Statement2 is optional.) If test is true, then LISP returns the value of statement1. If test is not true, then LISP returns the value of statement2.

Examples

Code	Returns
(setq d 9)
(if (>= d 10) "Greater")	nil
(if (>= d 8) "Greater")	"Greater"
(if (and (> d 12) (< d 13)) "In range" "Out of range")	"Out of range"
Note: The if function only allows a single statement for statement1 and statement2. If you want a multi-line statement, surround them by the progn function, as in the following example:

(if (> x 15)

(progn (

(setq window 20.0 door 32.0)

(command "color" 1)

) ; end progn

) ; end then

) ; end if

See Also

cond

repeat

while

setq

Programming Overview of LISP

LISP Compatibility


(initget)
(initget [bits] [string])

"Establish keywords."	LISP Function

This function helps you to restrict the user’s choices when responding to LISP expressions, such as the getkword function.

The options for initget are specified with the bits argument. Use the sum-the-bits technique for specifying more than one error-checking option: simply add bits together to combine options. For example, a flag of 36 is a sum of 32 + 4, which uses dashed lines with drawing the guide line and does not allow negative values.

The following table describes the possible meanings for the bits argument:

Bits	Meaning
1	Do not allow null input (user not allowed to press Enter).
2	Do not allow zero values.
4	Do not allow negative values.
8	Do not check drawing limits, regardless of  LIMCHECK setting.
16	reserved for future use
32	Use dashed lines when drawing rubber band lines and boxes.
64	For getdist only: do not allow input of a z-coordinate.
128	Ignore above settings, allow any input.
This function can be used with many LISP functions, but not all bits make sense. The functions and their possible bits are as follows:

Function	Bit
(getint)	1, 2, 4, 128
(getreal)	1, 2, 4, 128
(getdist)	1, 2, 4, 32, 64, 128
(getangle)	1, 2, 32, 128
(getorient)	1, 2, 32, 128
(getpoint)	1, 8, 32, 128
(getcorner)	1, 8, 32, 128
(getkword)	1, 128
(getstring)	none
(entsel)	none
(nentsel)	none
(nentselp)	none
Once the bit code is set, you use string to determine the values that the user is limited to entering in response to the prompt displayed by the following function. In essence, initget lets you are define keywords. The function always returns nil.

Examples

Code	Returns
(initget 1)	nil
(initget 6 "red blue green")	nil
See Also

Programming Overview of LISP

LISP Compatibility


(inters)
(inters point1 point2 point3 point4 [flag])

"Find the intersection."	LISP Function

This function returns the intersection of two lines. Point1 and point2 represent the endpoints of the first line; point3 and point4 represent the endpoints of the second line. When the two lines intersect, the point of intersection is returned. If they do not intersect, nil is returned.

Flag is optional: if flag is not nil (T is typically used), the inters function performs as explained above. When flag is nil, the lines defined by the four points are considered infinite. Inters returns the point at which they eventually cross (unless they are parallel lines, in which case nil is returned).

Examples

Code	Returns
(inters '(2 3) '(2 -4) '(4 1) '(0 1))	(2 1)
(inters '(2 3) '(2 -4) '(4 1) '(3 1))	nil
(inters '(2 3) '(2 -4) '(4 1) '(3 1) nil)	(2 1)
(inters '(2 3) '(2 -4) '(4 1) '(3 1) T)	nil
(inters '(1 1) '(3 1) '(1 0) '(3 0) nil)	nil
See Also

getpoint

osnap

Programming Overview of LISP

LISP Compatibility


(itoa)
(itoa integer)

"Convert that integer into ASCII."	LISP Function

This function converts the integer into a string. When integer is a real number, LISP complains, "Error: bad argument type."

Examples

Code	Returns
(itoa 3)	"3"
(itoa -66)	"-66"
See Also

atoi

ascii

Programming Overview of LISP

LISP Compatibility


(lambda)
(lambda arguments expression ...)

"Create a temporary, unnamed LISP function."	LISP Function

This function creates another function on-the-fly. It is used when setting all the overhead for a new function is unnecessary. The lambda function usually occurs in the middle of another function, and is often used with apply or mapcar to perform a function on a list.

Example

Code	Returns
(apply '(lambda (a b c)         (+ a (* b c)))        '( 5 2 3))	11
See Also

defun

command

progn

Programming Overview of LISP

LISP Compatibility


(last)
(last list)

"Determine the last item in that list."	LISP Function

This function returns the last element in a list. The element is not returned in a list, unless the last element is a list, as shown by the examples below.

Examples

Code	Returns
(setq b ' ( 1 2 3 4))	(1 2 3 4)
(last b)	4
(last '(first second (third fourth)))	("THIRD" "FOURTH")
NOTE This function should be used with caution. For example, you may want a function to retrieve the z-coordinate of a point. However, there are some cases in which the point contains only the x- and y-coordinates. Your function would accidentally get the y-coordinate. For this reason, it is sometimes a better idea to use a mixture of the car and cdr functions.

See Also

nth

length

reverse

setq

Programming Overview of LISP

LISP Compatibility


(length)
(length list)

"Determine how many items are in that list."	LISP Function

This function returns number of items in list. The number returned is an integer.

Example

Code	Returns
(setq b ' ( 1 2 3 4))	(1 2 3 4)
(length b)	4
See Also

car

cdr

nth

last

reverse

setq

Programming Overview of LISP

LISP Compatibility


(list)
(list expression …)

"Make it a list."	LISP Function

This function creates a list from the expressions specified. You may also create the list literally by using the ' (quote) function, as shown in the last example below. Rather than use elements already defined as a list, you may need to create your own list. This list will become a variable, with its values preceded by the command list.

Examples

Code	Returns
(setq b (list 1 2))	(1 2)
(setq c (list "string1" "string2"))	("string1" "string2")
(setq a (list (car b) (car c)))	(1 "string2")
(setq d '(1 2 "buckle my shoe"))	(1 2 "buckle my shoe")
See Also

cons

length

listp

setq

Programming Overview of LISP

LISP Compatibility


(listp)
(listp item)

"Determine whether an item is a list."	LISP Function

This function tests if item is a list. If the item following listp is a list, the function returns T. If not, nil is returned.

Examples

Code	Returns
(listp '("one" "two" "three"))	T
(listp "one")	nil
(listp 1.00)	nil
See Also

list

numberp

reverse

Programming Overview of LISP

LISP Compatibility


(load)
(load filename [flag])

"Load that LISP file."	LISP Function

LISP program files must be loaded into IntelliCAD® before they can be run. The load function must be enclosed in parentheses, or IntelliCAD will try to load a text or shape file.

The filename argument represents the name of the LSP file to load. You need not enter the file type .lsp, since this is assumed. The filename can also include the directory path. If one is not included, IntelliCAD searches the environmental paths specified in the configuration.

If the LSP file is found and loaded, the last expression in the program is returned to the command line. If the file is not found, the program displays an error message indicating that the load failed.

You may want to have the program display some other specified string, represented by the optional flag argument.

Examples

The following examples assume that invalid.lsp does not exist and valid.lsp does. The last expression in valid.lsp is LST-FUNCT.

Code	Returns
(load "valid")	LST-FUNCT
(load "\\sample\\valid")	LST-FUNCT
(load "invalid")	Load failed error
(load "invalid" "Does not exist.")	"Does not exist."
See Also

atoms-family

load_dialog

xload

command

menucmd

Programming Overview of LISP

LISP Compatibility


(load_dialog)
(load_dialog filename)

"Load that dialog box definition file."	LISP Function

This function loads a DCL dialog control file. DCL files must be loaded before a custom dialog box can be displayed by IntelliCAD®. The filename argument is the name of the DCL file.

This function returns the following codes:

Return Code	Meaning
1	DCL was successfully loaded.
-1	DCL file was not found.
Examples

Code	Returns
(load_dialog "basicdcl")	1
(load_dialog "junkdcl")	-1
Note: The order of calling a dialog box is as follows:

1.	load_dialog

2.	new_dialog

3.	action_tile, start_image, start_list, etc (perform all dialog box initialization, such as associating an action with a tiles, creating an image, and making the lists for list boxes)

4.	start_dialog

See Also

unload_dialog

Programming Overview of LISP

LISP Compatibility


(log)
(log number)

"Calculate the natural logarithm."	LISP Function

This function returns the natural logarithm, even though "ln" is usually considered the natural log in mathematics. This function cannot take a negative number. The result is a real number.

Examples

Code	Returns
(log 0)	1.000000
(log 9)	2.19722
(log 10)	2.30239
(log 2.30239)	0.834035
Note: The exp function is the opposite of the log function.

See Also

log10

expt

Programming Overview of LISP

LISP Compatibility


(log10)
(log10 number)

"Calculate the common logarithm."	LISP Function

This function returns the common logarithm with base 10 (log10 x). This function cannot take a negative number. The result is a real number.

Examples

Code	Returns
(log10 100)	2.0
(log10 50.65)	1.70458
Note: The expt function is the opposite of the log10 function.

See Also

log

exp

Programming Overview of LISP

LISP Compatibility


(logand)
(logand integer1 integer2 …)

"Determine what is the logical AND."

This is a logic function using the Boolean AND. The result is generated via manipulating bits. If a bit is "on," it is denoted by a 1; if it is "off," it shows a 0. When the first bit AND the second bit (in the column) are on, then that bit is on. If the first bit is off AND the second is off, then that bit is off. The AND function requires that all bits in a column be on.

Examples

Code	Returns
(logand 5 7 37)	5
(logand 13 2)	0
(logand 27 31 43)	11
See Also

boole

logior

lsh

and

or

~

Programming Overview of LISP

LISP Compatibility


(logior)
(logior integer1 integer2 …)

"Determine what is the logical OR."	LISP Function

This is a logic function using the Boolean OR. The result is generated via bits, similar to the logand function. If a bit is "on," it is denoted by a 1; if it is "off," a 0 is displayed. If the first bit OR the second bit (in the column) are on, then that bit is on. The OR function requires that at least one bit in a column be on.

Examples

Code	Returns
(logior 5 7 37)	39
(logior 17 5)	21
See Also

boole

lsh

and

or

~

Programming Overview of LISP

LISP Compatibility


(lpad)
(lpad string integer)

"Pad that string with spaces on the left."	LISP Function

This function controls the length and spacing of the string when it is printed. The integer argument represents the number of characters or spaces the string should have.

When the number is less than the total number of characters in the string, the string is truncated to allow only the specified number of characters. When the number is greater than the number of characters in the string, additional spaces are added to the beginning (or left side) of the string.

NOTE Use rpad to perform the same operations on the end (or right side) of the string.

Examples

Code	Returns
(lpad "Planet X" 4)	"Plan"
(lpad "Planet X" 15)	"               Planet X"
(setq a "Planet X")
(lpad a 6)	"Planet"
See Also

rpad

setq

Programming Overview of LISP

LISP Compatibility


(lsh)
(lsh integer1 integer2)

"Do a bitwise shift."	LISP Function

This function performs a logical shift of bits. Integer1 denotes the number, while integer2 denotes the number of bits to shift integer1. When integer2 is positive, it shifts to the left; negative shifts to the right.

lsh works with integers only. The 1 signifies the bit is on; the 0 signifies it is off.

Examples

Code	Returns
(lsh 12 1)	24
(lsh 8 -1)	4
(lsh 24 3)	192
See Also

logand

logior

and

or

~

boole

Programming Overview of LISP

LISP Compatibility


(mapcar)
(mapcar function list1 [list2 ...])

"Apply the function to the list."	LISP Function

This function is one of the most powerful tools for handling large lists. Mapcar performs a function on each of the elements of a list, and then returns a second list. There can be multiple lists, but each list must have the correct number of items for the function to affect all the lists at one time.

Example

Code	Returns
(mapcar '* '(5 3 2) '(2 2 2))	(10 6 4)
See Also

apply

defun

eval

Programming Overview of LISP

LISP Compatibility


(max)
(max number1 number2 …)

"Determine which is the biggest number."	LISP Function

The max function chooses the greatest number (real number or integers) from the list. If all the numbers are real, the result is real. If all the numbers are integers, the result is an integer. The combination of real numbers and integers results in a real number.

Examples

Code	Returns
(max 22 56)	56
(max -9 -60)	9
(max 25 19.9)	25.0000
(max 2)	2
(max)	0
See Also

min

fix

gcd

Programming Overview of LISP

LISP Compatibility


(mem)

"Display the status of the LISP memory."	LISP Function

This function reports on the status of the memory being used by LISP. The parameters reported by mem have the following meanings:

mem	Meaning
Nodes	Total number of nodes allocated to LISP.
Free nodes	Number of nodes freed by garbage collection.
Segments	Number of segments allocated.
Allocate	Size of the segment.
Collections	Number of garbage collections.
Example

Code	Returns
(mem)	Nodes: 33934 Free nodes: 1744 Segments: 40 Allocate: 514 Collections: 24
Note: A node is 12 bytes.

The default size of a segment is 514 nodes. Use the alloc function to change the size of the segment. Use the expand function to change the number of segments.

See Also

gc

Programming Overview of LISP

LISP Compatibility


(member)
(member item list)

"Identify the first occurrence of an item in the list."	LISP Function

This function identifies the first occurrence of an item in a list. A list is returned, beginning with the first occurrence of the item and containing any items following it. This is useful if you need to make a change to a particular item in the list, but you aren’t sure exactly where the item is.

Examples

Code	Returns
(setq a '(1 2 3 4 3 2 1))	(1 2 3 4 3 2 1)
(member 3 a)	(3 4 3 2 1)
(- (length a) (length (member 3 a)))	2
See Also

length

list

setq

Programming Overview of LISP

LISP Compatibility


(menucmd)
(menucmd string)

"Execute that menu command."	LISP Function

This function executes a command in the menu bar (cursor menu and pull-down menus). The string parameter uses the following formats:

"menu=value"

"menu=*"

The menu parameter has two parts—for example (menucmd "P1.2=*). In this case, the "P1" refers to the first pull-down menu (usually the File menu). the ".2" refers to the first item on the menu (usually the Open item). The first values of menu permitted in IntelliCAD® are:

Menu	Meaning
P0	Cursor menu
P1 - P16	Pull-down menus 1–16
The value parameter has the following meanings:

Value	Meaning
?	What is status of the menu item?
*	Display the menu.
~	Disable the menu item (grayed out).
!.	Prefix menu item with a check mark.
	(blank) Remove properties.
name	Load the menu name.
Examples

Code	Meaning
(menucmd "P3=*")	Display menu #3 (the View menu).
(menucmd "P3.1=~")	Disable menu #3, item #1 (the View | Redraw menu item).
(menucmd "P3.1=")	Re enable the View | Redraw item.
See Also

command

menugroup

Programming Overview of LISP

LISP Compatibility


(menugroup)
(menugroup name)

"Determine whether a menu group is loaded."	LISP Function

This function checks to see if a menu group is loaded. The name argument specifies the name of the menu group. When name matches the name of a loaded menu group, the menugroup function returns the group's name; otherwise, it returns nil.

Examples

Code	Returns
(menugroup "view")	"view"
(menugroup "junk")	nil
See Also

ads

atoms-family

menucmd

command

Programming Overview of LISP

LISP Compatibility


(min)
(min number1 number2 …)

"Determine which is the smallest number."	LISP Function

This function chooses the smallest or minimum number. When all the numbers are integers, then the result is also an integer. Any other combination results in a real number.

Examples

Code	Returns
(min 85 63)	63
(min 34.0 18)	18.0000
(min -6.9 -7)	-7.00000
(min 3)	3
(min)	0
See Also

max

fix

rem

Programming Overview of LISP

LISP Compatibility


(minusp)
(minusp number)

"Determine whether a value is a negative number."	LISP Function

This function determines negative numbers. If number is an integer or a real number and it has a negative value, the minusp function returns a T. Otherwise it returns a nil.

Examples

Code	Returns
(minusp -2.4)	T
(minusp 8.5)	nil
(minusp -26)	T
See Also

numberp

listp

Programming Overview of LISP

LISP Compatibility


(mode_tile)
(mode_tile key mode)

"Set the mode of the dialog box's tile."	LISP Function

This function sets the mode of the tile identified by key. The mode argument takes one of the following integers:

Mode	Meaning
0	Enable tile.
1	Disable tile.
2	Set the focus to the tile.
3	Select the contents of an edit box.
4	Change image highlighting between on and off.
Example

(mode_tile pt1 2)

See Also

get_attr

get_tile

Programming Overview of LISP

LISP Compatibility


(nentsel)
(nentsel [prompt])

"Ask the user to select an entity."	LISP Function

This function works just like entsel, except nentsel lets you to pick an entity and return its name, even when the entity belongs to a block or a polyline. The prompt argument is an optional prompt you can present to the user.

Example

Code	Returns
(setq n (nentsel "Select a polyline: ")) [pick entity]	Select a polyline: (<Entity name: 890158>       (5.0 5.0 0.0))
See Also

nentselp

initget

setq

Programming Overview of LISP

LISP Compatibility


(nentselp)
(nentselp [prompt] [point])

"Return a point, without necessarily asking the user."	LISP Function

This function works just like nentsel, except nentselp does not need the user to pick a point. The prompt argument is an optional prompt you can present to the user. When you include the point argument, you do not need to prompt the user for a point.

Example

Code	Returns
(setq abc '(1 2 3))
(setq n (nentselp abc))	(<Entity name: 890158>          (5.0 5.0 0.0))
See Also

entsel

initget

setq

Programming Overview of LISP

LISP Compatibility


(new_dialog)
(new_dialog dialog dcl-id [function point])

"Display a dialog box."	LISP Function

This is the function you use to display a dialog box. The dialog box is identified by dialog within the DCL file named dcl-id. The string dialog is obtained from the load_dialog function.

The new_dialog function optionally executes the LISP routine named function. To ignore this argument, use " "; you have to use the " " when you want to specify the point coordinates but not execute a function.

The optional point argument specifies the x,y coordinates of the upper-left corner. When point consists of negative coordinates, such as  '(-1 -1), the dialog box appears at the default location, which is usually the center of the IntelliCAD® window.

When the new_dialog function is successful, it returns T; otherwise, it returns nil.

Examples

Code	Returns
(new_dialog "basicdcl" "sampler" "insert" '(1 2))	T
(new_dialog "basicdcl" "sampler" " " '(-1 -1))	T
Note: The order of calling a dialog box is as follows:

1.	load_dialog

2.	new_dialog

3.	action_tile, start_image, start_list, etc (perform all dialog box initialization, such as associating an action with a tiles, creating an image, and making the lists for list boxes)

4.	start_dialog

See Also

unload_dialog

Programming Overview of LISP

LISP Compatibility


(not)
(not item)

"Determine whether an item is nil."	LISP Function

This function determines whether item is nil. If it is nil, a T is returned. If it is not nil, nil is returned.

Examples

Code	Returns
(not "Yes!")	nil
(not (> 5 6))	T
Note: The not and the null functions are very similar. The difference is that null checks whether the item is bound to nil. Null is meant for testing for empty lists.

See Also

numberp

type

Programming Overview of LISP

LISP Compatibility


(nth)
(nth integer list)

"Determine the nth item in the list."	LISP Function

Like car and cdr, the function nth is used to separate an element from a list. This function is much easier to use in long lists to isolate a single element.

The argument integer represents the number of the item to isolate. Remember that the first item in the list is numbered 0, so that when you want the third item you use 2. When integer is larger than the number of items (actually, number - 1 items) in the list, the nth function returns nil.

Examples

Code	Returns
(setq b '(1 2 3 4 5 4 3 2 1))	(1 2 3 4 5 4 3 2 1)
(nth 4 b)	5
(setq c '(one two three four))	(ONE TWO THREE FOUR)
(nth 2 c)	THREE
(nth 5 c)	nil
See Also

last

length

reverse

setq

Programming Overview of LISP

LISP Compatibility


(null)
(null item)

"Determine whether the item is bound to nil."	LISP Function

The null function confirms that your item is bound to nil. If it is nil, a T is returned. If it is not nil, nil is returned.

Examples

Code	Returns
(null "Yes!")	nil
(null (> 5 6))	T
Notes

The null function is the opposite of the boundp function.

The not and the null functions are very similar. The difference is that not checks whether the item is  nil. Null is meant for testing for empty lists.

See Also

numberp

type

Programming Overview of LISP

LISP Compatibility


(numberp)
(numberp item)

"Determine whether an item is a number."	LISP Function

This function tests item to see if it is a number—either a real number or an integer. If item is a number, a T is returned. If not, nil is returned.

Examples

Code	Returns
(numberp 8)	T
(numberp 0.2653)	T
(numberp '(5 3.2 6))	nil
(numberp "Name")	nil
See Also

not

type

Programming Overview of LISP

LISP Compatibility


(open)
(open filename mode)

"Open that file."	LISP Function

This function makes a file's filename accessible for input and output functions. The filename argument represents the path and filename of the file to open.

The open function returns a file descriptor (an 8-digit hexadecimal number) for the opened file, which should be stored as a variable using the setq function. Once you have the file descriptor, you must refer to the file using the file descriptor—not the filename!

The mode argument has three options, which must be in lowercase:

Mode	Meaning
"r"	Open the file as read-only; returns nil if the file does not exist.
"w"	Open the file for writing; overwrites existing data; creates a new file if non-existent.
"a"	Open the file for writing; append to existing data; creates a new file if non-existent.
Examples

Code	Returns
(setq n (open "existing.txt" "w"))	<File: #2190dec2>
(setq n (open "noexist.lsp" "r"))	nil
(setq n (open "\\sample\\exiting.txt" "a")	<File: #2190c2c3>
Notes

In append mode, new data is added to the end of the existing file.

LISP only reads ASCII files (no binary files) using sequential access (no random access).

To separate subdirectory names, you use either two backslashes ( \\ ) or a single forward slash ( / ).

See Also

close

write-line

read-line

Programming Overview of LISP

LISP Compatibility


(or)
(or statement ...)

"Calculate the logical OR."	LISP Function

This function performs a logical OR to the statements that precede it. If at least one of the statements is true, LISP returns a T. If all are false, LISP returns nil.

Examples

Code	Returns
(setq x nil)
(setq y 8)
(or x y 15.1)	T
(or nil x)	nil
See Also

and

equal

logior

setq

Programming Overview of LISP

LISP Compatibility


(osnap)
(osnap point mode)

"Determine the 3-D coordinates of an entity snap."	LISP Function

This function uses the IntelliCAD® entity snap modes to find a point. You specify which entity snap mode to use with the mode argument. You can assign multiple modes simultaneously.

Mode	Meaning
"nea"	NEArest
"end"	ENDpoint
"mid"	MIDpoint
"cen"	CENter
"per"	PERpendicular
"tan"	TANgent
"qua"	QUAdrant
"ins"	INSertion
"po"	POint
"int"	INTersection (3D intersection)
"pla"	PLAnview (2D intersection)
"vis"	VISible (apparent intersection)
"off"	Off
Using the point argument, you specify a point near the entity where the snap attaches to. If no point is found that specifies the mode requirements, the function returns nil.

Examples

Code	Returns
(osnap '(1 5) "center")	(5.0 5.0 0.0)
(osnap p1 "midp,endp,center")	(2.5 3.0 0.0)
NOTE The distance allowable between the starting point and the entity is determined by the system variable APERTURE, which ranges from 1 to 50 pixels.

See Also

inters

getpoint

Programming Overview of LISP

LISP Compatibility


pi

"Pi is 3.14159265..."	LISP Function

Pi is not a function, but rather a constant value commonly used in programming IntelliCAD® with LISP. The value of pi is approximately equal to 3.14159265.

Examples

Code	Returns
!pi	3.14159
Warning: It is possible to lose the value of pi. For example, the following code causes pi to take on the value of 2.0:

Code	Returns
(setq pi 2.0)	2.0
!pi	2.0
See Also

atan

cos

sin

tan

Programming Overview of LISP

LISP Compatibility


(polar)
(polar point angle distance)

"Find a point using polar coordinates."	LISP Function

This function returns a 3-D point at an angle and distance from another point. The given point is rotated by the angle specified in radians, then moved the specified distance from the point.

Examples

Code	Returns
(polar '(1 2) 1.570796 2)	(2 3)
(polar '(3.13397 1) 0.523598775 1	(4 1.5)
NOTE The angle is measured in radians relative to the x-axis with radians increasing counterclockwise.

See Also

angle

distance

pi

Programming Overview of LISP

LISP Compatibility


(prin1)
(prin1 [expression [file-descriptor]])

"Print it exactly the way it looks."	LISP Function

This function prints data to the screen or to a file. When a file-descriptor is provided, LISP prints to a file; when the file-descriptor is missing, LISP prints to the IntelliCAD® Prompt History window.

When you are printing to a file, the file must previously have been opened with the open function in write "w" or append "a" mode.

The argument expression represents the expression to be printed. It can be any expression, not just a string. Only the expression is printed, no new line or space is included.

The prin1 function can be used with no arguments to return a null string, in which case an empty file is printed.

Examples

Code	Prints	Returns
(setq  v1 222)
(prin1  v1)	222	222
(prin1 'v1)	V1	V1
(prin1 "Thank You")	"Thank you"	"Thank you"
(prin1 "Sample" f)	"Sample"(to file f)	"Sample"
(prin1 "\nName:")	"\nName:"	"\nName:"
Notes

Use the prin1 function at the end of a LISP routine to suppress the display of nil when the routine finishes running:

(prin1)

The difference between the prin1 function and LISP's other print-related functions (for example, princ and print) is that prin1 treats control characters literally.

IntelliCAD does not support Unicode.

See Also

prompt

setq

terpri

write-line

Programming Overview of LISP

LISP Compatibility


(princ)
(princ [expression [file-descriptor]])

"Print, taking into account control characters."	LISP Function

This function prints to a file or to the screen. When a file-descriptor is provided, LISP prints to a file; when the file-descriptor is missing, LISP prints to the Prompt History window.

When you are printing to a file, the file must previously have been opened with the open function in write "w" or append "a" mode.

The argument expression represents the expression to be printed. It can be any expression, not just a string. The expression is printed, as well as a new line.

Unlike print and prin1, the princ function activates any control characters present within the expression. You can use the following control characters within the expression:

Control Character	Meaning
\\	\ backslash character
\"	" quote character
\e	Escape
\n	Newline
\r	Return
\t	Tab
\nnn	Octal code nnn
Examples

Code	Prints	Returns
(princ "\nName:")	(new line) Name:	"\n Name:"
(setq a "Address: ")
(princ a)	Address:	"Address: "
(princ 'a)	A	A
(princ "Telephone: " f)	Telephone: (to file f)	"Telephone: "
Note: The difference between the princ function and LISP's other print-related functions (for example, print and prin1) is that princ acts upon control characters.

See Also

prompt

setq

terpri

write-line

Programming Overview of LISP

LISP Compatibility


(print)
(print [expression [file-descriptor]])

"Print, using formatted printing."	LISP Function

This function prints the same way as prin1, with the exception of adding an new-line character before expression and a space after it. Like prin1, the print function treats control characters literally (does not activate them).

Examples

Code	Prints	Returns
(print "First pt: ")	New line. "First pt:Space."	"First pt:"
(print "\nCompany\005: ")	New line.	"\nCompany\005: "
	"\nCompany\005:Space."
Note: The difference between the print function and LISP's other print-related functions (for example, prin1 and princ is that print automatically includes a new-line character before expression and adds a space after expression).

See Also

prompt

terpri

write-line

Programming Overview of LISP

LISP Compatibility


(progn)
(progn statement1 statement2 ...)

"Evaluate the statement."	LISP Function

This function evaluates all the statements and returns the value of the last statement.

Generally, the progn function works in conjunction with the if function, since the if function is limited to a single if and then statement. Each if function can have only one then statement and an else statement. The progn allows you to have multiple statements evaluated. The value of the last statement is returned.

Example

Code	Returns
(setq a 9) (if (>= a 8)     (progn (setq b a)            (setq (1+ b)     ) )	10
See Also

apply

defun

setq

Programming Overview of LISP

LISP Compatibility


(prompt)
(prompt string)

"Print the message on the command line."	LISP Function

This function prints the string to the command line and the Prompt History window. The prompt function acts upon control characters.

Examples

Code	Returns
(prompt "56")	56nil
(prompt "This is text.\n")	This is text. nil
Note: The difference between the prompt function and LISP's other print-related functions (for example, princ, print, and prin1) is that prompt only prints to the Prompt History window and not to a file.

See Also

terpri

write-line

Programming Overview of LISP

LISP Compatibility


(quit)

"Quit the current LISP routine."	LISP Function

This function forces the current LISP routine to quit. An error message is returned.

Example

Code	Returns
(quit)	error: quit / exit abort
See Also

exit

*error*

Programming Overview of LISP

LISP Compatibility


(quote)
(quote statement)

"Create a list."	LISP Function

When you want LISP to treat the statement literally, you use the quote function. Quote prevents LISP from evaluating the statement. The single quote symbol (‘) is used as a shortcut for the quote function; the two are interchangeable.

Examples

Code	Returns
(quote a)	A
(setq x '(1 2 3 4))	(1 2 3 4)
(setq x (quote (1 2 3 4)))	(1 2 3 4)
See Also

type

lambda

list

setq

Programming Overview of LISP

LISP Compatibility


(read)
(read string)

"Determine the first item in a string."	LISP Function

This function returns the first list item or atom in the string. Spaces may not be used within the string argument unless they are within a list or string.

Examples

Code	Returns	Type
(read "one" )	ONE	Atom.
(read "one two" )	ONE	Atom.
(read " (1 2 3) (1) " )	(1 2 3)	List.
(read " (one two) " )	(ONE TWO)	List.
(read "12")	12	Integer.
(read "\"First Name:\"")	"First Name:"	String.
See Also

read-char

write-char

print

car

cdr

last

Programming Overview of LISP

LISP Compatibility


(read-char)
(read-char [file-descriptor])

"Read a single character."	LISP Function

This function reads a single character from the file or keyboard. When a file-descriptor is included (as assigned by the open function), read-char reads from a file. When file-descriptor is missing, read-char reads from the keyboard. ]

The read-char function doesn’t actually return the letter, rather it returns the ASCII code of that letter. To actually see the letter, you must convert the ASCII code using the chr function.

Examples

For the following example, assume the file sample.lsp exists, and the first line is “C:\Sample\First.txt”.

Code	Returns
(setq file (open "sample.lsp" "r"))
(setq c (read-char file))	67
(setq a (chr c))	"C"
(read-char) [press A]	Waits for you to press a key. 65
See Also

write-char

read-line

setq

Programming Overview of LISP

LISP Compatibility


(read-line)
(read-line [file-descriptor])

"Read a whole line."	LISP Function

The read-line function is similar to the read-char function, but is generally much more practical and efficient to use. Anything can be read from a file, since the format is a string. The file is specified by the file-desc, assigned by the open function.

Example

For the following example, assume the file sample.lsp exists, the first line is “C:\Sample\First.txt”, and the second line is “Second Line”.

Code	Returns
(setq file (open "sample.lsp" "r"))
(setq c (read-line file))	"C:\\Sample\\First.txt"
(setq d (read-line file))	"Second Line"
Notes

The read-line function automatically moves to the next line in the file; it returns the next line from the file.

When read-line reaches the end of the file, it returns nil.

See Also

write-line

setq

Programming Overview of LISP

LISP Compatibility


(redraw)
(redraw [ename [mode]])

"Redraw the viewport or just a single entity."	LISP Function

This function redraws (or refreshes) the entire graphic display screen, or a single entity. Any temporary graphics present (such as those drawn with the grdraw function) disappear with this function.

If an ename (short for entity name) argument is entered, that entity is displayed differently, depending on the value specified in the mode argument:

Mode	Meaning
1	Perform a standard redraw.
2	Blank the entity from the screen (a reverse redraw).
3	Highlight redraw (system variable HIGHLIGHT).
4	Do not highlight.
When these values are entered as negative numbers, the function affects only the main part of a complex element (for example, a block or polyline). The sub-elements are not affected. This function always returns nil.

Examples

Code	Result
(redraw)	Redraws entire screen.
(redraw en1)	Redraws selected entity.
(redraw en1 2)	Blanks out the selected entity.
See Also

grclear

graphscr

Programming Overview of LISP

LISP Compatibility


(regapp)
(regapp appname)

"Register the application."	LISP Function

This function adds the application name to the drawing's list of registered applications. You can register as many applications as you like in each drawing. This application name is registered in the APPID symbol table and is used for grouping together extended entity data assigned to entities. This allows individual applications to recognize their own extended entity data.

The application name itself can be up to 31 characters long, and can contain letters, digits, and special characters. It cannot contain spaces. If the application name already exists, nil is returned.

Examples

Code	Returns
(regapp "AM/FM.DESIGNER")	"AM/FM.DESIGNER"
(regapp "INTELLICAD-DEPT.52")	"INTELLICAD-DEPT.52")
See Also

ads

xload

setfunhelp

Programming Overview of LISP

LISP Compatibility


(rem)
(rem number1 number2 [number3 ...])

"Determine the remainder of this division operation."	LISP Function

This function returns the remainder when number1 is divided by number2. You can use integers or real numbers. When there are more than two numbers, this function first finds the remainder of number1 divided by number2. Use that remainder and divide by number3 and continue the process.

Examples

Code	Returns
(rem 40 13)	1
(rem 8 8)	0
(rem 25 7.0)	4.0
(rem 2 -8 9.0)	2.0
(rem 2 -8)	2
(rem 2 9.0)	2.0
(rem -36 13.0 6)	-4.0
(rem -36 13.0)	-10.0
(rem -10.0 6)	-4.0
(rem 0 0)	error: divide by zero
See Also

/ (Division operator)

fix

Programming Overview of LISP

LISP Compatibility


(repeat)
(repeat number statement1 [statement2 ...])

"Repeat it."	LISP Function

This function repeats the statements by number of times, where number is a positive integer.

Example

Code	Returns
(setq x 2)
(setq y 12)
(repeat 3	1500
(setq x (* x 5)	x is now set to 250.
(setq y (* y 5)	y is now set to 1500.
)
See Also

cond

if

setq

while

Programming Overview of LISP

LISP Compatibility


(reverse)
(reverse list)

"Reverse that list."	LISP Function

This function reverses the order of the items in a list.

Examples

Code	Returns
(setq v '(first second third))	(FIRST SECOND THIRD)
(reverse v)	(THIRD SECOND FIRST)
(reverse '(1 2 3 4 5))	(5 4 3 2 1)
See Also

acad_strlsort

length

listp

last

setq

Programming Overview of LISP

LISP Compatibility


(rpad)
(rpad string integer)

"Pad that string with spaces on the right."	LISP Function

This function controls the length and spacing of a string when it is printed. The integer argument represents the number of characters or spaces the string should have. When the number is less than the total number of characters in the string, the string is truncated to allow only the specified number of characters. When the number is greater than the number of characters in the string, additional spaces are added to the end (or right side) of the string.

NOTE Use lpad to handle the same operations on the beginning (or left side) of the string.

Examples

Code	Returns
(rpad "Einstein" 4)	"Eins"
(rpad "Einstein" 15)	"Einstein       "
(setq a "Einstein")
(rpad a 6)	"Einste"
See Also

lpad

setq

trim

Programming Overview of LISP

LISP Compatibility


(rtos)
(rtos number [mode [precision]])

"Convert that real number to a string."	LISP Function

This function converts a real number to a string. The argument number is the real number you want to convert.

Mode and precision arguments are optional arguments. The mode (1 through 5) selects the format of the string:

Mode	Meaning
1	Scientific
2	Decimal
3	Engineering
4	Architectural
5	Fractional
The precision argument allows you to select the number of places after the decimal point. The range is 0 to 8.

Examples

Code	Returns	Format
(rtos 15.35 1 4)	"1.5350E+001"	Scientific.
(rtos 15.35 2 4)	"15.3500"	Decimal.
(rtos 15.35 3 4)	"1’-3.3500"	Engineering.
(rtos 15.35 4 4)	"1’-3 1/4"	Architectural.
(rtos 15.35 5 4)	"15 3/8"	Fractional.
Note: When you leave them out, the mode and precision arguments read the settings of system variables LUNITS (default = decimal units) and LUPREC (default = 4 decimal places). Thus, to automatically use the current system settings, simply leave out mode and precision.

See Also

atof

atoi

Programming Overview of LISP

LISP Compatibility


(set ')
(set ’symbol statement)

"Assign the statement to the symbol."	LISP Function

This function is an assignment function, similar to the setq function. Set assigns the statement argument to symbol. The symbol should be quoted. When left unquoted, it changes the values of previously assigned symbols.

Examples

Code	Returns
(set 'x 56)	56
(set 'y "Hello")	"Hello"
(set 'z '(a b c d))	(A B C D)
Note: The difference between the set function and the setq function is that set evaluates the symbol. The following are equivalent expressions:

(set 'i "Me")

(setq i "Me")

See Also

quote

Programming Overview of LISP

LISP Compatibility


(set_tile)
(set_tile key value)

"Set the value of the dialog box tile."	LISP Function

This function sets the value of a dialog box tile.

The key argument is a case-sensitive string that specifies the tile. The value attribute is a string that assigns the new value to the tile.

Example

(set_tile tile1 val1)

See Also

get_tile

Programming Overview of LISP

LISP Compatibility


(setcfg)
(setcfg parameter value)

"Set the parameter to the value."	LISP Function

This function changes data in the [AddData] section of the Icad.Cfg file, if it exists. The value can be any text or number. The parameter is a string with the following format:

"AppData/appname/sname/parameter"

where:

Cfg Name	Meaning
AppData	The [AppData] section.
appname	The name of the application.
sname	The section name.
parameter	The parameter name.
Example

Code	Returns
(setcfg "appdata/appname/sname/parameter" "1")	"1"
See Also

getcfg

setvar

setenv

Programming Overview of LISP

LISP Compatibility


(setenv)
(setenv variable value)

"Set the operating system variable to that value."	LISP Function

This function sets the value of a specified operating system environment variable—for example, as stored by the DOS PATH variable.

Notes

If you give setenv a non-existent variable name, it creates that, and sets it. You can see the new variable name from within IntelliCAD®'s "shell" DOS window (created by the Shell command) but not from the Windows DOS window. Setenv creates the variable within IntelliCAD's application space.

When you enter ICAD or ACAD as the environment variable you want to set, the setenv function changes that to the SEARCHPATH variable and uses it normally.

Example

Code	Returns
(setenv "PATH" "C:\\;C:\\WIN95;C:\\ICAD")	"C:\\;C:\\WIN95;C:\\ICAD"
See Also

getenv

setvar

setcfg

Programming Overview of LISP

LISP Compatibility


(setfunhelp)
(setfunhelp "c:filename" [helpfile [topic [command-name]]]])

"Register the command with that Help file."	LISP Function

This function registers your user-defined command-name with the Help facility. This ensures that the correct helpfile and topic are displayed when the user requests help on that command-name. The setfunhelp function returns the string passes as "c:filename" when successful; otherwise, it returns nil.

The c:filename argument is your user-defined command; it must include the C: prefix and must be a quoted string.

The helpfile argument is the name of the HLP file. Presumably, you have created a custom HLP file for your application.

The topic argument is a topic name within the HLP file.

The command-name argument is the same as the filename, but without the C: prefix.

Example

Code	Returns
(setfunhelp "c:stair" "stair.hlp" "raisers" "stair")	"c:stair"
See Also

help

Programming Overview of LISP

LISP Compatibility


(setq)
(setq symbol1 statement1 [symbol2 statement2] ...)

"Set the symbol to the statement."	LISP Function

This function is LISP’s most commonly-used assignment function. This function assigns statement1 to symbol1. For example:

(setq x 16)

sets the value of 16 to the symbol x.

NOTE  Don’t confuse this with the equals function (=). The = function doesn’t assign.

Symbol1 is the variable that receives the value, where as statement1 is the value that is assigned to symbol1. Statement1 can be a variable representing a value, a numeric value, or a string.

Examples

Code	Returns
(setq y 10)	10
(setq x y)	10 Sets the variable x to the value of y—previously we set y to 10.
(setq myvar "Mom")	"Mom"
(setq pt1 '(5 3))	(5 3)
Note: You can set multiple variables at a time with the setq function. The [symbol2 stmt2]… is optional. When assigning multiple variables, the value returned is the last variable’s assigned value.

Code	Returns
(setq a 5 b 6)	6
(setq x 1.0y 2.0 z 3.0)	3.0
To see the value of any variable, type ! before the variable name:

Code	Returns
!a	5
!b	6
See Also

defun

quote

lambda

Programming Overview of LISP

LISP Compatibility


(setvar)
(setvar sysvar value)

"Set the system variable to that value."	LISP Function

This function changes the value of IntelliCAD® system variables. The sysvar argument is the exact name of the system variable, in string format.

The value is the new value for the system variable. The format of value varies, depending on the system variable; it could be an integer, a real number, a list of x,y or x,y,z-coordinates, or a string—as shown by the examples below.

Examples

Code	Returns
(setvar "cmdecho" 1)	1
(setvar "distance" 2.5)	2.50000
(setvar "gridunit" '(1 1))	(1.0 1.0)
(setvar "insbase" '(1 2 3))	(1.0 2.0 3.0)
(setvar "dwgname" "drawing1")	"drawing1"
Notes

The setvar function is identical in nature to the Setvar command, with a single exception: the Angbase system variable accepts degrees with the Setvar command but only accepts radians with the setvar function.

Some system variables are read-only, which means their value cannot be changed with setvar. For example, the CDate system variable contains the current date and time. You cannot change that with the setvar function. Instead, you must use the Windows Date & Time Properties dialog box. You can, however, retrieve the value of any system variable with getvar.

See Also

setcfg

setenv

Programming Overview of LISP

LISP Compatibility


(setview)
(setview view-descriptor [vport])

"Create a 3-D viewpoint."	LISP Function

This function changes the 3-D viewpoint of a specified viewport.

The view-descriptor argument is not the simple x,y,z coordinates, such as '(1.0 2.0 3.0), that you might expect from the Viewpoint command. Instead, it requires the view descriptor table as returned by the tblsearch function. The data is in dotted-pair format and looks like the following:

((0 . "VIEW") (2 . "ASDF") (70 . 0) (40 . 7.76066) (10 7.49352 4.5)

(41 . 12.2537) (11 0.0 0.0 1.0) (12 0.0 0.0 0.0) (42 . 50.0) (43 . 0.0)

(44 . 0.0) (50 . 0.0) (71 . 0))

Example

One easy way to create the viewpoint data is with the View Save command. The example code below shows how to create and get this data.

Code	Comments
(command "view" "s" "asdf")	1. Create a viewpoint named ASDF.
(setq vp (tblsearch "VIEW" "asdf"))	2. Get the viewpoint data.
(setq cv (getvar "cvport"))	3. Get the current viewport number.
(setview vp cv)	4. Set the viewpoint in the viewport.
NOTE The vport argument is an optional integer that specifies the viewport number. When you have a single viewport, the argument is not required; the default value is 2. To get the number of the current viewport, use the Cvport system variable, as in the above example.

See Also

vport

setq

Programming Overview of LISP

LISP Compatibility


(sin)
(sin angle)

"Calculate the sine."	LISP Function

This function returns the sine of an angle. The angle is interpreted to be in radians and the result is an real number.

Examples

Code	Returns
(sin pi)	0.00000
(sin (/ pi 2))	1.00000
(sin 1.0)	0.841471
(sin 0)	0.00000
See Also

atan

cos

tan

pi

Programming Overview of LISP

LISP Compatibility


(slide_image)
(slide_image x y width height slide)

"Display a slide in the dialog box."	LISP Function

This function displays an image in a dialog box.

The image is positioned at x,y coordinates. These coordinates are the upper-left corner of the image. The width argument specifies the width of the image in the negative x-direction. The height argument specifies the height of the image in the negative y-direction.

The slide argument is the name of the snapshot file, which can be in EMF (enhanced metafile), WMF (Windows metafile), or SLD (slide) format.

Example

Code	Returns
(slide_image 10 10 15 20 "image.sld")	nil
Note: Use the MSlide command to create an image. For good reproduction, create the snapshot at the same size and aspect ratio (usually 4:3) that you plan to display the image in the dialog box.

See Also

dimx_tile

dimy_tile

Programming Overview of LISP

LISP Compatibility


(snvalid)
(snvalid symbol [flag])

"Determine whether the symbol table has valid characters."	LISP Function

This function determines whether the symbol table contains valid characters. The symbol argument is the name of a table, including "LAYER", "LTYPE", "VIEW", "STYLE", "BLOCK", "UCS", "VPORT", "DIMSTYLE", and "APPID".

The flag argument toggles whether the vertical bar ( | ) character is valid:

Flag	Meaning
0	Vertical bar is not permitted.
1	Vertical bar is permitted.
Example

Code	Returns
(snvalid "A")	T
See Also

tblsearch

Programming Overview of LISP

LISP Compatibility


(sqrt)
(sqrt number)

"Calculate the square root."	LISP Function

This function returns the square root of the number. The result is always a real number.

Examples

Code	Returns
(sqrt 49)	7.00000
(sqrt PI)	1.77245
See Also

expt

log

log10

pi

Programming Overview of LISP

LISP Compatibility


(ssadd)
(ssadd [entity-name [selection-set]])

"Add it to the selection set."	LISP Function

This function adds entity entity-name to selection-set or creates a new selection set (when ssadd is used without arguments). The ssadd function works in one of the three ways below:

Code	Result
(ssadd)	A new selection set is created with no entitys.
(ssadd entity-name)	A new selection set is created containing entity-name as the only entity.
(ssadd entity-name selection-set)	Adds the entity, entity-name, to an existing selection set, selection-set.
The new or revised selection set name is returned in a format similar to the following:

<Selection set: 26146268>

IntelliCAD® can have more than one selection set open at a time.

Examples

Code	Comments
(setq sset1 (ssadd))	Creates a new selection set called sset1.
(setq ent1 (car (entsel)))	Prompts the user to select the entity to set to ent1
(ssadd ent1 sset1)	Adds ent1 to sset1.
(setq ent2 (entlast))	Returns last entity in drawing; sets it to ent2.
(ssadd ent2 sset1)	Adds ent2 to sset1.
See Also

entlast

entsel

ssdel

ssget

setq

Programming Overview of LISP

LISP Compatibility


(ssdel)
(ssdel entity-name selection-set)

"Erase it from the selection set."	LISP Function

This function deletes the entity, entity-name, from the selection set, selection-set. Unlike the ssadd function, entity-name and selection-set are not optional.

If entity-name is part of the selection set, ssdel deletes it and returns the selection set. If it is not part of the selection set, a nil is returned.

Examples

Code	Comments
(setq sset1 (ssget))	Creates a new selection set called sset1.
(setq ent1 (entnext))	Finds the first entity in the drawing and sets it to ent1.
(ssadd ent1 sset1)	Adds ent1 to sset1
(ssdel ent1 sset1)	Deletes ent1 from sset1.
(ssdel ent2 sset1)	Assuming ent2 is set to an entity(not in sset1), a nil would return.
See Also

entnext

ssget

setq

Programming Overview of LISP

LISP Compatibility


(ssget)
(ssget [mode] [point1 [point2]] [point-list] [filter-list])

"Ask the user to select entities."	LISP Function

This function prompts the user to select entities. When all arguments are left out, the ssget function prompts the user with the "Select entities:" prompt. This is the only situation when ssget highlights selected entities. The ssget function returns <Selection set: 26146268>. The selection set does not contain attributes nor polyline vertices.

The mode argument specifies the entity selection method:

Mode	Meaning	Points	Example
	(none) Single pick point	point1	(ssget '(10 15)) or (ssget)
"C"	Crossing	point1 point2	(ssget "C" '(1 1) '(2 2))
"CC"	Crossing Circle	point1 point2	(ssget "CC" '(1 1) '(2 2))
"CP"	Crossing Polygon	points-list	(ssget "CP" ptlist)
"F"	Fence	points-list	(ssget "F" ptlist)
"I"	Implied	none	(ssget "I")
"L"	Last	none	(ssget "L")
"O"	Outside	points-list	(ssget "O" ptlist)
"OC"	Outside Circle	point1 point2	(ssget "OC" '(1 1) '(2 2))
"OP"	Outside Polygon	points-list	(ssget "OP" ptlist)
"P"	Previous	none	(ssget "P")
"PO"	POint	point1	(ssget "PO" '(1 1))
"W"	Window	point1 point2	(ssget "W" '(1 1) '(2 2))
"WP"	Window Polygon	points-list	(ssget "WP" ptlist)
"X"	All	none	(ssget "X")
The "I" mode creates an "implied" selection set of entities selected while system variable PICKFIRST is on. The "PO" mode selects all closed entities covering the specified point.

The point1 (and many times point2) argument specifies the pick point for the selection mode, as noted in the table above.

The filter-list argument is a list that specifies entity properties in dotted-pair format, such as:

(ssget "X" '((0 . "CIRCLE") (62 . 1)))

which selects all circles colored red (color 1). In addition, the special dotted-pair of -4 lets you include a relational test, such as:

(ssget "X" '((0 . "CIRCLE") (62 . 1) (-4 . "<") (40 . 15.0))

which selects all red circles less than 15 units in radius. For this function, the operators recognized by IntelliCAD® are:

Operator	Meaning
"&"	Bitwise AND (integers only).
"&="	Bitwise masked equals (integers only).
"*"	All.
"="	Equals.
"!="	Not equal to.
"/="	Not equal to.
"<>"	Not equal to.
"<"	Less than.
"<="	Less than or equal to.
">"	Greater than.
">="	Greater than or equal to.
These operators are used with integers; the bitwise operators cannot be used with real numbers; the "*" operator is the only that can be used with strings.

Notes

The current entity snap setting is ignored by the ssget function.

When the selection set is used in model space, paper space entities are not selected, and vice versa: entities from the space not currently in effect are filtered out.

See Also

ssdel

ssgetfirst

Programming Overview of LISP

LISP Compatibility


(ssgetfirst)

"Determine which entities are highlighted and/or gripped."	LISP Function

This function reports the number of entities in the drawing that are highlighted (selected) and gripped. Grips are the small squares that surround a selected entity that you can use to manipulate or modify the entity.

The ssgetfirst function returns a list with two elements: the first element is a selection set of entities that are gripped but not selected; the second element is a selection set of entities that are gripped and selected.

Example

Code	Comments
(ssgetfirst)	Displays a list of highlighted and gripped entities.
See Also

ssdel

ssget

Programming Overview of LISP

LISP Compatibility


(sslength)
(sslength selection-set)

"Determine how many entities are in the selection set."	LISP Function

This function reports the number of entities in the selection set, selection-set.

NOTE Use the ssget function to create the selection-set.

Example

Code	Comments
(setq sset1 (ssadd))	Creates a new selection set called sset1.
(setq ent1 (car (entsel)))	Prompts user to select entity to set to ent1.
(ssadd ent1 sset1)	Adds ent1 to sset1.
(sslength sset1)	Returns 1.
See Also

ssdel

setq

Programming Overview of LISP

LISP Compatibility


(ssmemb)
(ssmemb entity-name selection-set)

"Determine whether an entity is in the selection set."	LISP Function

This function determines if the entity, entity-name, is in the selection set, selection-set. This function searches through the entities within the selection set to find if entity-name is included. If it is included, the entity's name is returned. If not, nil is returned.

Examples

Code	Comments
(setq sset1 (ssadd))	Creates a new selection set called sset1.
(ssadd ent1 sset1)	Adds ent1 to sset1.
(ssmemb ent1 sset1)	Asks if ent1 is a member of sset1. Yes, so entity name is returned.
(ssmemb ent2 sset1)	Asks if ent2 is a member of sset1. No, so nil is returned.
See Also

ssadd

ssdel

ssget

setq

Programming Overview of LISP

LISP Compatibility


(ssname)
(ssname selection-set index)

"Identify the nth entity in the selection set."	LISP Function

This function returns the name of the entity corresponding to the index in the given selection-set. The index refers to the order in which the entities were placed in the selection set starting with 0: index #0 is the first entity, index #1 is the second entity, and so forth.

Examples

Code	Comments
(setq car (ssget))	Creates new selection set.
(setq part1 (ssname car 0)	Returns the name of the 1st entity.
(setq part2 (ssname car 1)	Returns the name of the 2nd entity.
NOTE The entity names returned aren’t actual names like line or arc; they are numeric representations in hexadecimal.

See Also

ssdel

ssget

setq

Programming Overview of LISP

LISP Compatibility


(sssetfirst)
(sssetfirst grip-set [pick-set])

"Grip these entities."	LISP Function

This function highlights entities in pick-set and places grips around entities in grip-set. (Grips are the small squares that surround a selected entity that you can use to manipulate or modify the entity.)

NOTE Use the ssgetfirst function to create the grip-set and pick-set selection sets.

Example

(sssetfirst ss1)

See Also

ssdel

ssget

Programming Overview of LISP

LISP Compatibility


(start_dialog)

"Start that dialog box."	LISP Function

This function displays a dialog box and accepts clicks the user inputs with the mouse button. It returns the status code passed to it by the done_dialog function:

Code	Meaning
1	User clicked OK button.
0	User clicked Cancel button.
-1	The term_dialog function was used.
Example

Code	Returns
(start_dialog)	1
Notes

A dialog box is first initialized by the new_dialog function.

The order of calling a dialog box is as follows:

1.	load_dialog

2.	new_dialog

3.	action_tile, start_image, start_list, etc (perform all dialog box initialization, such as associating an action with a tiles, creating an image, and making the lists for list boxes)

4.	start_dialog

See Also

term_dialog

Programming Overview of LISP

LISP Compatibility


(start_image)
(start_image key)

"Start creating a dialog box image."	LISP Function

This function signals the start of the image key in a dialog box. This function is used to precede the dialog box drawing functions: fill_image, slide_image, and vector_image.

To end the drawing, use the end_image function.

Example

(start_image kng)

See Also

Programming Overview of LISP

LISP Compatibility


(start_list)
(start_list key [operation [index]])

"Start processing a list box."	LISP Function

This function signals the start of processing a list key in a dialog box. The optional operation argument describes the list operation to be performed (default = 3):

Operation	Meaning
1	Change contents of the list.
2	Append new data to the list.
3	Replace the list with a new one (default).
The optional index argument is used only when operation = 1. It indicates the item # to be changed; the first item is #0; the second item is #1, and so on.

Examples

Code	Comments
(start_list ssg)	Replace list with new list.
(start_list ssg 3)	Same action as above.
(start_list ssg 1 4)	Change the fifth item on the list.
(start_list ssg 2)	Add data to the list.
NOTE You also use this function when creating list boxes and drop-down list boxes in DCL. For examples using this function in conjunction with DCL, see list_box and popup_list (drop-down list box).

See Also

add_list

end_list

Programming Overview of LISP

LISP Compatibility

Programming Overview of DCL


(startapp)
(startapp appname [filename])

"Launch this Windows application."	LISP Function

This function starts any other Windows application appname. Optionally, it also loads a filename into that application. When successful, the startapp function returns an integer greater than 2; when unsuccessful, it returns 2.

Examples

Code	Returns
(startapp "wordpad" "basedcl.dcl")	31679
(startapp "junk")	2
See Also

load

xload

help

Programming Overview of LISP

LISP Compatibility


(strcase)
(strcase string [flag])

"Convert this string to all upper- or all lower-case."	LISP Function

This function converts text in a string to all upper-case or all lower-case (when flag is non-nil).

The case to be converted is specified by the flag argument. When omitted or set to nil, all characters are converted to upper-case. When not nil (T is typically used), all alphabetic characters are converted to lower-case.

Examples

Code	Returns
(strcase "Yes")	YES
(strcase "NO" T)	"no"
(setq var (strcase var))	Permanently changes variable.
(if (= (strcase var) "YES") (...)	Temporarily checks variable.
Note: LISP functions that check and compare text tend to be case-sensitive. For example, (if (= "Y" ans) ...) only works with a capital "Y"; a lowercase "y" is not considered the same. For this reason, it is useful to apply the strcase function to the user's response, as follows:

(setq ans (getchar))

(setq ans (strcase ans))

(if (= "Y" ans)

...

)

See Also

atoi

atof

Programming Overview of LISP

LISP Compatibility


(strcat)
(strcat string1 [string2] …)

"Make one big string out of all these little strings."	LISP Function

This function joins together strings, an operation also known as concatenation.

Examples

Code	Returns
(setq a  "Jack and Jill")	"Jack and Jill"
(setq b " went up the hill")	"went up the hill"
(strcat a b )	"Jack and Jill went up the hill"
(setq rad (rtos 7.0))
(strcat "The radius is " rad)	"The radius is 7.0000"
See Also

strlen

substr

setq

Programming Overview of LISP

LISP Compatibility


(strlen)
(strlen [string1] [string2] …)

"Determine how many characters are in a string."	LISP Function

This function counts the number of characters in a string, or series of strings. It returns the amount as an integer. If an empty string exists or no string is provided, the value is zero.

Examples

Code	Returns
(strlen "How many?")	9
(strlen "one" "two" "three")	11
(strlen "")	0
(strlen)	0
See Also

substr

Programming Overview of LISP

LISP Compatibility


(subst)
(subst new old list)

"Substitute this for that in a list."	LISP Function

This function is much like the search-and-replace function in a word processor. The difference is that subst works with lists, not strings.

The subst function replaces every occurrence of old with new in list. You can use this function together with the assoc function to manipulate dotted-pair entity data.

Example

Code	Returns
(subst 'a 'b '(a b c))	(A A C)
See Also

length

member

Programming Overview of LISP

LISP Compatibility


(substr)
(substr string start [length])

"Give me part of that string."	LISP Function

This function takes apart strings. It takes out a sub-string from the original string, which you can then assign to a variable or use as any other string.

The argument start indicates which character in the string to start from. Unlike other functions that deal with elements of a list, substr considers the first character in the string as number one (not #0). When the start position is greater than the length of the string, substr returns “” (non-nil).

The length argument represents the number of characters to include in the sub-string; this value must be a positive integer. If this argument is not provided, the sub-string extends to the end of the original string. When the integer is larger than the number of characters available, the entire list from the specified first character to the end will be returned with no error.

Examples

Code	Returns
(substr "California" 4 3 )	"ifo"
(substr "Texas" 3 )	"xas"
(substr "New Mexico" 12 )	""
See Also

strlen

strcat

Programming Overview of LISP

LISP Compatibility


(tan)
(tan angle)

"Determine the tangent of an angle."	LISP Function

This function returns the tangent of an angle. The angle must be in radians. The result is a real number.

Examples

Code	Returns
(tan 0)	0.00000
(tan (/ pi 4))	1.00000
(tan pi)	0.00000
See Also

atan

cos

sin

pi

Programming Overview of LISP

LISP Compatibility


(tblnext)
(tblnext table-name [flag])

"Get me the next item in the table."	LISP Function

This function finds the first (or next, depending on the flag) instance of a symbol type in the drawing table. The argument table-name represents the name of symbol type to search for. Valid table-names are:

Table-name	Meaning
"appid"	Application identification.
"block"	Block names.
"dimstyle"	Dimension style names.
"layer"	Layer names.
"ltype"	Linetype names.
"style"	Text style names.
"view"	View names.
"ucs"	UCS names.
"vport"	Viewport names.
First, the tblnext function returns the first specified symbol in the table. When the symbol is found, it is returned as a list of dotted pairs. Used repeatedly, the next symbol is returned in order. When no more symbols exist in the list, nil is returned.

When the flag argument is supplied (typically as T), the search begins from the top of the table.

Example

Code	Comments
(tblnext "block" T)	Gets first block.
((0 . "BLOCK")	Symbol type.
(2 . "MYBLOCK")	Block name.
(70 . 0)	Flags.
(10 0.0 0.0 0.0)	Insertion point.
(-2 . <Entity name:  1ff0558>))	Entity Name.
See Also

tblobjname

tblsearch

entget

vports

Programming Overview of LISP

LISP Compatibility


(tblobjname)
(tblobjname table-name symbol)

"Determine the name of the entity associated with that symbol."	LISP Function

This function returns the entity name of a specified symbol table entry. The tblobjname function searches the symbol table table-name for symbol. It returns the entity name of that symbol table entry. Valid table-names are:

Table-name	Meaning
"appid"	Application identification.
"block"	Block names.
"dimstyle"	Dimension style names.
"layer"	Layer names.
"ltype"	Linetype names.
"style"	Text style names.
"view"	View names.
"ucs"	UCS names.
"vport"	Viewport names.
Default symbol names are:

Symbol	Meaning
"CONTINUOUS"	Default linetype.
"0"	Default layer.
"STANDARD"	Default text style.
"STANDARD"	Default dimension style.
Example

Code	Returns
(tblobjname "VIEW" "ASDF")	<Entity name: be6b44>
Note: The entity name returned by tblobjname is useful for the entget and entmod functions.

See Also

tblnext

tblsearch

vports

Programming Overview of LISP

LISP Compatibility


(tblsearch)
(tblsearch table-name symbol [flag])

"Search the table for a symbol."	LISP Function

This function obtains information about a known symbol from a drawing table-name. After entering in the table-name argument and the known symbol name, a list is returned containing dotted pairs for the symbol.

The flag (when set non-nil, such as T) lets the tblnext function retrieve the next item in the table:

(tblsearch "layer" "0" T)

(tblnext "LAYER")

The list returned is exactly like that returned from tblnext.

Example

Code	Result
(tblsearch "layer" "0")	((0 . "LAYER") (2 . "0") (70 . 0) (62 . 7) (6 . "CONTINUOUS"))
See Also

tblobjname

entget

vports

Programming Overview of LISP

LISP Compatibility


(term_dialog)

"Terminate all dialog boxes."	LISP Function

This function terminates all dialog boxes. This function is especially useful for closing several nested dialog boxes all at once.

Example

Code	Returns
(term_dialog)	nil
See Also

unload_dialog

Programming Overview of LISP

LISP Compatibility


(terpri)

"Print a carriage return."	LISP Function

This function prints a new line to the command prompt area, and returns nil.

Example

Code	Returns:
(terpri)	Carriage return. nil
NOTE Do not use this function to print a new line in a file. For that, use print or princ instead.

See Also

prompt

Programming Overview of LISP

LISP Compatibility


(textbox)
(textbox entity-list)

"Determine the x,y,z dimensions of that text entity."	LISP Function

This function returns the 3-D coordinates of a box that encloses a text entity. The lower-left corner is always (0,0). The argument entity-list must refer to a text entity but not text in dimensions and blocks.

Example

Code	Returns
(setq txt (entlast))	Entity name.
(setq txt1 (entget txt))	Dotted-pair list.
(textbox txt1)	((0.0 0.0 0.0)(1.8 0.2 0.0))
See Also

command

setq

Programming Overview of LISP

LISP Compatibility


(textpage)

"Switch to the Text window and clear it."	LISP Function

This function is the same as textscr, except the Prompt History window is cleared. This gives you an entire empty page.

Example

Code	Returns
(textpage)	nil
See Also

grtext

Programming Overview of LISP

LISP Compatibility


(textscr)

"Switch to the Prompt History window."	LISP Function

The textscr function is the opposite of graphscr. If you are already in the textscr, the function has no effect.

Example

Code	Comment
(textscr)	Brings up the Prompt History window.
See Also

textpage

Programming Overview of LISP

LISP Compatibility


(trace)
(trace function . . .)

"Turn on debug mode."	LISP Function

Used for debugging, this function sets a trace debug aid for the specified function. Each time the function is run, the trace appears and prints the result of the function.

NOTE Use untrace to turn off the trace debugging aid.

Example

Code	Returns
(trace fname)	FNAME Sets trace aid for FNAME function.
See Also

untrace

Programming Overview of LISP

LISP Compatibility


(trans)
(trans point from to [flag])

"Translate that point from one coordinate system to another."	LISP Function

This function translates (moves) a point from one to another coordinate system.

The point argument is a 3-D point in list format. The meaning of this argument depends on the setting of flag.

The from argument describes the current coordinate system:

Code	Coordinate system
0	World coordinate system (WCS).
1	Current user-defined coordinate system (UCS).
2	Display coordinate system ( DCS) of current viewport—with code 0 or 1
	DCS of current model space viewport—with code 3.
3	Paper space DCS.
The to argument describes the destination coordinate system, using the same codes as the argument from.

The flag argument determines the meaning of point:

Flag	Meaning
T	3D displacement.
nil	3D point.
Examples

Code	Returns
(setq pt1 (getpoint))	(6.85268 3.94705 0.0)
(trans pt1 0 1)	(-2.05459 -4.40897 6.23523)
(trans pt1 0 1 T)	(-4.36405 -5.28773 3.94124)
See Also

setq

Programming Overview of LISP

LISP Compatibility


(trim)
(trim string [flag])

"Erase blank spaces in a string."	LISP Function

This function trims spaces from the specified string.

The optional flag argument represents the options for stripping spaces:

Flag	Meaning
none	Strip all spaces from beginning and end.
"B"	Strip spaces from beginning of string.
"M"	Strip spaces from middle of string.
"E"	Strip spaces from end of string.
"BE"	Strip spaces from beginning and end of string.
"ME"	Strip spaces from middle and end of string.
"BM"	Strip spaces from beginning and middle of string.
Examples

Code	Returns
(setq a "   Green   Beans   " )
(trim a "B" )	"Green   Beans   "
(trim a "M" )	"   GreenBeans   "
(trim a "be")	"Green   Beans"
(trim a)	"Green   Beans"
See Also

lpad

rpad

setq

Programming Overview of LISP

LISP Compatibility


(type)
(type item)

"Determine the type (for example, file, integer, string, and so forth) of an item."	LISP Function

This function returns the type (such as real number, integer, list, entity name, and so forth) of the item. The following table lists the various types and their meanings.

Types	Meaning
ENAME	Entity name.
EXSUBR	External subroutines: SDS functions.
FILE	File descriptor.
INT	Integer number.
LIST	List and user-defined function.
PAGETB	Function paging table.
PICKSET	Selection set.
REAL	Real number.
STR	String.
SUBR	Subroutines: LISP functions.
SYM	Symbol.
Examples

Code	Returns
(type 2)	INT
(type 2.0)	REAL
(type '(5 6 7))	LIST
(type "Street")	STR
(type setq)	SUBR
(setq x (open "C:\\my.fil" "w"))
(type x)	FILE
(type 'x)	SYM
(setq entinfo (entsel)) (type entinfo)  ENAME	Could Return: <Entity name: 208055>
(setq ourset (ssget))	<Selection set: 2>
(type ourset)	PICKSET
See Also

atom

boundp

numberp

listp

not

null

entsel

ssget

setq

zerop

Programming Overview of LISP

LISP Compatibility


(unload_dialog)
(unload_dialog dcl_id)

"Unload that dialog box."	LISP Function

This function unloads a dialog box identified as dcl_id.

Example

Code	Returns
(unload_dialog hlg)	nil
See Also

new_dialog

load_dialog

Programming Overview of LISP

LISP Compatibility


(untrace)
(untrace function ...)

"Turn off debug mode."	LISP Function

This function turns off the trace debugging aid for the selected function, which was set using trace. The last function name is returned.

Example

Code	Returns
(untrace fname)	FNAME Clears trace aid for FNAME function.
See Also

Programming Overview of LISP

LISP Compatibility


(vector_image)
(vector_image x1 y1 x2 y2 color)

"Draw a vector in the dialog box."	LISP Function

This function draws a vector of a specified color in a dialog box. The vector is drawn from x1,y1 to x2,y2. The origin (0,0) of the dialog box tile is at the upper-left corner.

The color argument can take one of these special meanings:

Color	Mnemonic	Meaning
-2	BGLCOLOR	Current background of the IntelliCAD graphics screen.
-15	DBGLCOLOR	Current dialog box background color.
-16	DFGLCOLOR	Current dialog box foreground color of text.
-18	LINELCOLOR	Current dialog box line color.
Example

Code	Returns
(vector_image 1 2 3 4 -1)	nil
See Also

dimx_tile

dimy_tile

Programming Overview of LISP

LISP Compatibility


(ver)

"Determine the version number of this LISP."	LISP Function

This function returns the version number of the LISP programming language included with IntelliCAD®.

Example

Code	Returns
(ver)	"LISP Release 1.0"
See Also

getenv

getvar

Programming Overview of LISP

LISP Compatibility


(vmon)

"Turn on virtual memory."	LISP Function

This obsolete function turns on the virtual memory manager. This function is no longer required; it is included with LISP for compatibility reasons.

Example

Code	Returns
(vmon)	nil
See Also

mem

Programming Overview of LISP

LISP Compatibility


(vports)

"Get information about this viewport."	LISP Function

This function returns a description of all current viewports. The description returned by the vports function is a list that includes the viewport identification number, followed by viewport coordinates. These coordinates vary, depending on the setting of Tilemode:

When TileMode = 1, the list consists of the viewports created by the VPorts command—coordinates of the viewport's corners, ranging from (0.0, 0.0) for the lower-left corner, to (1.0, 1.0) for the upper-right corner.

When TileMode = 0, the list consists of the viewports created with the MView command. The corners are described by paper space coordinates.

Note: In model space, the first viewport number is #2; viewport #1 is paper space when Tilemode = 0. The current viewport is listed first.

See Also

tblsearch

Programming Overview of LISP

LISP Compatibility


(wcmatch)
(wcmatch string pattern)

"Search that string."	LISP Function

This function finds internal string matches. You can see if a certain string is found, or match it with another string.

For example, if you had a string variable called MYVAR which contained the string “SUPERCALIFRAGILISTIC123\##” and you wanted to see if the characters “FRAG” were anywhere in the string you could use the wcmatch function, as follows:

(wcmatch MYVAR "*FRAG*")

If a match is found, wcmatch returns T. If no match is found, nil is returned. The wcmatch function is case-sensitive. To find a match, you should use strcase to change everything to uppercase if necessary.

You can use several wildcards for wcmatch:

Wildcard	Definition
~	(tilde) Pattern not found in string.
*	Standard wildcard; can be used anywhere.
?	Matches for a space held by a character or number; number of question marks (?) must exactly match number of characters or numbers in the string.
#	(pound) Matches any single number.
@@	Matches any single character; may not be a number.
.	(period) Matches any single non-alphanumeric character.
	(space) Matches one or more spaces.
[  ]	Matches for any of the characters enclosed in the brackets.
[~ ]	True only if there are extra characters not included in the  brackets.
[  -  ]	(hyphen) Searches within a predefined range pattern.
,	(comma) The "or" option.
‘	(reverse quote) Read next character literally; use for special characters.
Examples

Code	Returns	Comments
(setq N "11234 TROPICANA AVE.#@")
(wcmatch N "~345")	T	"345" is not found in the pattern.
(wcmatch N "*opic*" )	T	"opic" is found with anything before and after.
(wcmatch N "?????????????????????")	T	There are 21 characters, numbers and spaces in this string.
(wmatch N "#####*")	T	Matches 5 digits, followed by anything.
See Also

substr

setq

Programming Overview of LISP

LISP Compatibility


(while)
(while text statement …)

"Keep doing it while it's still true."	LISP Function

This function is a common loop in LISP. The statement controls whether the loop continues or breaks. When statement is true, the loop continues. When statement is nil, the loop breaks. The last statement before the nil is displayed.

Example

Code	Returns
(setq x 25)
(while (/= x 20)
(setq x (1- x)
)	20
See Also

cond

if

repeat

setq

Programming Overview of LISP

LISP Compatibility


(write-char)
(write-char character [file-descriptor])

"Write that character to a file."	LISP Function

This function write a character to a file. The file is specified by the file-descriptor, assigned by the open function. This function writes characters that are in ASCII code. You convert a letter to its ASCII code with the ascii function. When the file-descriptor is left out, the character is written to the command line and Prompt History window.

NOTE The write-line, function, whose format argument is a string, is often more practical and efficient to use than the write-char function.

Example

Code	Returns	Prints in File
(setq fil (open "sample.lsp" "w")) (write-char (ascii "b") fil))	98	b
See Also

write-line

chr

read-char

Programming Overview of LISP

LISP Compatibility


(write-line)
(write-line string [file-descriptor])

"Write that string to a file."	LISP Function

This function is more practical and efficient to use than the write-char function. Anything can be written into a file, since the format is a string. The file is specified by the file-descriptor, assigned by the open function. When the file-descriptor is left out, the string is written to the command line and Prompt History window.

Examples

Code	Returns	Prints to File
(setq fil (open "sample.lsp" "w"))
(write-line "Name:" fil)	"Name:"	Name:
(write-line "Address:" fil)	"Address:"	Address:
See Also

read-line

setq

Programming Overview of LISP

LISP Compatibility


(xdroom)
(xdroom entity-name)

"Determine how much xdata space is still available for an entity."	LISP Function

This function reports the amount of xdata (short for extended entity data) space still free in the entity identified by entity-name. All entities in IntelliCAD® have 16KB (actually, 16,383 bytes) each to store any kind of user-defined data. This function tells you how many bytes are still remaining.

Example

Code	Returns
(setq txt (entlast))	<Entity name: abc123d4>
(xdroom txt)	16383
NOTE Use this function before you add xdata to the entity to verify whether or not the entity still has xdata room.

See Also

xdsize

entlast

setq

Programming Overview of LISP

LISP Compatibility


(xdsize)
(xdsize list)

"Determine how much space a list takes up as xdata."	LISP Function

This function returns the size (in bytes) that a list occupies as extended entity data. The list argument is a list of extended data that contain an application name registered with the regapp function. When the application name is unregistered, IntelliCAD® displays the error message, "Invalid application name in 1001 group nil."

Example

Code	Returns
(xdsize lst)	38
Note: An invalid list creates an error message that is stored via an error code in system variable ERRNO.

See Also

xdroom

Programming Overview of LISP

LISP Compatibility


(xload)
(xload appname [flag])

"Load that SDS application."	LISP Function

This function loads the SDS application (a DLL file) specified by appname. Once the application is loaded, you have access to all the commands it registers.

The optional flag argument is only used when an error occurs during loading. The xload function returns the value of this flag upon failure; when flag is missing, an error message is displayed instead.

When the application you are attempting to xload is already loaded, you see a message to that effect. It will not be loaded a second time.

Examples

Code	Returns
(xload "goodapp")	Loads the application "goodapp".
(xload "badapp")	Error loading application: Could not find badapp.dll.
(xload "badapp" "Uh-oh!")	Error loading application: Could not find badapp.dll. "Uh-oh!"
(xload "badapp" (xload "goodapp"))	Loads the application "goodapp". Error loading application: Could not find badapp.dll
(xload "loadedapp")	Application "C:loadedapp.dll" is already loaded.
(xload "loadedapp")	Can't open "loadedapp" for execution. error: XLOAD failed *Cancel* "loadedapp"
See Also

ads

xunload

load

Programming Overview of LISP

LISP Compatibility


(xunload)
(xunload appname [flag])

"Unload that SDS application."	LISP Function

This function unloads any SDS application that is currently loaded. IntelliCAD® tells the application to clean up any allocated memory and end itself, then unloads the application and unregisters its commands.

The optional flag argument is only used when an error occurs during loading. The xunload function returns the value of this flag upon failure; when flag is missing, an error message is displayed instead.

If the application you are attempting to xunload is not currently loaded, you see a message to that effect and the request will be ignored.

Examples

Code	Returns
(xunload "goodapp")	Unloads the application "goodapp".
(xunload "badapp")	Error unloading application: Could not find badapp.dll.
(xunload "badapp" "Uh-oh!")	Error loading application: Could not find badapp.dll. "Uh-oh!"
(xunload "badapp")	Unloads the application "goodapp". Error loading application: Could not find badapp.dll
(xunload "notloaded")	Error loading application: Could not find notloaded.dll Application "notloaded" not loaded error:  XUNLOAD failed
(xunload "notloaded")	*Cancel* "notloaded"
See Also

ads

xload

load

Programming Overview of LISP

LISP Compatibility


(zerop)
(zerop number)

"Determine whether this number is zero."	LISP Function

If number is a real number or an integer and it is a zero value, the zerop function returns a T. Otherwise, it returns a nil.

Examples

Code	Returns
(zerop 0)	T
(zerop 0.5)	nil
(zerop 0.0000)	T
See Also

numberp

listp

boundp

atom

not

null

Programming Overview of LISP

LISP Compatibility


Generally, an atom is considered to be a number or a variable. Specifically, it is anything other than a list.

For more information, see the atom function.


DCL is an acronym for Dialog Control Language, a separate programming language you can use with IntelliCAD® to create custom dialog boxes. For more information, see the DCL Programming Reference.


 A dotted pair is a special kind of list. A list of two numbers is commonly used as a 2-D x,y coordinates, such as (1.0 2.0). A list of three numbers is commonly used a 3-D x,y,z coordinates, such as (10.0 11.0 12.0).

A dotted pair is used to describe entity data, such as (62 . 1). Dotted pair data is very similar to (though not exactly the same as) DXF codes. For example, (62 . 1) means the entity is colored (group code 62) red, color #1. LISP provides many functions (all those beginning with ent) for examining entity data.


An integer is a number that lacks the decimal point. For example, the numbers 0, 1, -512, and 9597 are all integers.


 A real number (also known as a floating point number) is a number containing the decimal point. Even though LISP displays a real number with six significant numbers (such as 2.00000), real numbers are stored in double-precision floating-point format. This is the same as saying there are 14 significant digits of precision, such as 2.0000000000000.


SDS™ is an acronym for Solutions Development System™, a C/C++ language interface compatible with the ADS (AutoCAD® Development System) application programming interface (API) found in other CAD systems.

The primary difference between the two development systems is that all SDS functions have an sds_ prefix, whereas ADS functions have a variety of prefixes, such as ads_, acad_, and acrx_. The exceptions are dialog-related SDS functions, which have the DLGR_ prefix.

For more information, see the SDS Programming Language Reference.


Programming Overview of DCL (Dialog Control Language)

DCL is an acronym for Dialog Control Language, a separate programming language that you can use with IntelliCAD® to create custom dialog boxes. In creating dialog boxes with DCL, you work with elements called tiles, cluster tiles (or clusters), and attributes. The following sections describe each type of element and the basic syntax used to express it.

Tiles

A tile is a dialog box element, such as a button, a text box, a list box, an image, or a piece of text. Tiles are typically expressed via the following syntax:

: toggle { }

Note the colon prefix, followed by a space. That signifies that you are redefining (temporarily) the attributes of a tile. A tile name appearing without the colon prefix indicates that it has already been defined elsewhere (earlier in the DCL file or in another DCL file). The braces contain the tile's attributes (if any), characteristics such as color, associated action, or label.

Tiles are also categorized by function:

Active tiles (for example, : button { … }, : toggle { … }) (check box), and : list_box { … }) define dialog box controls that receive user input and/or carry out commands and actions.

Text tiles (for example, : text { …} and : text_part { … }) manipulate strings in a dialog box.

Error handler tiles (for example, errtile; and ok_cancel_help;) take care of displaying error messages to the user and standard confirmation buttons such as OK, Cancel, and Help.

Decorator tiles (for example,  : image { … } and : spacer { … } handle graphical elements and spacing within a dialog box.

NOTE

There are no tiles for creating tabbed dialog boxes.

Your DCL file must not use the following tiles: cluster, tiles, cancel_button, help_button, info_button, and ok_button.

Cluster Tiles

A cluster is a group of tiles, such as a group of related radio buttons (also called option buttons) or a group of check boxes (also called toggles). Clusters are usually (but not always) surrounded by a rectangular outline. The individual tile elements within a cluster are called the cluster's children.

Clusters are a form of tile, and typically take the following syntax:

: boxed_column { }

Again, note the colon prefix, followed by a space. The braces contain the cluster's attributes and tiles. Radio buttons have their own clusters since, by definition, there must be at least two radio buttons in a cluster.

Attributes

In DCL, the term attribute refers to a characteristic of a tile, such as its color, the action it performs, its label, and so forth. The program's DCL includes a number of predefined attributes (for example, color, multiple_select, and typeface).

A tile can have many attributes or none at all. When a tile has no attributes, it assumes the default values of the attributes.

A typical attribute takes the following syntax:

label = "Pick a viewpoint: ";

Note the semicolon terminator. Not all attributes apply to all tiles. In fact, some attributes change their meaning, depending on the tile with which they are used.

Tiles and Attributes Unique to IntelliCAD's Implementation of DCL

The program's DCL has one unique tile and several attributes that are not found in other implementations of DCL. The following table describes the tile unique to IntelliCAD's implementation of DCL:

Tile	Meaning
: multi_edit_box { }	Creates a multi-line edit box.
The following table summarizes the attributes that are unique to IntelliCAD's implementation of DCL:

Attribute	Meaning
lower_only = flag;	Read all input text as lower case.
pointsize = int;	Point size of text displayed by the dialog box.
read_only - flag;	Text in edit box is non-editable.
typeface = "string";	TrueType typeface displayed by the dialog box.
upper_only = flag;	Read all input text as upper case.
The DCL File Format

A DCL file is in ASCII format, so you can use any text editor (such as Microsoft NotePad or Microsoft Word) to write and edit DCL files.

Syntax for Comments in DCL Code

Line comments are prefixed with //, as follows:

// A comment line.

To embed comments in the DCL code, use /* and */, as follows:

plotdlg : dialog { /* The Plot dialog box*/

Referencing Tile Definitions in DCL Code

The DCL file can reference tile definitions in anther DCL file through the use of the include directive:

@include filename

See Also

About Predefined Attributes

Copying Code Examples from the IntelliCAD Programmer's Reference


About Predefined Attributes

The program's DCL includes many predefined attributes for tiles. The attributes use three types of values: numeric, strings, and reserved values. The valid attributes for each tile varies.

NOTE Do not use the horizontal_margin, vertical_margin, and type attributes in a DCL file.

Numeric Values

Numeric values are integers and/or real numbers, depending on the attribute. A real number between -1 and 1 must have a leading zero, such as 0.1 and not .1. Examples include:

max_value = 16;

aspect_ratio=0.0;

Strings

A string consists of alphanumeric characters within a pair of quotation marks ("text") and is case sensitive. Examples include:

key = "R2";

action = "(function)";

You can use the following control characters within strings:

Control Character	Meaning
\"	Quotation mark. (embedded)
\\	Backslash.
\n	New-line (carriage return).
\t	Tab.
Reserved Values

Some text is used without quotation marks. These are reserved values, which include flags (true and false), color names, and positions, such as left and top. Examples include:

allow_accept = true;

color = blue;

alignment = centered;

See Also

Programming Overview of DCL

Copying Code Examples from the IntelliCAD Programmer's Reference


action = "(string)";

"Execute this LISP function."	DCL Predefined Attribute

This attribute is a callback that executes a LISP function when the user clicks a given tile.

For string, specify the name of a LISP function.

Example

action = "(function)";

Notes

Note that the tile action, known as a callback function, is more usually specified by the controlling program using the action_tile function. If an action is defined by the calling program, the DCL-specifed action is ignored.

The action attribute cannot call an SDS function.

A tile can have only one action assigned to it, and action_tile overrides action if assigned by the program.

Do not include the sds_command function in the action function.

Valid Tiles

button

popup_list

edit_box

multi_edit_box

radio_button

image_button

slider

list_box

toggle

See Also

Programming Overview of DCL

About Predefined Attributes

Programming Overview of LISP


alignment = position;

"Align this tile horizontally or vertically."	DCL Predefined Attribute

This attribute aligns the tiles within a cluster.

For position, you can specify the alignment of a row or column as follows:

For a column, position: left (default), right, centered.

For a row, position: top, centered (default), bottom.

Example

alignment = centered;

Valid Tiles

all tiles

See Also

Programming Overview of DCL

About Predefined Attributes


allow_accept = flag;

"Activate the default button."	DCL Predefined Attribute

This attribute accepts the input when the user presses [Enter] or double-clicks a given tile.

flag: true or false (default).

Example

allow_accept = true;

Valid Tiles

edit_box

multi_edit_box

image_button

list_box

See Also

Programming Overview of DCL

About Predefined Attributes


aspect_ratio = real;

"Specify an image's aspect ratio."	DCL Predefined Attribute

This attribute specifies the ratio of an image's width divided by its height. A common aspect ratio is 1.33, where width = 4 and height = 3.

To create images with the correct aspect ratio, create a paperspace viewport that is 1.333 units wide and 1 unit high, and then scale up as desired. Switch to modelspace to properly center the image, using Pan and Zoom, and create a slide. Note that slide libraries are not supported.

For real, specify a real number. When real = 0.0, the image tile is expands to fit to image size. The default = (none).

Example

aspect_ratio = 0.0;

Note: The aspect_ratio attribute is used with the height or width attribute. You do not use the aspect_ratio attribute when you use both height and width.

Valid Tiles

image

image_button

See Also

Programming Overview of DCL

About Predefined Attributes


big_increment = int;

"Move the slider this much per click." 	DCL Predefined Attribute

This attribute specifies how much a slider increments when the user clicks the central portion of the slider. The default amount is 1/10 of the total range between the minimum value (specified by the min_value attribute) and the maximum value, specified by the max_value attribute.

For int, specify an integer in the range between min_value and max_value.

Example

min_value = -16;

max_value = 16;

small_increment = 1;

big_increment = 10;

Notes

The default value of min_value is 0; the minimum value is -2,147,483,648. The default value of max_value is 10,000; the maximum value is 2,147,483,647.

Horizontal sliders increase in value from left to right; vertical sliders increase value from top to bottom.

Valid Tile

slider

See Also

big_increment

small_increment

Programming Overview of DCL

About Predefined Attributes


children_alignment = position;

"Align the cluster's children."	DCL Predefined Attribute

This attribute defines the default alignment of the children tiles within a cluster. When a child tile has its own alignment attribute, it overrules this children_alignment attribute.

For position, you can specify the alignment children tiles as follows:

For columns, position: left (default), right, or centered.

For rows, position: top, bottom, or centered (default).

Example

children_alignment = centered;

Valid Tiles

row

column

radio_row

radio_column

boxed_row

boxed_column

boxed_radio_row

boxed_radio_column

See Also

Programming Overview of DCL

About Predefined Attributes


children_fixed_height = flag;

"Assign a fixed height to a cluster's children."	DCL Predefined Attribute

This attribute determines whether all tiles in a cluster have a fixed height. Since this can lead to crowding problems, it is probably best to never use this attribute. When a child tile has its own height attribute, it overrules this children_fixed_height attribute.

flag: true or false (default).

Example

children_fixed_height = true;

Valid Tiles

row

column

radio_row

radio_column

boxed_row

boxed_column

boxed_radio_row

boxed_radio_column

See Also

Programming Overview of DCL

About Predefined Attributes


children_fixed_width = flag;

"Assign a fixed width to a cluster's children."	DCL Predefined Attribute

This attribute determines whether all tiles in a cluster have a fixed width. Since this can lead to crowding problems, it is probably best to never use this attribute. When a child tile has its own width attribute, it overrules this children_fixed_width attribute.

flag: true or false (default).

Example

children_fixed_width = true;

Valid Tiles

row

column

radio_row

radio_column

boxed_row

boxed_column

boxed_radio_row

boxed_radio_column

See Also

Programming Overview of DCL

About Predefined Attributes


color = clr;

"Assign this background color for an image."	DCL Predefined Attribute

This attribute specifies the fill color for background of an image tile.

clr: name of the color (default = white).

The following table shows the valid values for clr:

Clr	Meaning
black	Color #0
red	Color #1
yellow	Color #2
green	Color #3
cyan	Color #4; light blue.
blue	Color #5
magenta	Color #6; pink.
white	Color #7; the default color.
dialog_line	Current dialog box line color.
dialog_foreground	Current dialog box text color.
dialog_background	Current dialog background color.
graphics_background	IntelliCAD graphics screen color.
graphics_foreground	White or black.
Note: Black (color #0) appears white on a black background, and white (color #7) appears black on a light background.

Example

color = blue;

Valid Tiles

image

image_button

See Also

Programming Overview of DCL

About Predefined Attributes


edit_limit = int;

"Define the maximum number of characters the user can type in an edit box."	DCL Predefined Attribute

This attribute specifies the maximum number of characters that the user is allowed to type in an edit box tile.

int: an integer; default = 132 characters; maximum = 256.

Example

edit_limit = 100;

Valid Tiles

edit_box

multi_edit_box


edit_width = number;

"Define the width of the input section of an edit box."	DCL Predefined Attribute

This attribute specifies the width (in characters) of the text entry portion in an edit box. The text entry box is right-justified.

For number, use a real number or an integer.

NOTE Typically, the edit_width attribute is different from the value of the edit_limit attribute, which sets the maximum number of characters the user can type in an edit box. Setting the value of edit_limit to be larger than that of edit_width allows the user to type additional characters beyond what the width of the edit_box accommodates. In that case, not all characters in the input string are necessarily displayed all at once. The horizontal direction arrows allow scrolling to the beginning or end of the input.

Example

edit_width = 0;

Note: The default value of the edit_width attribute is 0.0, which stretches the dialog box to fit the required space.

Valid Tiles

edit_box

multi_edit_box

popup_list

See Also

Programming Overview of DCL

About Predefined Attributes


fixed_height = flag;

"Define a fixed height for a tile."	DCL Predefined Attribute

This attribute determines whether height of a tile is allowed to fill the available space. When flag = true, the tile's size is fixed; when flag = false, the tile changes its size to fit the height available.

flag: true or false (default).

Example

fixed_height = true;

Valid Tiles

all tiles

See Also

Programming Overview of DCL

About Predefined Attributes


fixed_width = flag;

"Define a fixed width for a tile."	DCL Predefined Attribute

This attribute determines whether width of a tile is allowed to fill the available space. When flag = true, the tile's size is fixed; when flag = false, the tile changes its size to fit the width available.

flag: true or false (default).

Example

fixed_width = true;

Valid Tiles

all tiles

See Also

Programming Overview of DCL

About Predefined Attributes


fixed_width_font =  flag;

"Display the text of a list box or drop-down list in a fixed-width font."	DCL Predefined Attribute

This attribute determines whether a list_box or popup_list (drop-down list box) displays text in a fixed pitch font, such as Courier. Using this attribute makes it easier to line up text in columns.

flag: true or false (default).

Example

fixed_width_font = true;

Valid Tiles

list_box

popup_list

See Also

Programming Overview of DCL

About Predefined Attributes


height = number;

"Define the height of a tile."	DCL Predefined Attribute

This attribute determines the minimum height of a tile, unless the height is fixed by a fixed_xxx attribute, such as fixed_height. There is usually no need to use this attribute, unless you need to improve the appearance of the dialog box.

number: a real number or an integer that specifies the height in units of character height (the maximum height of a line of screen characters, including the interline spacing).

Example

height = 12.0;

NOTE The aspect_ratio attribute is used with either the height or width attribute. You do not use the aspect_ratio attribute when you use both height and width.

Valid Tiles

all tiles

See Also

Programming Overview of DCL

About Predefined Attributes


initial_focus = "string";

"Specify where the initial focus is."	DCL Predefined Attribute

This attribute specifies the tile that receives the initial focus. The "focus" is the active control in the dialog box—for example, an edit box, a button, or a check box. This attribute is useful for directing the user to the most logical starting point for parameter entry.

string: the tile's key.

Valid Tile

dialog

See Also

Programming Overview of DCL

About Predefined Attributes


is_bold = flag;

"Display the text in boldface."	DCL Predefined Attribute

This attribute causes text to be displayed in boldface.

flag: true or false (default).

Example

is_bold = true;

Valid Tile

text

See Also

Programming Overview of DCL

About Predefined Attributes


is_cancel = flag;

"Activate this button when [ESC] is pressed." 	DCL Predefined Attribute

This attribute selects a button when the user presses the [Esc] key. Only one button in a dialog box is permitted to have the is_cancel attribute set to true. Typically, you use the is_cancel attribute for the Cancel button.

flag: true or false (default).

Example

is_cancel = true;

action = ("done_dialog");

NOTE When a button has the is_cancel attribute, you should have the action attribute call the LISP done_dialog function. If you don't, IntelliCAD® automatically terminates the dialog box when the DIASTAT system variable is set to 0.

Valid Tile

button

See Also

Programming Overview of DCL

About Predefined Attributes


is_default = flag;

"Activate this button when [Enter] is pressed." 	DCL Predefined Attribute

This attribute specifies that a given button is considered the default button when the user presses [Enter]. Only one button in the dialog box is permitted to have the is_default attribute set to true. Typically, you use the is_default attribute for the OK or Apply button.

flag: true or false (default).

Example

is_default = true;

Notes

The is_default attribute does not apply while another button has the focus.

Setting the initial_focus to the OK button ensures that is_default applies and allows the user to exit the dialog box quickly.

Valid Tile

button

See Also

Programming Overview of DCL

About Predefined Attributes


is_enabled = flag;

"Enable or disable a tile."	DCL Predefined Attribute

This attribute determines whether a button is initially unavailable to the user (with the button usually appearing as grayed out). When flag = true, the button is available; when flag = false, the button is unavailable to the user.

flag: true (default) or false.

Example

is_enabled = false;

Valid Tiles

button

popup_list

edit_box

multi_edit_box

radio_button

image_button

slider

list_box

toggle

See Also

Programming Overview of DCL

About Predefined Attributes


is_tab_stop = flag;

"When the user presses [Tab], the focus jumps here."	DCL Predefined Attribute

This attribute determines which tiles receive focus when the user presses the [Tab] key. When flag = true (the default), pressing the [Tab] key causes focus to move to the tile. When flag = false, the tile is skipped over for the next tile. A disabled tile is always skipped, regardless of this attribute setting.

More than one tile in a dialog box may have this is_tab_stop attribute. By default, all tiles are set for "tab stopping."

flag: true (default) or false.

Example

is_tab_stop = false;

Valid Tiles

button

popup_list

edit_box

multi_edit_box

radio_button

image_button

slider

list_box

toggle

See Also

Programming Overview of DCL

About Predefined Attributes


key = "string";

"Specify the name of a tile, as used by a LISP or SDS function."	DCL Predefined Attribute

This attribute specifies the name by which a LISP or SDS program refers to a tile. Each key must be unique within the dialog box. The string is case-sensitive.

string: a string.

Example

key = "R2";

Valid Tiles

button

popup_list

edit_box

multi_edit_box

radio_button

image_button

slider

list_box

toggle

See Also

Programming Overview of DCL

About Predefined Attributes


label = "string";

"Specify a tile's label."	DCL Predefined Attribute

This attribute specifies the text of a tile’s title; optionally, it specifies the tile's mnemonic. The position of the label depends on the type of tile; you cannot control its location. For no label, use " " as the string.

string: a string. The & (ampersand) prefix determines the mnemonic.

Examples

label = "Select a Viewport";

label = "&Open";

Notes

The & (ampersand) prefix specifies the character that becomes the mnemonic. The mnemonic changes the focus but does not select a tile.

You can also use the mnemonic attribute to specify the mnemonic character.

Valid Tiles

boxed_row

boxed_column

boxed_radio_row

boxed_radio_column

button

dialog

edit_box

multi_edit_box

list_box

popup_list

radio_button

text

toggle

See Also

Programming Overview of DCL

About Predefined Attributes


layout = position;

"Determine whether the slider is horizontal or vertical."	DCL Predefined Attribute

This attribute determines the orientation of a slider: vertical or horizontal (the default).

position: horizontal (default) or vertical.

Example

layout = vertical;

NOTE Horizontal sliders increase in value from left to right; vertical sliders increase value from bottom to top.

Valid Tile

slider

See Also

Programming Overview of DCL

About Predefined Attributes


list = "string";

"Specify the initial values displayed by a list."	DCL Predefined Attribute

This attribute specifies the default text for a list_box or a popup_list (drop-down list box).

string: a string. Use the \n (new-line) character to separate lines.

Example

list = "North\nSouth\nEast\nWest";

Note: You may use the \t (tab) character to space text into columns.

Valid Tiles

list_box

popup_list

See Also

Programming Overview of DCL

About Predefined Attributes


lower_only = flag;

"Force all input text to be lower-case."	DCL Predefined Attribute

When flag = true, this attribute converts the text that a user types to lowercase. When flag = false (the default), the text is not converted.

flag: true or false (default).

The lower_only attribute is unique to the implementation of DCL included with IntelliCAD®.

Example

lower_only = true;

Valid Tiles

edit_box

multi_edit_box

See Also

Programming Overview of DCL

About Predefined Attributes


max_value = int;

"Specify the maximum value of a slider."	DCL Predefined Attribute

This attribute specifies the maximum value that a slider tile returns.

int: a 32-bit integer; default = 10000 and maximum = 2,147,483,647.

Example

min_value = -16;

max_value = 16;

small_increment = 1;

big_increment = 10;

NOTE Horizontal sliders increase in value from left to right; vertical sliders increase in value from top to bottom.

The big_increment and small_increment attributes specify how much the slider increments when the user clicks the slider.

Valid Tile

slider

See Also

Programming Overview of DCL

About Predefined Attributes


min_value = int;

"Specify the minimum value of a slider."	DCL Predefined Attribute

This attribute specifies the minimum value that a slider tile returns.

int: a 32-bit integer; default = 0 and minimum = -2,147,483,648.

Example

min_value = -16;

max_value = 16;

small_increment = 1;

big_increment = 10;

NOTE Horizontal sliders increase in value from left to right; vertical sliders increase value from top to bottom.

The big_increment and small_increment attributes specify how much the slider increments when the user clicks on slider.

Valid Tile

slider

See Also

Programming Overview of DCL

About Predefined Attributes


mnemonic = "char";

"Specify which tile has the focus when the user presses a key."	DCL Predefined Attribute

This attribute determines which tile receives the focus when the user presses a key. The character specified by the mnemonic attribute must exactly match a letter found in the tile's label attribute, including capitalization, as shown in the examples below. However, the user may enter either upper- or lower-case letters when using mnemonics. The mnemonic character need not be unique in the dialog box, allow the user to cycle through tiles with similar functions.

char: a character in the label of the tile.

Examples:

label = "3D View";

mnemonic = "3";

label = "Line";

mnemonic = "L";

label = "Donut";

mnemonic = "o";

Valid Tiles

button

popup_list

edit_box

multi_edit_box

radio_button

image_button

slider

list_box

toggle

See Also

Programming Overview of DCL

About Predefined Attributes


multiple_select = flag;

"Allow the user to select multiple items from the list box."	DCL Predefined Attribute

When flag = true, this attribute allows the user to select more than one item from a list box. When the user picks more than one item, each is highlighted.

flag: true or false (default).

Example

multiple_select = true;

Valid Tile

list_box

See Also

Programming Overview of DCL

About Predefined Attributes


password_char = "char";

"Display this character, instead of what the user is typing."	DCL Predefined Attribute

This attribute specifies the character to be displayed as the password character. Typically, you use the * (asterisk) character.

char: any single character.

Example

password_char = "*";

Valid Tiles

edit_box

multi_edit_box

See Also

Programming Overview of DCL

About Predefined Attributes


pointsize = int;

"Display text at this point size."	DCL Predefined Attribute

This attribute specifies the point size for text displayed by a dialog box. The point size affects both text displayed by the dialog box and the text typed by the user. Note that the pointsize attribute controls all text in a dialog box, but only if the typeface attribute has been set as well.

int: an integer in the range from -2,147,483,648 to +2,147,483,647. A larger number represents larger text.

The pointsize attribute is unique to the implementation of DCL included with IntelliCAD®.

Example

pointsize = 10;

NOTE A point is 1/72 of an inch. More accurately, there are 72.72 points per inch. Typical point sizes used for dialog box text ranges between 8 (smaller text) and 12 (larger text) points. Do not use a large point size; doing so causes the dialog box to become too large for the screen, especiallyfor a 640- x 480-pixel screen.

Valid Tile

dialog

typeface

See Also

Programming Overview of DCL

About Predefined Attributes


read_only = flag;

"Prevent the user from editing the text."	DCL Predefined Attribute

When flag = true, this attribute prevents the user from modifying text displayed in a dialog box. This lets you display text in an otherwise editable edit box.

flag: true or false (default).

The read_only attribute is unique to the implementation of DCL included with IntelliCAD®.

Example

read_only = true;

Valid Tiles

edit_box

multi_edit_box

See Also

Programming Overview of DCL

About Predefined Attributes


small_increment = int;

"Move the slider this much per click."	DCL Predefined Attribute

This attribute specifies how much a slider increments when the user clicks the end arrows of the slider.

int: an integer in the range of min_value and max_value. The default value is 1/100 of the total range.

Example

min_value = -16;

max_value = 16;

small_increment = 1;

big_increment = 10;

Notes

The default value of min_value is 0; the minimum value is -2,147,483,648. The default value of max_value is 10000; the maximum value is 2,147,483,647.

Horizontal sliders increase in value from left to right; vertical sliders increase value from top to bottom.

Valid Tile

slider

See Also

Programming Overview of DCL

About Predefined Attributes


tabs = "string";

"Set up these tab stops."	DCL Predefined Attribute

This attribute specifies tab spacing, which is useful for creating vertical columns of text.

string: a string of real numbers or integers, each separated by a space.

Example

tabs = "5 10 15 20 25 30 35 40";

Valid Tiles

list_box

popup_list

See Also

Programming Overview of DCL

About Predefined Attributes


tab_truncate = flag;

"Cut off any text longer than the related tab stop."

This attribute specifies whether the text in a list_box or popup_list (drop-down list box) is truncated when it is longer than the related tab stop. Use this attribute to prevent text from going beyond the next tab stop.

flag: true or false (default).

Example

tab_truncate = true;

Valid Tiles

list_box

popup_list

See Also

Programming Overview of DCL

About Predefined Attributes


typeface = "string";

"Display text in this TrueType font."	DCL Predefined Attribute

This attribute specifies the name of the TrueType font to display throughout a dialog box. The font affects both text displayed by the dialog box and the text typed by the user.

string: name of a TrueType font.

The typeface attribute is unique to the implementation of DCL included with IntelliCAD®.

Example

typeface = "Arial";

NOTE Do not specify fonts on another system. The three TrueType fonts safest to use and available on almost all Windows systems are: Arial, Times New Roman, and Courier New.

Valid Tile

dialog

See Also

Programming Overview of DCL

About Predefined Attributes


upper_only = flag;

"Force input text to be upper-case."	DCL Predefined Attribute

When flag = true, this attribute converts user typed text to upper-case. When flag = false (the default), the text is not converted.

flag: true or false (default).

The upper_only attribute is unique to the implementation of DCL included with IntelliCAD®.

Example

upper_only = true;

Valid Tiles

edit_box

multi_edit_box

See Also

Programming Overview of DCL

About Predefined Attributes


value = "string";

"Specify the default value of a tile."	DCL Predefined Attribute

This attribute specifies the default value of a tile. The value depends on the type of tile.

string: a string; no default.

The following table summarizes the default value for each type of tile:

Tile Type	Default Value
boxed_radio_column	Key of the selected radio button.
boxed_radio_row	Key of the selected radio button.
dialog	Optional text for the dialog box's title bar.
edit_box	Default text seen by the user in the edit box.
image	Default image seen in the image box.
list_box	Lists items that are initially highlighted.
popup_list	Lists items that are initially highlighted.
radio_button	"1" = button is on; "0" = button is off.
radio_column	Key of the selected radio button.
radio_row	Key of the selected radio button.
slider	Default value of the slider.
text	Text displayed by the tile.
toggle	"1" = checked or on; "0" = unchecked or off.
Example

value = "1";

Valid Tiles

text

popup_list

edit_box

multi_edit_box

radio_button

slider

list_box

toggle

See Also

Programming Overview of DCL

About Predefined Attributes


width = number;

"Specify the width of a tile."	DCL Predefined Attribute

This attribute specifies the minimum width of a tile. The width is automatically changed by the program unless established by the fixed_width attribute.

In general, use the width attribute with the image and image_button tiles. For other tiles, do not use this attribute unless you need to improve the appearance of the dialog box.

number: any real number or integer in units of character width. The "character width unit" is the lessor of either:

the width of the screen divided by 80,

or, the average width of all uppercase and lowercase characters (A - Z, a - z).

Example

width = 40;

NOTE The aspect_ratio attribute is used with either the height or width attribute. Do not use the aspect_ratio attribute when using both height and width.

Valid Tiles

all tiles

See Also

Programming Overview of DCL

About Predefined Attributes


: boxed_column { ... }

"Place a border around a column of tiles, with an optional title."	DCL Cluster Tile

This cluster tile places a rectangular border around a column of tiles (except radio buttons). As an option, you can include a title for the column. The border appears with no title when the label attribute is missing or is a null string: label = "";

Notes

For a column of tiles without a border or title, use the column cluster.

To surround a column of radio buttons with a border, use the radio_button cluster.

Valid Attributes

: boxed_column {

alignment = position;

children_alignment = position;

children_fixed_height = flag;

children_fixed_width = flag;

fixed_height = flag;

fixed_width = flag;

height = number;

label = "string";

width = number;

}

Example

: boxed_column {

label = "Snap Setting";

width = 22;

}

Related DCL Tiles

dialog

column

row

boxed_row

boxed_radio_column

boxed_radio_row

radio_column

radio_row

See Also

Programming Overview of DCL

About Predefined Attributes


: boxed_radio_column { ... }

"Place a rectangle around a column of radio buttons, with an optional title."	DCL Cluster Tile

This cluster tile places a border around a column of radio buttons. When the label attribute is missing or a null string ("") is used, the border appears with no title.

Notes

For a column of radio buttons without a border or title, use the radio_column cluster.

To place a border around a column of other tiles, use the boxed_column cluster.

Valid Attributes

: boxed _radio_column {

alignment = position;

children_alignment = position;

children_fixed_height = flag;

children_fixed_width = flag;

fixed_height = flag;

fixed_width = flag;

height = number;

label = "string";

value = "string";

width = number;

}

Example

: boxed_radio_column {

label="Edit Object;

width=40;

: radio_button {

action = "(trimlsp)";

key = "R3";

label = "Trim";

}

: radio_button {

action = "(extendlsp)";

key = "R4";

label = "Extend";

}

}

NOTE The value attribute indicates which radio button is currently selected by default, via the value of "1":

value = "1"

Related DCL Tiles

dialog

column

row

boxed_column

boxed_row

boxed_radio_row

radio_column

radio_row

See Also

Programming Overview of DCL

About Predefined Attributes


: boxed_radio_row { ... }

"Place a rectangle around a row of radio buttons, with an optional title.	DCL Cluster Tile

This cluster tile places a border around a row of radio buttons. When the label attribute is missing or a null string ("") is used, the border appears without a title.

Notes

For a row of radio buttons without a border or title, use the radio_row cluster.

To place a border around a row of other (non-radio button) tiles, use the boxed_row cluster.

The value attribute indicates which radio button is currently selected by default, via the value of "1":

value = "1"

Valid Attributes

: boxed_radio_row {

alignment = position;

children_alignment = position;

children_fixed_height = flag;

children_fixed_width = flag;

fixed_height = flag;

fixed_width = flag;

height = number;

label = "string";

value = "string";

width = number;

}

Example

: boxed_radio_row {

    label="Edit Corner"

: radio_button {

action = "(chamferlsp)";

key = "R5";

label = "Chamfer";

}

: radio_button {

action = "(filletlsp)";

key = "R6";

label = "Fillet";

}

}

Related DCL Tiles

dialog

column

row

boxed_column

boxed_row

boxed_radio_column

radio_column

radio_row

See Also

Programming Overview of DCL

About Predefined Attributes


: boxed_row { ... }

"Place a rectangle around a row of tiles, with an optional title."	DCL Cluster Tile

This cluster tile places a border around a row of tiles (except radio buttons). The border appears without a title when the label attribute is missing or a null string ("") is used.

Notes

For a row of tiles without a border or title, use the row cluster.

To place a border around a row of radio buttons, use the boxed_radio_row cluster.

Valid Attributes

: boxed_row {

alignment = position;

children_alignment = flag;

children_fixed_height = flag;

children_fixed_width = flag;

fixed_height = flag;

fixed_width = flag;

height = number;

label = "string";

width = number;

}

Example

: boxed_row {

    label="Select Objects";

: button {

action = "(linelsp)";

key = "BB";

label = "Line";

}

: button {

action = "(circlelsp)";

key = "BW";

label = "Circle";

}

}

Related DCL Tiles

dialog

column

row

boxed_column

boxed_radio_column

boxed_radio_row

radio_column

radio_row

See Also

Programming Overview of DCL

About Predefined Attributes


: button { ... }

"Create a button with or without a label."	DCL Active Tile

This active tile creates a button, with or without a superimposed label. A button is generally used to exit a dialog box or to display another box ("tunneling dialog boxes"). Every dialog box must have at least one button, which is connected to the LISP function done_dialog; otherwise the program hangs.

: button {

action = "(done_dialog)";

label = "OK";

}

NOTE Several predefined tiles provide the most common button clusters, including the ok_only attribute, ok_cancel, and ok_cancel_help tiles.

Valid Attributes

: button {

action = "(string)";

alignment = position;

fixed_height = flag;

fixed_width = flag;

height = number;

is_cancel = flag;

is_default = flag;

is_enabled = flag;

is_tab_stop = flag;

key = "string";

label = "string";

mnemonic = "char";

width = number;

}

Example

: button {

action = "(convdxf)";

label="Convert to DXF";

mnemonic="C";

key="BC";

}

NOTE The label attribute indicates the text on the button—for example:

label = "Sync Grid to Snap"

Related DCL Tiles

edit_box

image_button

list_box

popup_list

radio_button

slider

toggle

See Also

Programming Overview of DCL

About Predefined Attributes


: column { ... }

"Position a column of tiles, with an optional title."	DCL Cluster Tile

This cluster tile positions a series of tiles in a vertical column without a border. The column cluster can hold any tile except a individual radio_button. To place a box around the column of tiles, use the boxed_column cluster.

Note: Columns do not have titles unless they are boxed.

Valid Attributes

: column {

alignment = position;

children_alignment = position;

children_fixed_height = flag;

children_fixed_width = flag;

fixed_height = flag;

fixed_width = flag;

height = number;

label = "string";

width = number;

}

Example

: column {

: button {

action = "(linecmd)";

key = "BL";

label = "Line";

}

: button {

action = "(arccmd)";

key = "BA";

label = "Arc";

}

}

Related DCL Tiles

dialog

row

boxed_column

boxed_row

boxed_radio_column

boxed_radio_row

radio_column

radio_row

See Also

Programming Overview of DCL

About Predefined Attributes


: concatenation { ... }

"Concatenate one or more text_part tiles."	DCL Text Tile

This text tile joins one or more text strings together. The strings are defined in the text_part tile, which places no margins around the text; however, a margin does exist around the entire concatenation.

NOTE By contrast, the paragraph cluster tile stacks text vertically.

Valid Attributes

none

Example

: concatenation {

text_part {label = "This";}

text_part {label = " is";}

text_part {label = " text.";}

}

Related DCL Tiles

paragraph

text

text_part

See Also

Programming Overview of DCL

About Predefined Attributes


name : dialog  { ... }

"Create a dialog box."	DCL Cluster Tile

This cluster tile defines a dialog box. The name prefix defines the case-sensitive name of the dialog box. This name is required to identify the dialog box within the DCL file.

To access the dialog box within LISP, use the load_dialog (to load the DCL file) and the new_dialog (to display the dialog box) functions, as in the following example:

(setq dlg (load_dialog "dclfile"))

(new_dialog "name" dlg)

NOTE When both the label and value attributes are defined, value takes precedence over label.

Valid Attributes

name : dialog {

initial_focus = "string";

label = "string";

pointsize = int;

typeface = "string";

value = "string";

}

Example

objext : dialog {

 initial_focus = "OK"

 label = "Object Extraction"

: boxed_row {

 	label="Select Objects";

: button {

action = "(linelsp)";

key = "BB";

label = "Line";

}

: button {

action = "(circlelsp)";

key = "BW";

label = "Circle";

}

}

}

Related DCL Tiles

column

row

boxed_column

boxed_row

boxed_radio_column

boxed_radio_row

radio_column

radio_row

See Also

Programming Overview of DCL

About Predefined Attributes


: edit_box { ... }

"Let the user type a line of text."	DCL Active Tile

This active tile displays an edit box tile that prompts the user to type a number or text. Text in the edit box is left-justified. The program appends the null character (\0) to the end of the string the user types. If an edit_limit is specified, and the specified character count is reached, all user entry other than backspace and delete are ignored.

Valid Attributes

: edit_box {

action = "(string)";

alignment = position;

allow_accept = flag;

edit_limit = int;

edit_width = number;

fixed_height = flag;

fixed_width = flag;

height = number;

is_enabled = flag;

is_tab_stop = flag;

lower_only = flag;

key = "string";

label = "string";

mnemonic = "char";

password_char = "char";

read_only = flag;

upper_only = flag;

value = "string";

width = number;

}

Example

: edit_box {

action = "(texted)";

allow_accept = true;

edit_limit = 31;

key = "EB";

label = "File name: ";

mnemonic = "F";

value = "drawing";

}

Notes

The label attribute defines the edit box's title; it is left-justified.

The value attribute holds the initial text displayed by the edit box; it is left-justified.

The following attributes are unique to the implementation of DCL included with IntelliCAD®: lower_only, read_only, and upper_only.

Related DCL Tiles

button

image_button

list_box

popup_list

radio_button

slider

toggle

See Also

Programming Overview of DCL

About Predefined Attributes


errtile;

"Display an error message at the bottom of a dialog box."	DCL Error Handler Tile

This error handler tile displays a brief error message at the bottom of a dialog box. You can display a message in an errtile by setting the value of the tile that has the key "error." The errtile tile is blank by default.

Notice that the format of this tile differs from most other tiles. There is no : (colon) prefix nor brace ({}) suffix.

Valid Attributes

none

Example

errtile;

Related DCL Tiles

ok_only

ok_cancel

ok_cancel_help

ok_cancel_help_errtile

ok_cancel_help_info

See Also

Programming Overview of DCL

About Predefined Attributes


: image { ... }

"Display an image."	DCL Decorator Tile

This decorator tile displays an image created by LISP or SDS functions that draw vector images. The image can consist of a solid color, an icon, or other images.

For this tile, you must specify both the height and width attributes, or specify the aspect_ratio attribute along with either height or width (but not with both attributes).

Valid Attributes

: image {

action = "(string)";

alignment = position;

aspect_ratio = real;

color = clr;

fixed_height = flag;

fixed_width = flag;

height = number;

is_enabled = flag;

is_tab_stop = flag;

key = "string";

label = "string";

mnemonic = "char";

value = "string";

width = number;

}

Example

: image {

    action = "(dimvars)";

    height = 24;

    key = "DB";

    width = 36;

}

Related DCL Tiles

image_button

space

spacer_0

spacer_1

See Also

Programming Overview of DCL

About Predefined Attributes


: image_button { ... }

"Display an image on a button."	DCL Active Tile

This active tile displays an image on a button. This function returns the x,y coordinates of the user’s pick point.

For this tile, you must specify both the height and width attributes, or specify the aspect_ratio attribute along with either height or width (but not with both attributes).

Valid Attributes

: image_button {

action = "(string)";

alignment = position;

allow_accept = flag;

aspect_ratio = real;

color = clr;

fixed_height = flag;

fixed_width = flag;

height = number;

is_enabled = flag;

is_tab_stop = flag;

key = "string";

label = "string";

mnemonic = "char";

width = number;

}

Example

: image_button {

aspect_ratio = 1.33;

height = 2;

action = "(fontlsp)";

key = "FN";

}

Related DCL Tiles

button

edit_box

list_box

popup_list

radio_button

slider

toggle

See Also

Programming Overview of DCL

About Predefined Attributes


: list_box { ... }

"Display a vertical list of text, with optional scrollbar and title."	DCL Active Tile

This active tile displays a list box. When the user selects an item, it is highlighted. A scroll bar appears automatically when there are more items than the list_box tile is able to display.

Creating and Modifying a List Box with LISP Functions

To create and modify the list displayed by the list_box tile, use these LISP functions:

(start_list "key" int1 int2)

The start_list function takes three arguments. The key argument identifies the name of the list_box tile. The int1 argument specifies the action to take:

int1	Meaning
1	Change one item in the list.
2	Add an item to the end of the list.
3	Create a new list; the default.
The int2 argument specifies the item # to change (the first item in the list is #0); int2 is only used when int1 is 1. For example:

(start_list "L1" 1 3	; changes the fourth item in the list.

(add_list "string")

To make the change, use the add_list function. The string argument specifies the text to be added or replaced in the list:

(start_list "L1" 1 3	; Changes the fourth item in the list.

(add_list "New item")

When start_list is in change mode (int1 = 1), each call to the add_list changes the same item. When start_list is in add mode (int1 = 2), each call to the add_list adds another item to the end of the list.

(end_list)

To end the list processing, call the end_list function as follows:

(start_list "L1" 1 3	; changes the fourth item in the list.

(add_list "New item")

(end_list)

NOTE There are no LISP functions for inserting an item in the middle of the list nor for deleting an item from the list.

Valid Attributes

: list_box {

action = "(string)";

allow_accept = flag;

alignment = position;

fixed_height = flag;

fixed_width = flag;

height = number;

is_enabled = flag;

is_tab_stop = flag;

key = "string";

label = "string";

list = "string";

mnemonic = "char";

multiple_select = flag;

tabs = "string";

value = "string";

width = number;

}

Example

: list_box {

action = "(subdir)";

label = "Select a color:";

list = "Red\nGreen\nBlue";

value = "0";

}

Notes

Use the \n (new-line) character within the list attribute to separate lines.

The label attribute displays the text above the list box.

The value attribute determines which items on the list are initially selected or highlighted. The attribute consists of a string of integers separated by spaces, as in the following:

value = "0 2 5";

The first item is #0. A null string "" means no items are highlighted. When the multiple_select attribute is false, the value attribute must contain a single integer.

Related DCL Tiles

button

edit_box

image_button

popup_list

radio_button

slider

toggle

See Also

Programming Overview of DCL

About Predefined Attributes


: multi_edit_box { ... }

"Display an edit box with more than one line."	DCL Active Tile

This active tile displays a multiline edit box tile, which allows the user to type additional lines of text. Text in the multi_edit_box tile is left-justified. The program appends the null character (\0) to the end of the string.

The multi_edit_box tile is unique to the implementation of DCL included with IntelliCAD®.

Valid Attributes

: multi_edit_box {

action = "(string)";

alignment = position;

allow_accept = flag;

edit_limit = int;

edit_width = number;

fixed_height = flag;

fixed_width = flag;

height = number;

is_enabled = flag;

is_tab_stop = flag;

lower_only = flag;

key = "string";

label = "string";

mnemonic = "char";

password_char = "char";

read_only = flag;

upper_only = flag;

value = "string";

width = number;

}

Example

: multi_edit_box {

action = "(texted)";

edit_limit = 40;

key = "EB";

label = "Type text: ";

mnemonic = "T";

}

Notes

The label attribute is the multiline edit box's title; it is left-justified.

The value attribute holds the initial text displayed by the multiline edit box; is left-justified.

The following attributes are unique to the implementation of DCL included with IntelliCAD®: lower_only, read_only, and upper_only.

Related DCL Tiles

button

image_button

list_box

popup_list

radio_button

slider

toggle

See Also

Programming Overview of DCL

About Predefined Attributes


ok_only;

"Display an OK button."	DCL Error Handler Tile

This error handler tile displays a button with the OK label. This tile has a pre-assigned key of "accept." This tile is most useful when displaying a message or alert that doesn't offer alternative actions. The user clicks the button to confirm having read the message or alert and to close the dialog box.

Notice that the format of this tile differs from most other tiles: there is no : (colon) prefix nor { … } (brace) suffix.

NOTE For most dialog boxes, you'll want to use the ok_cancel tile instead of this tile.

Valid Attributes

none

Example

ok_only;

Related DCL Tiles

errtile

ok_cancel

ok_cancel_help

ok_cancel_help_errtile

ok_cancel_help_info

See Also

Programming Overview of DCL

About Predefined Attributes


ok_cancel;

"Display OK and Cancel buttons."	DCL Error Handler Tile

This error handler tile displays the OK and Cancel buttons.

Notice that the format of this tile differs from most other tiles: there is no : (colon) prefix nor { … } (brace) suffix.

The program pre-assigns a key to each button, as follows:

Button	Key
OK	"accept"
Cancel	"cancel"
NOTE To display only the OK button in a dialog box (for example, in a message or alert box), use the ok_only.

Valid Attributes

none

Example

ok_cancel;

Related DCL Tiles

errtile

ok_only

ok_cancel_help

ok_cancel_help_errtile

ok_cancel_help_info

See Also

Programming Overview of DCL

About Predefined Attributes


ok_cancel_help;

"Display the OK, Cancel, and Help buttons."	DCL Error Handler Tile

This error handler tile displays the OK, Cancel, and Help buttons. It is useful to have the Help button call the LISP help function.

Notice that the format of this tile differs from most other tiles: there is no : (colon) prefix nor { … } (brace) suffix.

The program pre-assigns a key to each button, as follows:

Button	Key
OK	"accept"
Cancel	"cancel"
Help	"help"
Valid Attributes

none

Example

ok_cancel_help;

Related DCL Tiles

errtile

ok_only

ok_cancel

ok_cancel_help_errtile

ok_cancel_help_info

See Also

Programming Overview of DCL

About Predefined Attributes

sds_help


ok_cancel_help_errtile;

"Display the OK, Cancel, and Help buttons, plus an error message."	DCL Error Handler Tile

This error handler tile displays the OK, Cancel, and Help buttons, along with an error message (if necessary) at the bottom of a dialog box. It is useful to have the Help button call the LISP help function.

Notice that the format of this tile differs from most other tiles: there is no : (colon) prefix nor { … } (brace) suffix.

The program pre-assigns a key to each button, as follows:

Button	Key
OK	"accept"
Cancel	"cancel"
Help	"help"
errtile	"error"
Valid Attributes

none

Example

ok_cancel_help_errtile;

Related DCL Tiles

errtile

ok_only

ok_cancel

ok_cancel_help

ok_cancel_help_info

See Also

Programming Overview of DCL

About Predefined Attributes

sds_help


ok_cancel_help_info;

"Display the OK, Cancel, Help, and Info buttons."	DCL Error Handler Tile

This error handler tile displays the OK, Cancel, Help, and Info buttons. You can use the Info button to display a dialog box with additional information for the user. It is useful to have the Help button call the LISP help function.

Notice that the format of this tile differs from most other tiles: there is no : (colon) prefix nor { … } (brace) suffix.

The program pre-assigns a key to each button, as follows:

Button	key
OK	"accept"
Cancel	"cancel"
Help	"help"
Info	"info"
Valid Attributes

none

Example

ok_cancel_help_info;

Related DCL Tiles

errtile

ok_only

ok_cancel

ok_cancel_help

ok_cancel_help_errtile

See Also

Programming Overview of DCL

About Predefined Attributes

sds_help


: paragraph { ... }

"Display a vertical cluster of text."	DCL Cluster Tile

This cluster tile stacks text vertically and adds a margin around itself. Note that this is in contrast to the concatenation tile, which "stacks" text horizontally.

Valid Attributes

none

Example

: paragraph {

text_part { label = "This text is above";}

text_part { label = "this lower text.";}

}

Related DCL Tiles

concatenation

text

text_part

See Also

Programming Overview of DCL

About Predefined Attributes


: popup_list { ... }

"Display a drop-down list."	DCL Active Tile

This active tile displays a drop-down list box. Contrary to its name, the popup_list drops down, not up.

The popup_list tile first appears as a single line, and more of the list appears when the user clicks the down-arrow. If necessary, the dropped down list also includes This tile is useful when dialog box space is limited.

NOTE By contrast, a list_box tile displays at least two lines of a list by default, along with vertical scrollbars, if necessary. Also, a list_box can permit multiple selections, which a popup_list does not permit.

Creating and Modifying a Pop-up List with LISP Functions

To create and modify the list displayed by the popup_list tile, use these LISP functions:

(start_list "key"  int1 int2)

The start_list function takes three arguments. The key argument identifies the name of the popup_list tile. The int1 argument specifies the action to take:

int1	Meaning
1	Change one item in the list.
2	Add an item to the end of the list.
3	Create a new list; the default.
The int2 argument specifies the item # to change (the first item in the list is #0); int2 is only used when int1 is 1. For example:

(start_list "L1" 1 3	; changes the fourth item in the list.

(add_list "string")

To make the change, use the add_list function. The string argument specifies the text that will be added or replaced in the list:

(start_list "L1" 1 3	; Changes the fourth item in the list.

(add_list "New item")

When start_list is in change mode (int1 = 1), each call to add_list changes the same item. When start_list is in add mode (int1 = 2), each call to add_list adds another item to the end of the list.

(end_list)

To end the list processing, call the end_list function, as follows:

(start_list "L1" 1 3	; changes the fourth item in the list.

(add_list "New item")

(end_list)

NOTE There are no LISP functions for inserting an item in the middle of the list nor for deleting an item from the list.

Valid Attributes

: popup_list {

action = "(string)";

alignment = position;

edit_width = number;

fixed_height = flag;

fixed_width = flag;

height = number;

is_enabled = flag;

is_tab_stop = flag;

key = "string";

label = "string";

list = "string";

mnemonic = "char";

tabs = "string";

value = "string";

width = number;

}

Example

: popup_list {

action = "(patternlsp)";

edit_width = 0;

key = "PL2";

value = "Closed\nFilled\nOpen";

list = "2";

}

Notes

The label attribute displays the text to the left of the popup list box.

The value attribute determines which items on the list are initially selected or highlighted. The attribute consists of a string of integers separated by spaces, such as:

value = "0 2 5";

The first item is #0. A null string "" means no items are highlighted.

Related DCL Tiles

button

edit_box

image_button

list_box

radio_button

slider

toggle

See Also

Programming Overview of DCL

About Predefined Attributes


: radio_button { ... }

"Display a radio button."	DCL Active Tile

This active tile displays a radio button. A dot appears when the radio button is turned on or selected. The special character of the radio button signifies that the user can select only one radio button at a time; when one radio button is selected, any other radio button (in the same cluster) is turned off.

A radio_button tile must be placed within a radio_column or radio_row cluster tile. Otherwise, The program does not know which radio buttons are related to each other.

If you want to allow the user to select more than one option, use check boxes (via the toggle tile) instead.

NOTE When you write a DCL file that has more than one radio button in a radio_column or radio_row cluster turned on (value = "1"), the program ignores all "turned-on" radio buttons after the first one.

Valid Attributes

: radio_button {

action = "(string)";

alignment = position;

fixed_height = flag;

fixed_width = flag;

height = number;

is_enabled = flag;

is_tab_stop = flag;

key = "string";

label = "string";

mnemonic = "char";

value = "string";

width = number;

}

Example

: radio_button {

    action = "(parent)";

    key = "R21";

    label = "Parent";

}

NOTE The value attribute indicates which radio button is currently selected, via the value of "1":

value = "1"

Related DCL Tiles

button

edit_box

image_button

list_box

popup_list

slider

toggle

See Also

Programming Overview of DCL

About Predefined Attributes


: radio_column { ... }

"Display a vertical column of radio buttons."	DCL Cluster Tile

This cluster tile groups together one or more radio buttons in a vertical column. A radio_button tile must be placed either within this tile or within a radio_row cluster tile. Otherwise, the program does not know which radio buttons are related to each other.

NOTE A radio_column cluster can only contain radio buttons. Use the column cluster for other tiles.

Valid Attributes

: radio_column {

alignment = position;

children_alignment = position;

children_fixed_height = flag;

children_fixed_width = flag;

fixed_height = flag;

fixed_width = flag;

height = number;

label = "string";

value = "string";

width = number;

}

Example

: radio_column {

label = "3D Viewpoints";

: radio_button {

action = "(frontview)";

key = "R1";

label = "Front View";

}

: radio_button {

action = "(topview)";

key = "R2";

label = "Top View";

}

}

NOTE The value attribute indicates which radio button is currently selected, via the value of "1":

value = "1"

Related DCL Tiles

dialog

column

row

boxed_column

boxed_row

boxed_radio_column

boxed_radio_row

radio_column

radio_row

See Also

Programming Overview of DCL

About Predefined Attributes


: radio_row { ... }

"Display a row of radio buttons."	DCL Cluster Tile

This cluster tile groups one or more radio buttons in a horizontal row. A radio_button tile must be placed either within this tile or within a radio_column cluster tile. Otherwise, the program does not know which radio buttons are related to each other.

NOTE A radio_row cluster can only contain radio buttons. Use the row cluster for other tiles.

Valid Attributes

: radio_row {

alignment = position;

children_alignment = position;

children_fixed_height = flag;

children_fixed_width = flag;

fixed_height = flag;

fixed_width = flag;

height = number;

label = "string";

width = number;

}

Example

: radio_row {

label = "3D Viewpoints";

: radio_button {

action = "(leftview)";

key = "R11";

label = "Left View";

}

: radio_button {

action = "(riteview)";

key = "R22";

label = "Right View";

}

}

NOTE The value attribute indicates which radio button is currently selected, via the value of "1":

value = "1"

Related DCL Tiles

dialog

column

row

boxed_column

boxed_row

boxed_radio_column

boxed_radio_row

radio_column

radio_row

See Also

Programming Overview of DCL

About Predefined Attributes


: row { ... }

"Display a row of horizontal tiles."	DCL Cluster Tile

This cluster tile positions a series of tiles in a horizontal row without a border. The row cluster can hold any tile except an individual radio_button (use the radio_column or radio_row cluster tiles to group radio buttons).

NOTE To place a box around the column of tiles, use the boxed_row cluster.

Valid Attributes

: row {

alignment = position;

children_alignment = position;

children_fixed_height = flag;

children_fixed_width = flag;

fixed_height = flag;

fixed_width = flag;

height = number;

label = "string";

width = number;

}

Example

: row {

: button {

action = "(zoomcmd)";

key = "BZ";

label = "Zoom";

}

: button {

action = "(pancmd)";

key = "BP";

label = "Pan";

}

}

Related DCL Tiles

dialog

column

row

boxed_column

boxed_row

boxed_radio_column

boxed_radio_row

radio_column

radio_row

See Also

Programming Overview of DCL

About Predefined Attributes


: slider { ... }

"Display a horizontal or vertical slider."	DCL Active Tile

This active tile displays a slider bar, which can be horizontal or vertical. The slider moves faster or slower depending on where the user clicks.

Valid Attributes

: slider {

action = "(string)";

alignment = position;

big_increment = int;

fixed_height = flag;

fixed_width = flag;

height = number;

key = "string";

label = "string";

layout = position'

max_value = int;

min_value = int;

mnemonic = "char";

small_increment = int;

value = "string";

width = number;

}

Example

: slider {

action = "(slider)";

big_increment = 32;

key = "S1";

max_value = 512;

min_value = 0;

small_increment = "1";

value = "16";

}

NOTE The value attribute indicates the default value of the slider bar; the default is min_value.

Related DCL Tiles

button

edit_box

image_button

list_box

popup_list

radio_button

toggle

See Also

Programming Overview of DCL

About Predefined Attributes


: spacer { ... }

"Insert a blank tile."	DCL Decorator Tile

This decorator tile places a blank area in a dialog box. While you can use spacer to help position other tiles, this tile is usually not necessary since the program normally positions all tiles automatically with appropriate spacing.

Valid Attributes

: spacer {

alignment = position;

fixed_height = flag;

fixed_width = flag;

height = number;

width = number;

}

Example

: spacer {

height = "5";

width = "10";

}

Related DCL Tiles

spacer_0

spacer_1

See Also

Programming Overview of DCL

About Predefined Attributes


spacer_0;

"Insert a blank tile that grows dynamically."	DCL Decorator Tile

This decorator tile creates a blank tile that changes size. The spacer_0 tile is useful for deliberately creating an extra distance between two tiles, such as a pair of buttons. This function tells the program where to put extra space.

Notice that the format of this tile differs from most other tiles: there is no : (colon) prefix nor { … } (brace) suffix.

Valid Attributes

none

Example

spacer_0;

Related DCL Tiles

spacer

spacer_1

See Also

Programming Overview of DCL

About Predefined Attributes


spacer_1;

"Insert a unit blank tile with width and height of 1."	DCL Decorator Tile

This decorator tile inserts a blank tile with the height and width attributes preset to 1.

Notice that the format of this tile differs from most other tiles: there is no : (colon) prefix nor { … } (brace) suffix.

Valid Attributes

none

Example

spacer_1;

Related DCL Tiles

spacer

spacer_0

See Also

Programming Overview of DCL

About Predefined Attributes


: text { ... }

"Display a string of text."	DCL Text Tile

This text tile displays a string of text. Use the text tile together with the concatenation and paragraph clusters to create horizontal and vertical stacks of text, respectively.

NOTE Most tiles have their own title (via the label attribute), so this function is rarely used.

Valid Attributes

: text {

alignment = position;

fixed_height = flag;

fixed_width = flag;

height = number;

is_bold = flag;

key = "string";

label = "string";

value = "string";

width = number;

}

Example

: text {

    key = "T12";

    label = "How to use IntelliCAD:";

}

Related DCL Tiles

concatenation

paragraph

text_part

See Also

Programming Overview of DCL

About Predefined Attributes


: text_part { ... }

"Display multiple segments of text."	DCL Text Tile

This text tile is used together with the concatenation and paragraph tiles to display several segments of text.

Valid Attribute

: text_part {

label = "string";

}

Example

: concatenation {

text_part {label = "This";}

text_part {label = " is";}

text_part {label = " text.";}

}

Related DCL Tiles

concatenation

paragraph

text

See Also

Programming Overview of DCL

About Predefined Attributes


: toggle { ... }

"Display a check box."	DCL Active Tile

This active tile displays a check box. When turned on, the check box contains a check mark and the value attribute returns 1. The text for the associated label attribute appears to the right of the box.

Valid Attributes

: toggle {

action = "(string)";

alignment = position;

fixed_height = flag;

fixed_width = flag;

height = number;

is_enabled = flag;

is_tab_stop = flag;

label = "string";

value = "string";

width = "string";

}

Example

: toggle {

    action = "(osnap)";

    label = "Object Snap Mode";

    value = "1"

}

NOTE The value attribute indicates whether the check box is currently selected (indicated by a check mark), via the value of "1":

value = "1"

Related DCL Tiles

button

edit_box

image_button

list_box

popup_list

radio_button

slider

See Also

Programming Overview of DCL

About Predefined Attributes


Copying Code Examples from the IntelliCAD Programmer's Reference
Copying Code Examples from the IntelliCAD® Programmer's Reference

Most of the Help topics in the IntelliCAD Programmer's Reference contain code examples. You can easily copy these examples into your own code and then further modify them, as desired.

To copy a code example from the Programmer's Reference:

1.	In the Help window, highlight the code you want to copy.

2.	In the Help window, choose Edit | Copy. (Or, press Ctrl + C.)

3.	Paste the code into your programming enviroment, using the appropriate command (usually Edit | Paste, or Ctrl + V).

4.	Delete the copyright notice that is pasted in along with the sample code.

5.	Modify the code, as necessary.

See Also

Programming Overview of LISP

Programming Overview of DCL

Programming Overview of SDS


In DCL, the term attribute refers to a characteristic of a tile, such as its color, associated action, or label.


The children of a cluster (a group of tiles) are the individual dialog box elements within the grouping—for example, the individual radio buttons within a cluster.


 A cluster tile is a group of tiles, such as a group of radio button or a group of check boxes.


LISP is an acronym for LISt Processing, a separate programming language that provides hooks into the IntelliCAD® program for customization and similar to AutoLISP®, a program that provides hooks into other CAD systems.

For more information, see the LISP Programming Language Reference.


 A tile is a dialog box element such as a button, an image, or a piece of text.

For more information, see the DCL Programming Reference.


Programming Overview of SDS (Solutions Development System)
Programming Overview of SDS™ (Solutions Development System™)

SDS is an acronym for Solutions Development System, a C/C++ language interface compatible with the ADS® (AutoCAD® Development System) interface found in other CAD systems. SDS provides hooks into IntelliCAD®, allowing you to create custom applications.

SDS communicates with the user and IntelliCAD via LISP (akin to the way that ADS works with AutoLISP® and other CAD systems). However, SDS greatly augments the capabilities found in LISP with a much more powerful command base that can also access the operating system. This allows you to create even more sophisticated custom solutions. And, because SDS applications are compiled, they are typically faster than LISP applications.

Prefixes to SDS Functions

If you're familiar with ADS, note that one primary difference between ADS and SDS is that most SDS functions have an sds_ prefix (except for special dialog-related SDS functions, which have the dlg_ prefix), whereas ADS functions have a variety of prefixes, such as ads_, acad_, and acrx_.

Functions Unique to SDS

SDS offers several additional capabilities beyond those available in ADS. The following table summarizes functions unique to SDS:

Function	Description
sds_grclear	Clears all graphics from the drawing window; similar to the LISP grclear function.
sds_name_clear	Clears the entity name or selection set.
sds_name_equal	Checks if two entity names or selection sets are equal.
sds_name_nil	Checks if the entity name or selection set has been cleared.
sds_name_set	Copies one entity name or selection set to another.
sds_pmtssget	Similar to the ssget function, but allows you to display a prompt appropriate for the specific command, rather than the generic "Select object:" prompt.
sds_point_set	Copies a point from one variable to another.
sds_progresspercent	Displays the percentage done in a progress bar.
sds_progressstart	Starts the progress bar.
sds_progressstop	Ends the progress bar.
sds_readaliasfile	Loads the PGP file into IntelliCAD.
sds_sendmessage	Sends a message to the IntelliCAD command line.
sds_swapscreen	Flips the off-screen device context to the display.
ADS Functions Not Supported by SDS

The following ADS functions are not supported by SDS: ads_arxload, ads_arxloaded, ads_arxunload, all ads_dict-related functions, ads__msize, ads_namedobjdict, ads_regappx, ads_ssgetx, ads_ssnamex, ads_tablet,  ads_xstrcase, ads_xstrsave, ads_ssGetKwordCallbackPtr, ads_ssGetOtherCallbackPtr, adsw_acadMainWnd, and adsw_acadDocWnd.

Selection Modes

IntelliCAD supports the following selection modes:

Mode	Meaning
NULL	(none) Single pick point
"B"	Box
"C"	Crossing
"CC"	Crossing Circle
"CP"	Crossing Polygon
"F"	Fence
"I"	Implied
"L"	Last
"O"	Outside
"OC"	Outside Circle
"OP"	Outside Polygon
"P"	Previous
"PO"	POint
"W"	Window
"WC"	Window Circle
"WP"	Window Polygon
"X"	All
Selection Modes Not Supported by IntelliCAD

IntelliCAD does not support the following selection modes found in other CAD systems: "G", ":$", ":?", ":D", ":E", ":K", ":N", ":S", ".", "#", "A", and "M" nor the Boolean operators <NOT>, <OR>, and <AND>.

SDS Return Codes

SDS functions return these request type codes:

Request	Code	Meaning
RSRSLT	1	Result is returned.
RSERR	3	Error in evaluation; no result is returned.
RQSAVE	14	IntelliCAD is saving the drawing.
RQEND	15	IntelliCAD is exiting.
RQQUIT	16	IntelliCAD is quitting.
RQCFG	22	IntelliCAD is returning from the Config command.
RQXLOAD	100	Load external functions.
RQXUNLD	101	Unload the application.
RQSUBR	102	External subroutine request.
RQHUP	105	IntelliCAD is disconnected from the application.
RQXHELP	118	Define help for the function.
RTERROR	-5001	An error has occurred.
RTCAN	-5002	User canceled the command by pressing Esc.
RTREJ	-5003	IntelliCAD rejected the request, probably due to invalid format.
RTFAIL	-5004	Link failure between SDS and IntelliCAD.
RTKWORD	-5005	Keyword returned from getxxx routine.
RTNORM	5100	Request succeeded.

Result buffer codes

RTNONE	5000	No result.
RTREAL	5001	Real number.
RTPOINT	5002	2-D point (x,y-coordinate).
RTSHORT	5003	Short integer.
RTANG	5004	Angle.
RTSTR	5005	String.
RTENAME	5006	Entity name.
RTPICKS	5007	Pick set.
RTORINT	5008	Orientation.
RT3DPOINT	5009	3-D point (x,y,z coordinate).
RTLONG	5010	Long integer.
RTVOID	5014	Blank symbol.
RTLB	5016	Begin list.
RTLE	5017	End of list.
RTDOTE	5018	Dotted pair.
RTNIL	5019	nil
RTDXF0	5020	DXF code 0 (used only by sds_buildlist).
RTT	5021	T (true) atom.
RTRESBUF	5023	Result buffer.
See Also

Copying Code Examples from the IntelliCAD Programmer's Reference


sds_abort
void sds_abort (const char *string);

"Close the SDS™ application and notify user."	SDS Function

This function ends an SDS application running under IntelliCAD®. Before closing, it prints to the command line the name of the application and a message displaying the reason for closing. The argument *string is the text to be written to the command line after the name of the application.

This function has no value to return.

Example

sds_abort(" has experienced a problem, and will be terminated.");

Prints:

Myapp has experienced a problem, and will be terminated.

See Also

sds_exit

sds_fail

sds_alert

Programming Overview of SDS


DLG_action_tile
int dlg_action_tile (sds_hdlg handle, char *key, void *expression);

"Respond when the user clicks a dialog box tile."	SDS Function

This function assigns the expression to evaluate when the user selects the tile referenced by key.

The key argument refers to the tile. (In this case, the tile is a user-selectable element of a dialog box, such as radio button, check box, or button.)

The handle argument is the name of the dialog box.

The expression is a pointer to a function called when the tile is selected:

Argument	Meaning
$value	Current value.
$key	Tile name.
$data	Application specific data.
$reason	Callback reason.
$x	Image x-coordinate.
$y	Image y-coordinate.
The function returns RTNORM if successful; otherwise, it returns an error code.

NOTE The expression assigned by dlg_action_tile overrules the default action of the dialog box (which is assigned by the dlg_new_dialog function) and the tile's action attribute.

See Also

dlg_client_data_tile

dlg_new_dialog

Programming Overview of SDS

Programming Overview of DCL


DLG_add_list
int dlg_add_list (char *string);

"Add text to an existing dialog box string."	SDS Function

This function adds (or replaces) a string in the list of the currently active dialog box. This function must follow the dlg_start_list function, which determines: (1) which string is affected; and (2) whether the string is added or replaces another string.

See Also

dlg_start_list


sds_alert
int sds_alert (const char *string);

"Display an alert or message for the user."	SDS Function

This function displays a dialog box containing the string. This provides information to the user and includes only the OK button. The argument *string is the text to be displayed in the small dialog box. This string may contain new-line characters ("\n") to present the text more clearly.

The function returns RTNORM if successful; otherwise, it returns an errorcode.

Example

char string1[512];

strncpy(string1,"A point is needed.\n\n Please try again.",

  sizeof(string1)-1);

sds_alert(string1);

Shows a dialog box with this message:

A point is needed.

Please try again.

See Also

sds_fail

dlg_action_tile

dlg_client_data_tile

dlg_dimension_tile

dlg_done_dialog

dlg_done_positioned_dialog

dlg_end_image

dlg_end_list

dlg_fill_image

dlg_get_attr

dlg_get_attr_string

dlg_get_tile

dlg_load_dialog

dlg_mode_tile

dlg_new_dialog

dlg_new_dialog_positioned

dlg_set_tile

dlg_slide_image

dlg_start_dialog

dlg_start_image

dlg_start_list

dlg_term_dialog

dlg_unload_dialog

Programming Overview of SDS


sds_angle
double sds_angle (const sds_point point1, const sds_point point2);

"Determine the angle given by these points."	SDS Function

This function returns the angle between point1 and point2 in the current UCS. The first point determines the line parallel to the x-axis. When point1 is plotted and connected to point2, the resultant angle is returned, in radians.

This function returns the angle, a real number, in radians.

Example

sds_real returnr;

sds_point firstpt,secondpt;

sds_getpoint(NULL,"\nFirst point for angle: ",firstpt);

sds_getpoint(firstpt,"\nSecond point: ",secondpt);

returnr=sds_angle(firstpt,secondpt);

sds_printf("\nThe angle is %f radians",returnr);

Prints:

First point for angle:	pick point 1,1

Second point:	pick second point 3,3

The angle is 0.7854 radians.

See Also

sds_getangle

Programming Overview of SDS


sds_angtof
double sds_angtof (const char *sangle, int format, double *rangle);

"Change this angle to a real number."	SDS Function

This function converts a string, expressing an angle in one of the formats described below, to a real number expressing the angle in radians. The argument *sangle represents the given angle, in the chosen format. The argument format represents the type of string from which sds_angtof will convert the given number.

The following formats are available:

Format	Description	Example
format=0;	Degrees	360d
format=1;	Deg/Min/Sec	47d29'15"
format=2;	Grads	132g
format=3;	Radians	6.28r
format=4;	Surveyor's Units	N 82d W
The last argument, *rangle, represents the angle, expressed in radians.

This function returns RTNORM or an error code.

Example

int format=0;

sds_real real1;

char string1[512];

sds_getstring(0,"\nEnter an angle in decimal degrees (eg. 47.5): ",string1);

sds_angtof(string1,format,&real1);

sds_printf("\nThat's equal to %f radians. ",real1);

Prints:

Enter an angle in decimal degrees (eg. 47.5): 90

That’s equal to 1.5708 radians.

See Also

sds_angtos

sds_angle

sds_getangle

sds_rtos

Programming Overview of SDS


sds_angtos
int sds_angtos (double rangle, int format, int places, char *sangle);

"Change this angle to a string."	SDS Function

This function converts the angle rangle in radians to a string, known as *sangle. This is similar to the sds_rtos function, but sds_angtos converts angles (rather than numbers) to strings.

The format argument represents the type of string to which sds_angtos  will convert the given number. The following formats are available:

Format Code	Meaning	Example
0	Degrees	360d
1	Deg/Min/Sec	47d29'15"
2	Grads	132g
3	Radians	6.28r
4	Surveyor's Units	N 82d W
The argument places represents the number of decimal places to which the angle in the string is displayed. To default to the current level of precision (as defined by system variable LUPREC), use -1.

The argument *sangle represents the given angle, converted to a string, according to format and number of decimal places.

This function returns RTNORM or an error code.

Example

int format=0;

sds_real real1;

char string1[512];

sds_getreal("\nEnter radians to be converted to degrees: ",&real1);

sds_angtos(real1,format,-1,string1);

sds_printf("\n%f radians equals %s degrees. ",real1,string1);

Prints:

Enter radians to be converted to degrees: 1.570796

1.570796 radians equals 90 degrees.

See Also

sds_angtof

sds_angle

sds_getangle

sds_rtos

Programming Overview of SDS


sds_buildlist
struct sds_resbuf *sds_buildlist (int rtype, ...);

"Create a linked list of these items."	SDS Function

This function creates a linked list of types and values entered as argument pairs. The rtype argument consists of pairs. The first half of the pair describes the "type" of data to follow; the second half of the pair contains the data.

The type is either an RTxxx code (listed below) or a DXF group code:

Type	Meaning
RTNONE	No result.
RTREAL	Real number.
RTPOINT	2D point (x,y-coordinate).
RTSHORT	Short integer.
RTANG	Angle.
RTSTR	String.
RTENAME	Entity name.
RTPICKS	Pick set.
RTORINT	Orientation.
RT3DPOINT	3D point (x,y,z coordinate).
RTLONG	Long integer.
RTVOID	Blank symbol.
RTNIL	Nil.
RTDXF0	DXF code 0.
RTT	The T (true) atom.
RTRESBUF	Result buffer list.

The following types are not paired:

RTLB	Begin list.
RTLE	End of list.
RTDOTE	Dotted pair list.
RTNONE	End of list.
When DXF group codes are used, group 0 must be represented by the result type code RTDXF0. Otherwise, sds_buildlist will think the list has been terminated.

There are four exceptions to the paired-data rule: the -3 code, which indicates the start of extended entity data; the rtlb (begin list); rtle (end list); and rtdote (dotted pair list).

Arguments in the sds_buildlist function are paired: …,TYPE,value,…. Each pair consists of the argument type (such as RTREAL or RTSTR), followed by the value for that item in the list (for example 99.94 or "Einstein"). You may use any number of argument pairs.

The last argument is not a pair and must be 0 (zero) or RTNONE.

When you are done with the list, you must free the list using sds_relrb.

This function returns a pointer to the list; if it is not able to, it returns a NULL pointer. Failure can be due to bad arguments in the list or to a lack of memory.

Example

struct sds_resbuf *listbuf = NULL;

listbuf=sds_buildlist(RTREAL,3.57,RTSHORT,12,RTSTR,"My Cat",RTNONE);

sds_retlist(listbuf);

if(listbuf != NULL)

sds_relrb(listbuf);

Prints:

(3.57 12 "My Cat")

See Also

sds_retlist

Programming Overview of SDS


sds_calloc
void* sds_calloc (size_t howmany, size_t size);

"Allocate memory for an array."	SDS Function

This function allocates sufficient memory for an array. The array contains howmany elements, each element taking up size bytes of memory.

This function returns a pointer to the first element of the array in memory.

See Also

Programming Overview of SDS


DLG_client_data_tile
int dlg_client_data_tile (sds_hdlg handle, char *key, void *data);

"Associate data with a dialog box tile."	SDS Function

This function associates user-defined data with a dialog box tile.

The handle argument is the name of the dialog box.

The key argument specifies the tile.

The data argument specifies the data via callbacks.

This function returns RTNORM or an error code.

See Also

dlg_action_tile

dlg_get_attr

dlg_get_tile

dlg_mode_tile

dlg_set_tile

Programming Overview of SDS


sds_cmd
int sds_cmd (const struct sds_resbuf *cmdlist);

“Execute an IntelliCAD® command.”	SDS Function

This function executes one or more IntelliCAD commands. It supplies the input for an IntelliCAD command from a linked list, as if it were being entered at the command line.

The portion const struct sds_resbuf *cmdlist represents a linked list that includes all the input required to complete the given command(s).

This function returns one of the following: RTNORM (the function executed normally), RTCAN (the user canceled the command), RTREJ (the command sequence was rejected by IntelliCAD), or RTERROR (some other error).

Example

struct sds_resbuf *listbuf;

sds_point point1 = {2.0, 2.0};

sds_point point2 = {3.0, 3.0};

listbuf=sds_buildlist(RTSTR,"circle",RTPOINT,point1,RTPOINT,point2,RTNONE;

sds_cmd(listbuf);             Draws a circle given points as variables.

sds_relrb(listbuf);           Releases the result buffer.

listbuf=sds_buildlist(RTSTR,"circle",RTSTR,"5,2",RTSTR,"6,3",RTNONE);

sds_cmd(listbuf);             Draws a circle given points as strings.

sds_relrb(listbuf);           Releases the result buffer.

See Also

sds_command

sds_buildlist

Programming Overview of SDS


sds_command
int sds_command (int rtype, ...);

"Execute this IntelliCAD® command."	SDS Function

This function allows you to use any IntelliCAD command in an SDS program. Any following arguments will be used for that command. Each argument has two parts. As in public speaking, you tell the SDS program what you are going to tell it, and then tell it just that.

For example, to use the Line command, you need to tell the SDS program the command name, which is a string (RTSTR), "line". So far we have:

sds_command(RTSTR,"line", ...

That gets us into the Line command. Now we need to provide the information that the Line command requests, which is (at least) two 3-D points (RT3DPOINT). These are written:

…RT3DPOINT,point1,RT3DPOINT,point2…

To end the Line command, enter another string, empty this time. To end the sds_command function enter RTNONE or 0 (zero).

To summarize, a complete line command from sds_command would look like this:

sds_command(RTSTR,"line",RT3DPOINT,point1,RT3DPOINT,point2,RTSTR,"",RTNONE);

For the argument int rtype, any of the result types (RTxxx) are allowed. In each case, they are written as pairs, with the result types followed by the appropriate inputs, or variable names of the matching types, all separated by commas.

This function returns one of the following: RTNORM (the function executed normally), RTCAN (the user canceled the command), RTREJ (the command sequence was rejected by IntelliCAD), or RTERROR (some other error).

Example

sds_point point1,point2;

sds_getpoint(NULL,"\nFirst point for a line: ",point1);

sds_getpoint(point1,"\nSecond point: ",point2);

sds_command(RTSTR,"line",RT3DPOINT,point1,RT3DPOINT,point2,RTSTR,"",RTNONE);

See Also

sds_cmd

Programming Overview of SDS


sds_cvunit
int sds_cvunit (double oldreal, const char *before, const char *after, double *newreal);

"Convert these units to those units."	SDS Function

This function performs a conversion of units. Given a number representing a value in before units (eg.:  3 feet), sds_cvunit converts the number to an equivalent value, expressed in after units (eg.:  36 inches).

The before and after units must be of the same type, such as units of length, or units of time. Sds_cvunit will not, for example, convert furlongs to fortnights.

Commonly used units and conversion factors are stored in the ICAD.UNT file. You may modify this file to include any additional types of units or conversions you need.

The argument oldreal represents the number to be converted, expressed in units defined by the before variable. The argument before represents the units in which the number is originally expressed. after is the units to which the given number will be converted. answer is the converted number, now expressed in units defined by the after variable.

This function returns one of the following: RTNORM or RTERROR

Example

sds_real real1,*answer;

char *before="foot";

char *after="inch";

sds_getreal("\nEnter feet to convert to inches: ",&real1);

sds_cvunit(real1,before,after,&answer);

sds_printf("\n%f feet equals %f inches. ",real1,answer);

See Also

Programming Overview of SDS


sds_defun
int sds_defun (const char *funname, int funcode);

"Define a new LISP function and its code."	SDS Function

This function defines a LISP function by associating its function name, which the user can type at the command line, with its function code and which can be used by sds_getfuncode.

The command to undefine the function is sds_undef, which requires the same arguments.

The argument funname represents the command to be typed at the command line. The argument funcode represents the function code, by which sds_getfuncode can access this function.

This function returns one of the following: RTNORM or an error code.

See Also

sds_undef

sds_getfuncode

Programming Overview of SDS


DLG_dimension_tile
int dlg_dimension_tile (sds_hdlg handle, char *key, short *width, short *height);

"Determine the x-and y dimensions of this dialog box tile."	SDS Function

This function returns the x,y dimensions of the tile with the name key. The x,y dimensions are typically used by other dialog box functions: dlg_fill_image, dlg_slide_image, and dlg_vector_image.

The handle argument is the name of the dialog box.

The key argument specifies the tile; it is case-sensitive.

The width argument is the x-coordinate of the tile; the height is the y-coordinate, using a 0-based system.

Notes

The dimension returned is one less than the size, since the dimension begins at 0. Thus, the size of the tile is 16 x 16 when width and height are both 15.

The key is a case-sensitive string.

This function returns RTNORM or an error code.

See Also

dlg_fill_image

dlg_slide_image

dlg_vector_image

Programming Overview of SDS


sds_distance
double sds_distance (const sds_point firstpt, const sds_point secondpt);

"Determine the distance between these points."	SDS Function

This function returns the distance between two points: firstpt represents the coordinates of the first point, and secondpt is the second point. The distance function handles 2-D or 3-D.

This function returns the distance, in current drawing units, between the two points, as a real number.

Example

sds_real returnr;

sds_point firstpt,secondpt;

sds_getpoint(NULL,"\nFirst point for distance: ",firstpt);

sds_getpoint(firstpt,"\nSecond point: ",secondpt);

returnr=sds_distance(firstpt,secondpt);

sds_printf("\nThe distance is %f",returnr);

See Also

sds_getdist

Programming Overview of SDS


sds_distof
int sds_distof (const char *string, int format, sds_real *real);

"Convert this value to a real number."	SDS Function

This function converts a given distance (or other quantity), expressed as a string in one of the formats listed below, to a real number expressing the distance in units defined by the LUNITS system variable.

The argument string represents the original number, expressed in one of the formats listed below.

format specifies one of the following formats:

Format	Meaning	Example
1	Scientific	6.35e1
2	Decimal	63.5
3	Engineering	5'3.5"
4	Architectural	5'3-1/2"
5	Fractional	23-3/4"
The argument real represents the number expressed in units defined by LUNITS.

This function returns RTNORM or an error code.

Example

int format;

sds_real real1;

char string1[512];

format=1;

sds_getstring(1,"\nEnter a number using scientific notation: ",string1);

sds_distof(string1,format,&real1);

sds_printf("\n%s is equal to %f. ",string1,real1);

See Also

sds_rtos

Programming Overview of SDS


DLG_done_dialog
int dlg_done_dialog (sds_hdlg handle, long message);

"Dismiss this dialog box."	SDS Function

This function terminates a dialog box.

The handle argument is the name of the dialog box to close.

The following table summarizes the meaning indicated by the message argument:

Message	Meaning
DLGOK	User clicked OK button.
DLGCANCEL	User clicked Cancel button.
DLGALLDONE	Dialog box is not active.
DLGSTATUS	When status >=l DLGSTATUS; the code was generated by an application.
This function returns RTNORM if successful, or else it returns an error code.

See Also

dlg_action_tile

dlg_new_dialog

dlg_start_dialog

Programming Overview of SDS


DLG_done_positioned_dialog
int dlg_done_positioned_dialog (sds_hdlg handle, int message, int *xpos, int *ypos);

"Terminate the dialog box, but remember its position."  	SDS Function

This function closes a dialog box and returns the x,y position, so that another dialog box can appear in the same location.

The handle argument is the name of the dialog box.

The following table summarizes the meaning indicated by the message argument:

Message	Meaning
DLGOK	User clicked OK button.
DLGCANCEL	User clicked Cancel button.
DLGALLDONE	Dialog box is mot active.
DLGSTATUS	When status >=l DLGSTATUS; the code was generated by an application.
The xpos argument returns the x-coordinate of the dialog box's lower-right corner; the ypos argument returns the x-coordinate. The origin (0,0) of the dialog box is at the upper-left corner.

This function returns RTNORM if successful, or else it returns an error code.

See Also

dlg_action_tile

dlg_new_dialog

dlg_start_dialog

Programming Overview of SDS


sds_draggen
int sds_draggen (const sds_name ss, const char *prompt, int cursor, int (*myfunction)(sds_point point, sds_matrix mt), sds_point p);

"Allow the user to drag the selection set."	SDS Function

This function prompts the user to drag the selection set. The ss argument is the name of the selection set, which you obtain from the function sds_ssget or sds_ssadd. The prompt is optional; if it is not used, pass a null pointer.

The cursor argument specifies the type of cursor to display:

Cursor	Meaning
0	Display the default crosshair cursor.
1	Display no cursor.
2	Display the object-selection (box) cursor.
The *myfunction argument is a pointer to a function. This function is called as the mouse changes position. The arguments for myfunction are the current position of the mouse in UCS coordinates, point, and a 4 x 4 transformation matrix, mt. Myfunction() can change the matrix, which sds_draggen() then uses to update the dragging display of the selection set ss.

This function returns RTNORM (when it succeeds), RTERROR (when it fails), or RTCAN (when the user cancels the function or when myfunction returns RTERROR0).

See Also

Programming Overview of SDS


DLG_end_image
int dlg_end_image (void);

"End the creation of a dialog box image."	SDS Function

This function signals the end of the creation of an image in the current dialog box, which was begun by the dlg_start_image function.

This function returns RTNORM if successful, or else it returns an error code.

See Also

dlg_start_image

Programming Overview of SDS


DLG_end_list
int dlg_end_list (void);

"End the creation of a dialog box list."	SDS Function

This function signals the end of processing a list in the current dialog box, which was begun by the dlg_start_list function.

This function returns RTNORM if successful, or else it returns an error code.

See Also

dlg_add_list

dlg_start_list

Programming Overview of SDS


sds_entdel
int sds_entdel (const sds_name entity);

"Delete (or undelete) this object."	SDS Function

This function deletes an object from a drawing, or, if the entity specified is already deleted, sds_entdel undeletes it. The object can be toggled between the two states (deleted and undeleted) at any point during the session. When the drawing is closed, any deleted objects are permanently erased.

The argument entity represents the object to be deleted (or undeleted).

This function returns RTNORM or an error code.

See Also

Programming Overview of SDS


sds_entget
struct sds_resbuf *sds_entget (const sds_name entity);

"Get information about this object."	SDS Function

Given the name of an object, this function returns a result buffer with information about the object, such as layer, linetype, color, defining points, and so on. Note that the color, linetype, thickness, attributes follow flag, and entity handle are returned only when their value differs from the default value. The result buffer gives the group code as the restype and the value as the resval.

The sds_entget function returns x,y,z coordinates as a single point value in RPOINT and not as separate x, y, and z groups, as with DXF codes.

Before using sds_entget on polyline vertex entities, read the polyline's entity header because width information can be lost when the most-recently processed polyline object is different than the one the vertex belongs to.

The argument entity represents the name of the object whose information you wish to retrieve. If that object is not present in the current drawing, sds_entget returns NULL.

This function returns a linked list of result buffers with the information for one of the following: SDS_RTCAN, SDS_RTERROR, SDS_RTKWORD, SDS_RTNONE, or RTNORM.

Example

sds_name entname1;

sds_point point1;

struct sds_resbuf *entlist;

sds_entsel("\nPick an object: ",entname,point1);

entlist=sds_entget(entname);

See Also

sds_entgetx

sds_entmod

Programming Overview of SDS


sds_entgetx
struct sds_resbuf *sds_entgetx (const sds_name entity, const struct sds_resbuf *applist);

"Get information and EED about this object."	SDS Function

This function is very similar to sds_entget, except that the result buffer list returned by sds_entgetx includes the EED (an acronym for extended entity data, also referred to as xdata) for the application specified in applist.

The argument entity represents the name of the object whose information you wish to retrieve. The argument applist represents a linked list of application names, whose extended entity data you want included in the result buffer returned by this function.

This function returns the result buffer list with the object's information and extended entity data, or null if the object is not found.

Example

sds_name entname1;

struct sds_resbuf *applist;

struct sds_resbuf *entlist;

applist=sds_buildlist(RTSTR,"myapp",RTNONE);

entlist=sds_entgetx(entname1,applist);

See Also

sds_entget

Programming Overview of SDS


sds_entlast
int sds_entlast (sds_name entity);

"Determine which is the last object in the drawing."	SDS Function

This function retrieves the name of the last non-deleted object in your database. This is useful if you want to use the last object drawn.

The argument entity is set to the name of the object if this function succeeds.

This function returns one of the following: RTNORM or RTERROR. Check system variable ERRNO for the reason code.

Example

sds_name entity1;

char string1[512];

sds_getstring(0,"\nEnter to highlight the last object created: ",string1);

sds_entlast(entity1);

sds_redraw(entity1,3);	// Highlights the last object.

See Also

sds_entnext

Programming Overview of SDS


sds_entmake
int sds_entmake (const struct sds_resbuf *entity-list);

"Make a new object with these properties."	SDS Function

This function creates an object in the drawing database, given the entity information for a new object. This is the reciprocal function to sds_entget.

The argument entlist represents a pointer to a linked list of sds_resbuf structures containing the object information for a new object. The following objects cannot be created: viewports, xrefs, xdefs, and xdeps.

The first or second buffer in the list must specify the entity type (a valid DXF entity type). When the first buffer does not specify the type, it must specify the entity name in the same format returned by sds_entget.

Text style names, linetype names, shape names, and block names must be already defined in the drawing before your pass the entity list to sds_entmake; the layer names are the exception. The list must not include the name of a handle.

To create a complex object, such as  polyline or block, make more than one call to sds_entmake, with one call for each subentity. The complex entity is not added to the drawing until it is complete.

This function returns RTNORM (when it is successful), RTKWORD (when it creates the endblk of a block), or RTREG (when it cannot update the database) and sets system variable ERRNO to the reason code.

Example

sds_point point1 = {1.0,3.0,0.0};

sds_point point2 = {7.0,3.0,0.0};

entlist=sds_buildlist(RTDXF0, "line",   // Entity type

                           8, "0",      // Layer name

                          62, 70,       // Color number

                          10, point1,   // Starting point for the line

                          11, point2,   // Ending point for the line

                              RTNONE);  // List always ends with RTNONE or 0

sds_entmake(entlist);

See Also

sds_entget

Programming Overview of SDS


sds_entmakex
int sds_entmakex (const struct sds_resbuf *entity-list, sds_name new-entity);

"Make an object without an owner."	SDS Function

This function is identical to the sds_entmake function, except that it does not assign an owner. This is useful for creating an object that is not saved with the drawing.

This function returns RTNORM if it succeeds. It returns RTREJ if it cannot update the database.

See Also

sds_entmake

Programming Overview of SDS


sds_entmode
int sds_entmod (const struct sds_resbuf *entity-list);

"Modify an object in this drawing."	SDS Function

This function modifies the information for an object already existing in the drawing database. You may have made changes to the object list that you retrieved using sds_entget, so the function sds_entmod writes the changed list permanently into the database.

This function updates the display of the modified object, unless it is a sub-entity (such as part of a block or polyline). For a sub-entity, use the sds_entupd function or Regen command to force a redisplay the object on the screen.

The argument entity-list represents a linked list of result buffers in the same form as that returned by sds_entget. Note that sds_entmod cannot change the object's type or handle.

Text style names, linetype names, shape names, and block names must be already defined in the drawing before your pass the entity list to sds_entmod; layer names are the exception. The list must not include the name of a handle.

This function returns RTNORM or RTREJ, with the reason code in system variable ERRNO.

Notes

To restore the default color or linetype to an object, set the color to 256 and the linetype to BYLAYER.

The following objects cannot be modified: viewports, xrefs, xdefs, and xdeps.

The following symbol table entries cannot be modified and/or renamed:

Table Name	Entry
LAYER	All, except extended entity data.
LINESTYLE	CONTINUOUS
VPORT	*ACTIVE

These can be modified but not renamed:

APPID	None.
BLOCKS	*MODEL_SPACE and *PAPER_SPACE
DIMSTYLE	STANDARD
LAYER	0
STYLE	STANDARD
Example

struct sds_resbuf *templist;

sds_entlast(entname); 	//Get the name of the last object drawn.

entlist=sds_entget(entname);	       	//Get the resbuf for that object.

//Go through the object's resbuf...

for (templist=entlist;templist->rbnext!=NULL;templist=templist->rbnext)

    {

        if (templist->restype==62)     	//When it gets to the color

            templist->resval.rint=240;  	//group, change it to 240.

    }

sds_entmod(entlist);                	//Put the (modified) resbuf back

See Also

sds_entmake

Programming Overview of SDS


sds_entnext
int sds_entnext (const sds_name entity1, sds_name entity2);

"Determine the next object after this object."	SDS Function

This function returns the name of the first non-deleted object in the database when no arguments are supplied. If an object name is supplied, sds_entnext returns the next object following the given entity1. When there is no next object in the database, sds_entnext returns nil.

The argument entity1 is a known object name. This can be NULL, in which case sds_entnext gives the name of the first object in the drawing. The argument entity2 represents the name of the next object in the drawing, or the first object if entity1 is NULL.

This function returns RTNORM or RTERROR.

Example

sds_name entity1,entity2;

char string1[512];

sds_entsel("\nPick an object: ",entity1,point1);

sds_getstring(0,"\nPress Enter to highlight the next object: ",string1);

sds_entnext(entity1,entity2);	Finds the name of the next object.

sds_redraw(entity2,3); 	Highlights the next object.

See Also

sds_entlast

Programming Overview of SDS


sds_entsel
int sds_entsel (const char *prompt, sds_name entity, sds_point point);

"Select the object right here. . . *click*."	SDS Function

This function displays a prompt, then pauses for the user to select an object. The function returns the object selected and the point on the object where the user selected it.

The argument *prompt represents the text to prompt the user to select an object. When NULL, the program uses the default prompt, "Select Entity." The argument  entity represents the name of the selected object. The argument point represents the point by which the object was selected.

This function returns RTCAN (when the user has canceled the request), RTERROR (when this function has failed), RTKWORD (when a call to sds_initget was made previously), or RTNORM, when this function succeeds.

Notes

This function ignores the current object snap setting.

If the user selects a complex object, such as a block or polyline, this function returns the nearest block (or polyline) header. If you want the nearest attribute or polyline vertex, use function sds_nentselp instead.

Example

sds_name entity1;

sds_point point1;

sds_entsel("\nPick an object: ",entity1,point1);

sds_redraw(NULL,4);	Un-highlights everything.

sds_redraw(entity1,3);	Highlights selection.

sds_printf("\nSelection point: (%f, %f, %f.) ",point1[0],point1[1],point1[2]);

See Also

sds_nentselp

Programming Overview of SDS


sds_entupd
int sds_entupd (const sds_name entity);

"Update the image of that object."	SDS Function

This function updates the image of an object and is useful particularly for complex objects, such as blocks and polylines. In some cases, you may need to use the Regen command to fully update the image. The argument entity represents the object to be updated.

This function returns RTNORM or RTERROR.

Example

sds_name entname;

sds_entupd(entname);

See Also

sds_redraw

Programming Overview of SDS


sds_exit
void sds_exit (int status);

"Notify IntelliCAD® that the SDS™ application is exiting now, then exit."	SDS Function

This function tells IntelliCAD that the SDS application is about to exit, gives a status code, and then exits. If the application exits without telling IntelliCAD, the memory and resources it uses are not freed.

The status argument represents the way in which the application terminated. Use 0 (zero) for a planned and intentional termination. Other values can be used for unusual reasons for exiting the application, depending on your system.

This function returns void.

Example

sds_printf("\nOURBASE is shutting down now.");

    sds_exit(0);

See Also

sds_abort

sds_fail

sds_alert

Programming Overview of SDS


sds_fail
void sds_fail (const char *string);

"Display an error message."	SDS Function

This function prints an error message, along with the name of the SDS application and the given string at the command line. This function is meant for use with recoverable errors.

The argument string represents the text to print to the command line, following the name of the SDS application.

This function returns void.

Example

char string1[512];

strncpy(string1," was not able to find that point./n",sizeof(string1)-1);

sds_fail(string1);

See Also

sds_alert

sds_abort

sds_exit

Programming Overview of SDS


DLG_fill_image
int dlg_fill_image (int x, int y, int width, int height, int color);

"Fill a dialog box's rectangle with color."	SDS Function

This function draws a rectangle (or square), and then fills it with a color. This function must be used between the dlg_start_image and dlg_end_image functions.

The x and y arguments specify the upper-left corner of the rectangle.

The width and height arguments indicate the relative distance to the lower-right corner; these two arguments must be positive. If you obtained the lower-right coordinates from the dlg_dimension_tile functions, then the origin (0,0) is the upper-left corner.

The color argument is an IntelliCAD® color number or a logical color number:

Color  number	Description
-2	Current background of the IntelliCAD graphics screen.
-15	Current dialog box background color.
-16	Current dialog box foreground color.
-18	Current dialog box line color.
This function returns RTNORM when successful, or an error code, if not.

See Also

dlg_slide_image

dlg_vector_image

Programming Overview of SDS


sds_findfile
sds_findfile (const char *lookfor, char *pathfound);

"Locate this file."	SDS Function

This function searches for the given file and gives the full path for that file (the foundpath argument).

The argument lookfor represents the name of the file to search for. The string must include the file's extension (if any).

The search criteria can be limited to a particular drive or directory tree by prefixing the filename with a drive or subdirectory name, such as "c:\intellicad\drawing.dwg".

The argument foundpath represents the complete path name for the specified file.

This function returns RTNORM or RTERROR.

Example

char lookfor[512],foundpath[512];

sds_getstring(0,"\nEnter the name of a file to find: ",lookfor);

sds_findfile(lookfor,foundpath);

sds_printf("\nThe path for that file is %s: ",foundpath);

See Also

sds_getfiled

Programming Overview of SDS


sds_free
void sds_free (void *memloc);

"Deallocate the memory allocated by xAlloc."  	SDS Function

This function deallocates memory allocated by the sds_calloc, sds_malloc, and/or sds_realloc functions. The argument memloc is the memory region previously allocated.

See Also

Programming Overview of SDS


sds_getangle
int sds_getangle (const sds_point firstpt, const char *prompt, double *answer);

"Ask the user to specify an angle."	SDS Function

This function pauses to get an angle from the user. You can prompt the user to specify an angle numerically, or by picking points.

The argument firstpt represents the first point of the angle. It may be null. When null, the user enters the angle itself, using the current units for angles.

If given a starting point (firstpt), the user picks another point to define a rubber-band line, and sds_getangle determines the counter-clockwise angle between the current zero direction (as set in ANGBASE) and the rubber-band line.

The prompt argument represents a command-line prompt requesting that the user specify or pick an angle. This argument may be null.

The answer argument represents the angle specified by the user, counter-clockwise from the zero direction, expressed in radians (regardless of the current units for angles).

This function returns one of the following: RTCAN, RTERROR, RTKWORD, RTNONE, or RTNORM.

NOTE This functions read ANGBASE to find the 0-angle direction. If you prefer the 0-angle fixed in the east or 3 o'clock direction, use the sds_getorient function.

Example

sds_real *answer;

sds_point firstpt;

sds_getpoint(NULL,"\nFirst point: ",firstpt);

sds_getangle(point1,"\nSecond point: ",&answer);

sds_printf("\nThe angle is %f radians.",answer);

See Also

sds_getorient

sds_angle

Programming Overview of SDS


sds_getappname
char *sds_getappname (void);

"Determine the name of the current SDS application." 	SDS Function

This function returns the name of the current SDS application. This name is needed so that you can unload the application from memory.

See Also

Programming Overview of SDS


sds_getargs
struct sds_resbuf *sds_getargs (void);

"Return the arguments to the current SDS application."	SDS Function

This function returns the arguments to the specified external function and returns a pointer to a linked list of arguments. When there are no arguments, this function returns a null pointer. There is no need to call sds_relrb since this function automatically releases the list.

See Also

Programming Overview of SDS


DLG_get_attr
int dlg_get_attr (sds_hdlg handle, char *key, char *attribute, char *value, int length);

"Determine the DCL value of this tile's attribute. (part 1)"	SDS Function

This function returns the value of the dialog box attribute. The key argument specifies the dialog box tile; key is a string and is case-sensitive.

The attribute argument is the name of the attribute. See the DCL Programming Reference for valid attribute names.

The value argument is the value of the attribute returned by this function.

NOTE When working with a callback function, use dlg_get_attr_string inside the callback function instead.

See Also

dlg_get_attr_string

dlg_get_tile

dlg_set_tile

Programming Overview of SDS


DLG_get_attr_string
int dlg_get_attr_string (sds_hdlg handle, char *attribute, char *value, long length);

"Determine the DCL value of this tile's attribute. (part 2)"	SDS Function

This function returns the value of the dialog box attribute. Note that this value changes due to user input, as well as calls made by the dlg_get_attr function. Unlike dlg_get_attr, this function is used inside a callback function.

The key argument specifies the dialog box tile; key is a string and is case-sensitive.

The attribute argument is the name of the attribute. See the DCL Programming Reference for valid attribute names.

The value argument is the value of the attribute returned by this function.

Notes

The value argument does not return the current value of the argument; instead, it is the original value set by the DCL file.

The length argument is a memory buffer large enough to hold the value plus the EOL terminator.

This function returns RTNORM when successful, or an error code, if not.

See Also

dlg_get_attr

dlg_get_tile

dlg_set_tile

Programming Overview of SDS


sds_getcfg
int sds_getcfg (const char *symbol, char *var, int length);

"Determine the value of the parameter."	SDS Function

This function returns data from the [AddData] section of the Icad.Cfg file, if it exists.

The symbol argument is a string with the following format:

"AppData/appname/sname/parameter"

where:

Cfg Name	Meaning
AppData	The [AppData] section.
appname	The name of the application.
sname	The section name.
parameter	The parameter name.
The var argument is a pointer to a location in memory that holds the retrieved parameter data. This memory location is pre-allocated and must be big enough to hold all of the data.

The length parameter is the length of the retrieved data.

This function returns RTNORM or RTERROR when the string is truncated due to length being too small.

See Also

Programming Overview of SDS


sds_getcname
int sds_getcname (const char *other-lang, char **English-name);

"Determine the English version of that command."  	SDS Function

This function returns either: (1) the localized; or (2) English name of an IntelliCAD® command, depending on the argument you employ. The argument other-lang is the name of the command. The second argument, English-name, is a pointer to the string result.

This function returns RTNORM or RTERROR.

See Also

Programming Overview of SDS


sds_getcorner
int sds_getcorner (const sds_point point1, const char *prompt, sds_point point2);

"Ask the user to specify the second corner."	SDS Function

This function pauses to get a second corner-point for a rectangle from the user. You may prompt the user to specify the corner-point, either numerically, or by picking a point.

The argument point1 represents the first corner of a rectangle. The rectangle is defined between this point and the next point the user specifies. The points are treated as 2-D x,y coordinates.

The prompt argument is a command-line prompt requesting that the user specify a second point for a rectangle. This argument may be null.

The argument point2 represents the second corner of the rectangle, a point specified by the user.

This function returns one of the following: RTCAN, RTERROR, RTKWORD, RTNONE, or RTNORM.

Example

sds_point point1,point2;

sds_getpoint(NULL,"\nFirst corner: ",point1);

sds_getcorner(point1,"\nSecond corner: ",point2);

See Also

Programming Overview of SDS


sds_getdist
int sds_getdist (const sds_point point, const char *prompt, double *answer);

"Ask the user to specify a distance."	SDS Function

This function pauses to get a second point from the user to determine a distance. You may prompt the user to specify the second point, either numerically or by picking a point.

The argument point represents the first point, from which the distance is measured.

The prompt argument represents a command-line prompt requesting that the user specify a second point for determining a distance. This argument may be null.

The argument answer is the distance between the two points.

This function returns one of the following: RTCAN, RTERROR, RTKWORD, RTNONE, or RTNORM.

Example

sds_point point1;

sds_real real1;

sds_getpoint(NULL,"\nFirst point: ",point1);

sds_getdist(point1,"\nSecond point: ",&real1);

sds_printf("\nThe distance between the points is %f. ",real1);

See Also

sds_distance

Programming Overview of SDS


sds_getfiled
int sds_getfiled (const char *title, const char *path, const char *fileext, int options, struct sds_resbuf *filename);

"Bring up the file dialog box."	SDS Function

This function displays the standard Windows file dialog box so that the user can save, open, or find a file, as appropriate. However, this function includes arguments that allow you to somewhat customize the dialog box's wording.

The argument title represents the label of the dialog box. This is the text that appears across the top, such as "Open Drawing."

The path argument represents the default pathname and filename, if applicable. This is where the dialog box first looks for the file. This can be NULL. If so, the default is the current working directory.

The fileext argument is the default file extension. This can be overridden by the user only if bit 2 ( = 4) is set in options.

The argument options represents the sum of the appropriate bits for each of the following options:

Option	Meaning
1	Warns when the user types an existing filename; use this option to create a new file, not open an existing one.
2	Grays out the "Type it" button.
4	Allows the user to type a filename other than that specified by fileext.
8	Only the filename is stored in the result buffer, filename. When not set, the entire pathname is stored in filename. When option 1 is set (for creating a new file), this has no effect.
16	Path is assumed to be a pathname only. This is also true when path ends with a slash.
The argument filename is a result buffer containing either a string with the path and file name for the selected file or, if the user selected the Type It button, a short with a resval of 1.

This function returns RTNORM or RTERROR.

Example

struct sds_resbuf filename;

sds_getfiled("sds_getfiled Test Dialog",NULL,"DWG",4,&filename);

if (filename.restype==rstring)

   sds_printf("\nThe name of the file is %s. ",filename.resval.rstring);

else if (filename.restype==rint)

   sds_printf("\nThe user selected the \"Type it\" button. ");

else

   sds_printf("\nAn error occurred.");

See Also

Programming Overview of SDS


sds_getfuncode
int sds_getfuncode (void);

"Determine the code number of that application."	SDS Function

This function returns the function code number for an SDS command typed at the command line. IntelliCAD® associates a function code with the external function name during the call made by sds_defun. The function sds_getfuncode does not accept any arguments.

When successful, it returns the function code; otherwise, it returns RTERROR.

See Also

sds_defun

sds_undef

See Also

Programming Overview of SDS


sds_getinput
int sds_getinput (char *string);

"Retrieve the input the user just typed or specified."	SDS Function

This function retrieves information entered by the user in response to the previous function. This function must immediately follow a user-input function. In addition, the previous function must return RTKWORD or RTSTR; otherwise, it will fail.

The argument string is a string of a maximum of 511 characters, containing whatever the user entered. The last (512) character in the string is always Ø (ASCII 0 or null).

This function returns RTERROR or RTNORM.

Example

int int1;

char string1;

sds_initget(128,"");	 // Allows arbitrary input

sds_getint("\nEnter an integer: ",&int1);  // User may enter 123abc

sds_getinput(string1);	       // String1 would be:  123abcØ

sds_printf("\nYou entered %s ",string1);

See Also

Programming Overview of SDS


sds_getint
int sds_getint (const char *prompt, int *answer);

"Ask the user to specify an integer."	SDS Function

This function pauses to get an integer from the user. You may prompt the user to enter the integer.

The argument prompt represents a command-line prompt requesting that the user enter an integer.This argument may be null.

The answer argument is the integer entered by the user. The valid range is a short integer between -32768 and 32767.

This function returns RTCAN (when the user presses Esc), RTERROR (when it fails), or RTNORM (when it succeeds). If the prior function was sds_initget, this function may return RTKWORD or RTNONE.

Example

int int1;

sds_getint("\nPlease enter an integer: ",&int1);

sds_printf("\nThe integer you entered is %i. ",int1);

See Also

sds_getreal

Programming Overview of SDS


sds_getkword
eint sds_getkword (const char *prompt, char *answer);

"Ask the user to specify a keyword."	SDS Function

The function pauses to get a keyword from the user. The prompt to the user shows the list of acceptable keywords. The user may type the whole word, or an abbreviation.

Keywords are defined using sds_initget prior to sds_getkword. Do not use command names as keywords.

The prompt argument is a command-line prompt requesting that the user enter a keyword. The prompt can include a list of keywords so the user is not required to know them from memory. This argument may be null.

The argument answer is the keyword entered by the user. It is a string of a maximum of 512 characters, the last of which is always Ø (ASCII 0). Even if the user enters an abbreviation, the entire keyword, with its original capitalization, is stored in the answer argument.

This function returns RTCAN (when the user presses Esc), RTERROR (when it fails), or RTNORM (when it succeeds). If the prior function was sds_initget, this function may return RTNONE.

NOTE sds_getkword itself does not ever return RTKWORD.

Example

char string1;

sds_initget(0,"Cat Dog Horse Bird");

sds_getkword("\nChoose a pet: Cat/Dog/Horse/Bird ",string1);

sds_printf("\nYou chose a %s. ",string1);

See Also

Programming Overview of SDS


sds_getorient
int sds_getorient (const sds_point point, const char *prompt, double *answer);

"Ask the user to specify an orientation."	SDS Function

This function pauses to get an angle from the user. You may prompt the user to specify an angle, either numerically, or by picking points.

This function measures the angle relative to a horizontal line extending to the right. The current value of the ANGBASE system variable has no effect on sds_getorient.

The argument point is the starting point, which may be null. If null, the user enters the angle itself, using the current units for angles. If given a starting point (point), the user picks another point to define a rubber-band line, and sds_getorient determines the counter-clockwise angle between a horizontal line and the rubber-band line.

The argument prompt represents a command-line prompt requesting that the user specify or pick an angle. This argument may be null.

The answer argument represents the angle specified by the user, counter-clockwise from the zero direction, expressed in radians (regardless of the current units for angles).

This function returns one of the following: RTCAN, RTERROR, RTKWORD, RTNONE, or RTNORM.

Example

sds_real *real1;

sds_point point1;

sds_getpoint(NULL,"\nFirst point: ",point1);

sds_getorient(point1,"\nSecond point: ",&real1);

sds_printf("\nThe angle is %f radians. ",real1);

See Also

sds_getangle

Programming Overview of SDS


sds_getpoint
int sds_getpoint (const sds_point point, const char *prompt, sds_point answer);

"Ask the user to specify a point."	SDS Function

This function pauses to get a point from the user. You may prompt the user to enter a point, either numerically, or by picking one.

The argument point represents an existing point for reference. If this point is used, IntelliCAD® draws a rubber-band line from the point to the cursor while the user is picking the requested point. This argument may be null.

The argument prompt represents a command-line prompt requesting that the user enter a point. This argument may be null.

The argument answer is the point entered by the user.

This function returns one of the following: RTCAN, RTERROR, RTKWORD, RTNONE, or RTNORM.

Example

sds_point point1;

sds_getpoint(NULL,"\nPlease pick or specify a point: ",point1);

sds_printf("\nThe point is (%f,%f,%f). ",point1[0],point1[1],point1[2]);

See Also

sds_getangle

Programming Overview of SDS


sds_getreal
int sds_getreal (const char *prompt, double *answer);

"Ask the user to specify a real number."	SDS Function

This function pauses to get a real number from the user. You may prompt the user to enter the number.

The argument prompt is a command-line prompt requesting that the user enter a real number.

The argument answer is a pointer to the real number entered by the user.

This function returns one of the following: RTCAN, RTERROR, RTKWORD, RTNONE, or RTNORM.

Example

sds_real real1;

sds_getreal("\nEnter a real number: ",&real1);

sds_printf("\nYou entered %f. ",real1);

See Also

sds_getint

Programming Overview of SDS


sds_getstring
int sds_getstring (int flag, const char *prompt, char *answer);

"Ask the user to specify a string."	SDS Function

This function pauses to get a character string from the user. You may prompt the user to enter the information.

The argument flag represents an integer, either 0 or 1, which signals whether spaces are allowed in the string. When 0, a space is treated as a carriage return. If 1, the user can type spaces and must press Enter to signal the end of the string.

The argument prompt is a command-line prompt requesting that the user enter information. This argument may be null.

The answer argument is the information entered by the user. This can be a string of a maximum of 512 characters, the last of which is always Ø (ASCII 0).

This function returns RTCAN, RTERROR, or RTNORM.

Example

char string1[512];

sds_getstring(1,"\nType a brief line of text: ",string1);

sds_printf("\nYou entered: %s ",string1);

See Also

sds_getint

Programming Overview of SDS


sds_getsym
int sds_getsym (const char *symname, struct sds_resbuf **valueout);

"Get the value of a symbol from LISP."	SDS Function

This function retrieves the value of a LISP symbol.

The argument const char symname represents the name of the LISP symbol whose value you want to retrieve.

The valueout argument is a pointer to the result buffer into which the type and value from the LISP symbol symname are stored.

This function returns RTERROR or RTNORM.

Example

struct sds_resbuf *valueout;

sds_getsym("LISPsym",&valueout);

switch(valueout->restype){

    case RTREAL:

        sds_printf("\nLISPsym's value is %f. ",valueout->resval.rreal);

        break;

    etc.

See Also

sds_getint

Programming Overview of SDS


DLG_get_tile
int dlg_get_tile (sds_hdlg handle, char *key, char *value, long length);

"Determine the value of this dialog box's tile."	SDS Function

This function returns the value of a dialog box tile.

The handle argument is the name of the dialog box.

The key argument specifies the dialog box tile; key is a string and is case-sensitive.

The value argument is the value of the tile returned by this function.

The length argument allocates sufficient memory to return value, plus one character for the EOL (end-of-line) indicator.

See Also

dlg_get_attr

dlg_get_attr_string

Programming Overview of SDS


sds_getvar
int sds_getvar (const char *sysvar, struct sds_resbuf **info);

"Determine the value of this system variable."	SDS Function

This function stores the type and current value for the variable in the result buffer info, given the name of a system variable sysvar.

The argument sysvar is the name of the system variable whose value you are retrieving.

The argument info points to a result buffer structure that represents the current value stored in the above variable. The info argument must point to an allocated result buffer. It cannot be declared as only a pointer since the data returned from a system variable ranges from a single-digit integer (such as 0) to a 132-character string.

This function returns RTERROR or RTNORM.

Example

char sysvar[512];

struct sds_resbuf rb1;

sds_getstring(0,"\nEnter a variable name:  ",sysvar);

sds_getvar(sysvar,&rb1);

switch(rb1.restype){

   . . .

   case RTREAL:

      sds_printf("\n%s is currently set at %f. ",sysvar,rb1.resval.rreal);

      break;

   . . .

}

See Also

sds_setvar

Programming Overview of SDS


sds_graphscr
int sds_graphscr (void);

"Switch to the drawing window."	SDS Function

This function switches to the graphics window from the Prompt History window, which is the equivalent of pressing the F2 function key.

This function returns RTNORM or an error code.

Example

char string1[512];

sds_getstring(0,"\nTo switch to the graphics screen, press Enter ",string1);

sds_graphscr();

See Also

sds_textscr

sds_textpage

Programming Overview of SDS


sds_grclear
int sds_grclear (void);

"Clear the drawing window."	SDS Function

This function clears the drawing window.

This function returns RTNORM unless a critical error occurs.

The sds_grclear function is unique to the implementation of SDS™ included with IntelliCAD®'.

Example

char string1[512];

sds_getstring(0,"\nTo clear the graphics window, press Enter. ",string1);

sds_grclear();

See Also

sds_grdraw

Programming Overview of SDS


sds_grdraw
int sds_grdraw (const sds_point point1, const sds_point point2, int color, int mode);

"Draw a vector, this way."	SDS Function

This function draws a vector in the graphics window, from point1 to point2. The vector can be displayed in any of the standard colors and can be highlighted or displayed normally.

The arguments point1 and point2 represent the first and second points for the vector.

The argument color is the color number for the vector. This can be any of the standard color numbers, from 0 to 255. When color is set to -1, the vector is drawn in XOR ink.

Note: When one XOR-colored vector overdraws another vector, it is drawn in a complimentary color. When an XOR-color vector overdraws itself, it becomes invisible.

The mode argument determines whether the vector is displayed as highlighted or normal. To display normally, mode equals zero. Any other value highlights the vector.

This function returns RTNORM except when a critical error occurs.

NOTE If you need to draw multiple vectors, use the sds_grvecs function.

Example

int color,highlight;

sds_point firstpt,secondpt;

sds_getpoint(NULL,"\nFirst point for vector. ",firstpt);

sds_getpoint(NULL,"\nSecond point for vector. ",secondpt);

sds_getint("\nEnter a color number (0-255): ",&color);

sds_getint("\nEnter 1 for highlighted, 0 for normal display. ,&highlight);

sds_grdraw(firstpt,secondpt,color,highlight);

See Also

sds_grvecs

Programming Overview of SDS


sds_grread
int sds_grread (int track, int *cursor, struct sds_resbuf *answer);

"Read data from any input device."	SDS Function

This function directly reads the data generated by input devices. A note of caution applies when using this function: the data can become an overwhelming amount.

The argument track controls the type of input that will be accepted:

Track	Meaning
1	Returns the coordinates dynamically in the form of a list. The list consists of the value and the 3-D coordinate.
2	Returns keystrokes but does not move the cursor.
4	Turn this on if you are going to choose a cursor type.
8	Turns off the error message “console break” when you cancel out of the loop.

The cursor argument is an integer that corresponds to a cursor type:

Cursor	Meaning
0	Normal cursor-crosshairs.
1	No cursor.
2	Selection cursor - box.
The following table describes how the information is returned. For example, if you entered the letter, l (keyboard input), the value 2 and the character code would be returned (2 108) in a list.

Type of Input	Returned Value	Definition
Keyboard	2	Character code.
Selected Point	3	3-dimensional point.
Pulldown menu	4	1,001 to 1,999        POP1 menu 2,001 to 2,999        POP2 menu  … 16,001 to 16,999    POP16 menu
Mouse (other pointer)	5	3-dimensional point.
The argument answer the actual input, including type and value, is stored in this result buffer.

This function returns RTNORM or RTCAN.

Example

int1=2; // Setting this to 2 returns the value of any key pressed.

sds_grread(int1,&int2,&readinput);

switch(int2){

   case  2:   sds_printf("\nYou used the keyboard.");   break;

   case  3:   sds_printf("\nYou selected a point.");    break;

   etc.

   break;

}

switch(readinput.restype){

   case RTREAL:   sds_printf("\nIts value is %f. ",readinput.resval.rreal)

      break;

   case RTPOINT:  sds_printf("\nThe 2D point is %f,%f.",

         readinput.resval.rpoint[0],readinput.resval.rpoint[1]);

      break;

   etc.

}

See Also

Programming Overview of SDS


sds_grtext
int sds_grtext (int where, const char *message, int mode);

"Display text on the status line."	SDS Function

This function controls how and where messages are written in the drawing window.

The argument where controls where the message is displayed:

Where	Meaning
-1	Message appears on the status line.
-2	Message appears in the coordinate display.
-3	Status line is restored to its original state.
The argument message represents the text you wish to display in the location specified by where.

The argument highlight is ignored. It is provided for the sake of compatibility with earlier CAD programs.

This function returns RTNORM or RTERROR.

Example

int where = -1;

char *message = "Display this message";

int highlight = 1;

sds_grtext(where,message,highlight);

See Also

Programming Overview of SDS


sds_grvecs
int sds_grvecs (const struct sds_resbuf *vlist, sds_matrix mat);

"Draw vectors on the screen."	SDS Function

This function draws one or more vectors on the screen, unlike the sds_grdraw, which draws a single vector. Vectors can be displayed in any of the standard colors and can be highlighted or displayed normally.

The argument vlist represents a list of result buffers that specify the vectors. The vectors are clipped as required. The vlist consists of point pairs and a color. RTPOINT specifies a pair of 2D x,y-coordinates; or RT3DPOINT specifies a pair of 3D x,y,z-coordinates.

RTSHORT specifies the color of the vector:

Color	Meaning
-1	Vector is highlighted.
0 –255	Standard colors.
256	Vector is drawn in XOR ink.
NOTE When vectors are drawn in XOR ink and one XOR-colored vector overdraws another vector, it is drawn in a complimentary color. When an XOR-color vector overdraws itself, it becomes invisible.

The argument mat is a 4 x 4 matrix that transforms the vectors before they are displayed.

This function returns RTERROR or RTNONE.

See Also

sds_grdraw

Programming Overview of SDS


sds_handent
int sds_handent (const char *enthandle, sds_name entname);

"Determine the entity name of this object."	SDS Function

This function returns the entity name, given a pointer to the handle for a specific object.

The argument enthandle represents the handle for the object whose name you wish to retrieve.

The argument entname is the name of the object with the given handle.

This function returns RTNORM or RTERROR and sets an error code

Example

struct sds_resbuf *templist;

sds_name entname1, entname2;

char string1[512];

entlist=sds_entget(entname1);	// Get the resbuf for that object.

// Go through the object's resbuf...

for (templist=entlist;templist->rbnext!=NULL;templist=templist->rbnext)

    {

        if (templist->restype==5){	// Restype=5 is the handle

            sds_handent(templist->resval.rstring,entity2);

        }

    }

sds_handent(enthandle,entname2);

sds_getstring(0,"Press Enter to highlight the object. ",string1);

sds_redraw(entname2,3);

sds_relrb(entlist);

See Also

Programming Overview of SDS


sds_help
int sds_help (char *helpfile, char *id, int flag);

"Display the Help window."	SDS Function

This function displays a help file. The three arguments are passed to the Windows Help engine.

The argument helpfile specifies name of the HLP file.

The id argument specifies the topic ID string, which brings up a specific topic, such as a command name. When missing, IntelliCAD® displays the first topic of the Help file.

The flag argument displays one of the following:

Flag	Meaning
help_contents	Display the initial topic in the HLP file.
help_helponhelp	Display help on using help.
help_partialkey	Display the Search dialog box using topic as the search text.
This function returns RTNORM or RTERROR when the Help file cannot be found.

Note: This function should be attached to the dialog box's Help button in your DCL file. For more information on creating a dialog box with a Help button, see these topics in the DCL Programming Reference: ok_cancel_help,  ok_cancel_help_errtile,  ok_cancel_help_info.

See Also

Programming Overview of SDS


sds_init
int sds_init (int argc, char *argv[ ... ]);

"Initialize the SDS™ app."	SDS Function

The is the first function called in any SDS application.

The arguments argc and argv are the same arguments passed to the main() function of the SDS application.

This function returns either any value. When the SDS application does not work, this function returns control to the command line.

See Also

Programming Overview of SDS


sds_initget
int sds_initget (int accept, const char *keys);

"Accept only input fitting these criteria."	SDS Function

This function defines what input is acceptable for the command immediately following sds_initget. When keywords are allowed, use sds_getinput after this function to get the keyword that the user entered.

The argument accept determines the type of input that will be accepted from the user with the next function. It is the sum of the bit values selected from the list below:

Accept		Meaning
1	RSG_NONULL	Does not accept a carriage return from the user.
2	RSG_NOZERO	Accepts only non-zero input from the user.
4	RSG_NONEG	Accepts only non-negative numbers, including zero.
8	RGS_NOLIM	Accepts input outside of the limits of the drawing. This has precedence over the LIMCHECK system variable.
16	...	Not used.
32	RSG_DASH	Uses dashed lines for selection tools (boxes and rubberband lines).
64	RSG_2D	Accepts, but does not use, the z-value for points in the sds_getdist function.
128	RSG_OTHER	Accepts anything the user enters, and returns SDS_RTKWORD.

For example, if you want to limit the user's input to only positive numbers (non-negative and non-zero), and draw a rubber-band line with dashes, you add 4 + 2 + 32 to get a value of 38 for the accept variable.

A more verbose—but often clearer way—of using accept is to write an expression using the rsg_xxx words for each of the bits you wish to set. The same example as above written in this way is:

(rsg_noneg + rsg_nonull + rsg_dash)

This string is a list of keywords to be accepted by the next command. If keywords are not to be used, argument keys should be null or an empty string ("").

When defining your list of keywords, separate each keyword with a space. Show allowable abbreviations by capitalizing the required letter(s). When the entire word is in capital letters, the user is required to enter the entire word. Keywords may contain letters, numbers, and dashes. Here is an example of a list of keywords:

"One Two Three Four"

Given this, the user can type "three" or just "th" for three.

An alternative method of listing keywords is to write each word in all-capital letters, followed by a comma and the abbreviation for the word, as in the following example:

"ONE,O TWO,T THREE,TH FOUR,F"

This is usually used with (human) languages that do not use upper- and lower-case letters.

Note: The following combinations of functions, keywords, and accept bits are allowed:

Function	Keywords	1	2	4	8	32	64	128
sds_draggen	Yes	Yes						Yes
sds_entsel	Yes
sds_getangle	Yes	Yes	Yes			Yes		Yes
sds_getcorner	Yes	Yes			Yes	Yes		Yes
sds_getdist	Yes	Yes	Yes	Yes		Yes	Yes	Yes
sds_getint	Yes	Yes	Yes	Yes				Yes
sds_getkword	Yes	Yes						Yes
sds_getorient	Yes	Yes	Yes			Yes		Yes
sds_getpoint	Yes	Yes			Yes	Yes		Yes
sds_getreal	Yes	Yes	Yes	Yes				Yes
sds_getstring
sds_nentsel	Yes
sds_nentselp	Yes

This function returns RTNORM, RTKWORD, or RTERROR.

Example

char string1[512];

sds_initget(0,"Cat Dog Horse Bird");

sds_getkword("\nChoose one: Cat/Dog/Horse/Bird ",string1);

sds_printf("\nYour favorite animal is a %s. ",string1);

See Also

sds_getinput

sds_entsel

sds_nentsel

sds_nentselp

sds_draggen

Programming Overview of SDS


sds_inters
int sds_inters (const sds_point point1, const sds_point point2, const sds_point point3, const sds_point point4, int mode, sds_point interspt);

"Find where these lines intersect."	SDS Function

This function finds the intersection point of two lines.

The arguments point1 and point2 represent the starting and ending points for the first line segment, while point3 and point4 are the starting and ending points for the second line segment.

The mode argument controls whether the line segments must actually cross:

Mode	Meaning
0	The lines do not need to cross.
1	The lines must cross.
When mode is 1 and the line segments do not intersect, sds_inters returns RTERROR.

The interspt argument is the point at which the two lines intersect.

This function returns RTERROR or RTNORM.

Example

int cross;

cross = 1;

sds_point firstpt,secondpt,thirdpt,fourthpt,interspt;

sds_getpoint(NULL,"\nFirst point for line 1: ",firstpt);

sds_getpoint(firstpt,"\nSecond point: ",secondpt);

sds_getpoint(NULL,"\nFirst point for line 2: ",thirdpt);

sds_getpoint(thirdpt,"\nSecond point: ",fourthpt);

returni=sds_inters(firstpt,secondpt,thirdpt,fourthpt,cross,intpt);

    if (returni != 5100)

        sds_printf("\nThese two line segments do not intersect");

    if (returni == 5100)

        sds_printf("\nIntersection: (%f,%f,%f)", intpt[0],intpt[1],intpt[2]);

See Also

Programming Overview of SDS


sds_invoke
int sds_invoke (const struct sds_resbuf *args, struct sds_resbuf **answer);

"Call a function in another SDS™ application."	SDS Function

This function calls a function defined in another SDS application.

The args argument is a result buffer list that contains the external function call.

The answer argument contains the external function's return values.

This function returns RTERROR or RTNORM.

Note: Make sure that external functions are registered by sds_regfunc.

See Also

Programming Overview of SDS


sds_isalnum
int sds_isalnum (int val);

"Determine whether this character is alphanumeric."	SDS Function

This function determines whether a given character is alphanumeric (A - Z and a - z and 0 - 9). The argument val is the ASCII value for a character.

This function returns TRUE when the given character is a number or letter. Otherwise, it returns false.

Example

int returni;

char string1[512];

sds_getstring(1,"\nEnter a character: ",string1);

returni=sds_isalnum(string1[0]);

    if (returni == 0)

        sds_printf("\nThe character is NOT alphanumeric. ");

    else

        sds_printf("\nThe character IS alphanumeric. ");

See Also

Programming Overview of SDS


sds_isalpha
int sds_isalpha (int val);

"Determine whether this character is alphabetical."	SDS Function

This function determines whether a given character is alphabetical (A - Z and a - z). The argument val is the ASCII value for a character.

This function returns TRUE if the given character is alphabetical. Otherwise, it returns false.

Example

int returni;

char string1[512];

sds_getstring(1,"\nEnter a alphabetical character: ",string1);

returni=sds_isalpha(string1[0]);

    if (returni == 0)

        sds_printf("\nThe character is NOT alphabetical. ");

    else

        sds_printf("\nThe character IS alphabetical. ");

See Also

Programming Overview of SDS


sds_iscntrl
int sds_iscntrl (int val);

"Determine whether this is a control character."	SDS Function

The function determines whether a given character is a control character. The argument val is the ASCII value for a character.

This function returns TRUE if the given character is a control character. Otherwise, it returns false.

Example

int returni;

char string1[512];

sds_getstring(1,"\nEnter a control character: ",string1);

returni=sds_iscntrl(string1[0]);

    if (returni == 0)

        sds_printf("\nThe character is NOT a control character. ");

    else

        sds_printf("\nThe character IS a control character. ");

See Also

Programming Overview of SDS


sds_isdigit
int sds_isdigit (int val);

"Determine whether this character is a digit."	SDS Function

This function determines whether a given character is a decimal digit (0-9). The argument val is the ASCII value for a character.

This function returns TRUE if the given character is a decimal digit. Otherwise, it returns false.

Example

int returni;

char string1[512];

sds_getstring(1,"\nEnter a digit (0-9) (or not): ",string1);

returni=sds_isdigit(string1[0]);

    if (returni == 0)

        sds_printf("\nThe character is NOT a digit (0-9). ");

    else

        sds_printf("\nThe character IS a digit (0-9). ");

See Also

sds_isxdigit

Programming Overview of SDS


sds_isgraph
int sds_isgraph (int val);

"Determine whether this a graphical character."	SDS Function

This function determines whether a given character is a graphical character. The argument val is the ASCII value for a character.

This function returns TRUE if the given character is a graphical character. Otherwise, it returns false.

Example

int returni;

char string1[512];

sds_getstring(1,"\nEnter a graphical character-try © (ALT-0169): ",string1);

returni=sds_isgraph(string1[0]);

    if (returni == 0)

        sds_printf("\nThe character is NOT graphical. ");

    else

        sds_printf("\nThe character IS graphical. ");

See Also

Programming Overview of SDS


sds_islower
int sds_islower (int val);

"Determine whether this a lower-case character."	SDS Function

This command determines whether a given character is lower-case (a–z). The argument val is the ASCII value for a character.

This function returns TRUE if the given character is lower-case. Otherwise, it returns false.

Example

int returni;

char string1[512];

sds_getstring(1,"\nEnter a lowercase character: ",string1);

returni=sds_islower(string1[0]);

    if (returni == 0)

        sds_printf("\nThe character is NOT lowercase. ");

    else

        sds_printf("\nThe character IS lowercase. ");

See Also

sds_tolower

sds_toupper

sds_isupper

Programming Overview of SDS


sds_isprint
int sds_isprint (int val);

"Determine whether this character is printable."	SDS Function

This function determines whether a given character is a printable character (a non-control character). The argument val is the ASCII value for a character.

This function returns TRUE if the given character is a printable character. Otherwise, it returns false.

Example

int returni;

char string1[512];

sds_getstring(1,"\nEnter a printable character: ",string1);

returni=sds_isprint(string1[0]);

    if (returni == 0)

        sds_printf("\nThe character is NOT printable. ");

    else

        sds_printf("\nThe character IS printable. ");

See Also

Programming Overview of SDS


sds_ispunct
int sds_ispunct (int val);

"Determine whether this character is a punctuation mark."	SDS Function

This function determines whether a given character is a punctuation mark. The argument val is the ASCII value for a character.

This function returns TRUE when the given character is a punctuation mark. Otherwise, it returns false.

Example

int returni;

char string1[512];

sds_getstring(1,"\nEnter a punctuation mark: ",string1);

returni=sds_ispunct(string1[0]);

    if (returni == 0)

        sds_printf("\nThe character is NOT a punctuation mark. ");

    else

        sds_printf("\nThe character IS a punctuation mark. ");

See Also

Programming Overview of SDS


sds_isspace
int sds_isspace (int val);

"Determine whether this character is a blank space."	SDS Function

This function determines whether a given character is a blank, or white-space, character, such as a space, tab, new-line character, formfeed, or carriage return. The argument val is the ASCII value for a character.

This function returns TRUE if the given character is a white-space character. Otherwise, it returns false.

Example

int returni;

char string1[512];

sds_getstring(1,"\nHit Space, Tab, or Enter: ",string1);

returni=sds_isspace(string1[0]);

    if (returni == 0)

        sds_printf("\nYou typed something that is NOT blank space. ");

    else

        sds_printf("\nYou entered some blank space. ");

See Also

Programming Overview of SDS


sds_isupper
int sds_isupper (int val);

"Determine whether this is an upper-case character."	SDS Function

This function determines whether a given character is upper-case (A–Z). The argument val represents the ASCII value for a character.

This function returns TRUE when the given character is upper-case. Otherwise, it returns false.

Example

int returni;

char string1[512];

sds_getstring(1,"\nEnter an uppercase character: ",string1);

returni=sds_isupper(string1[0]);

    if (returni == 0)

        sds_printf("\nThe character is NOT uppercase. ");

    else

        sds_printf("\nThe character IS uppercase. ");

See Also

sds_islower

sds_tolower

sds_toupper

Programming Overview of SDS


sds_isxdigit
int sds_isxdigit (int val);

"Determine whether this character is a hex digit."	SDS Function

This function determines whether a given character is a hexadecimal digit (0-9, and A-F). The argument val represents the ASCII value for a character.

This function returns TRUE if the given character is a hexadecimal digit. Otherwise, it returns false.

Example

int returni;

char string1[512];

sds_getstring(1,"\nEnter a hex digit (0-9 or A-F): ",string1);

returni=sds_isxdigit(string1[0]);

    if (returni == 0)

        sds_printf("\nThe character is NOT a hex digit. ");

    else

        sds_printf("\nThe character IS a hex digit. ");

See Also

Programming Overview of SDS


sds_link
int sds_link (int lispmsg);

"Signal LISP that the SDS app is ready."	SDS Function

This function lets LISP know that the SDS application is ready for a request. If there has been a problem, sds_link prints "Error: SDS error in evaluation" to the command line.

The argument lispmsg is a message to LISP, which consists of either RSRSLT (the application is ready for the next request) or RSERR (there was a problem with the SDS application).

This function returns a LISP request code.

Example

Refer to the manual section on the structure of SDS applications.

See Also

Programming Overview of SDS


DLG_load_dialog
int dlg_load_dialog (char *filename, int *key);

"Load a dialog definition file."	SDS Function

This function loads a DCL dialog control language file. DCL files must be loaded before IntelliCAD® can display a custom dialog box.

The filename argument is the name of the DCL file.

The key argument is a system name for the dialog box,  which is used by the key argument in other DLGR functions.

NOTE This is a fix for some DDE problems. If you bypass all of the DDE emphasis and focus on the MFC dialog messages, your MFC dialogs should work. You should also be able to use MFC dialogs using this same method.

Add this new function to your code:

void mainwinthread(void *data) {

MSG            Msg;

    // Start DDE from the tread.

    InitializeDDE;

while(GetMessage(&Msg,(HWND)NULL,0,0)==TRUE) {

        // Read any command messages here to open MFC dialogs.

          TranslateMessage(&Msg);

 	    DispatchMessage(&Msg);

}

}

//Next, rather call InitializeDDE directly start a thread

//that will then call it. Note the changes made in the main

//loop below:

int main(int argc, char *argv[])

{

    int     stat;

    short   scode = RSRSLT;        /* This is the default result code */

    // **********************************

    // These vars identify your thread.

    DWORD ThreadID;

    HANDLE  Thread;

    // **********************************

    sds_init(argc, argv);               /* Initialize the interface */

    for( ; ; )                          /* Note loop conditions */

    {

        if((stat = sds_link(scode)) < 0)

        {

            printf("APP: bad status from sds_link = %d\n", stat);

            fflush(stdout);

            exit(1);

        }

        scode = RSRSLT;            /* Default return value */

        /* Check for the following cases here */

        switch (stat)

        {

            case RQXLOAD:

            {

                scode = funcload ? RSRSLT : RSERR;

                // **********************************

                // Start a thread here.

Thread=CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)mainw

inthread,NULL,0,&ThreadID);

                //InitializeDDE;

                // You can use the function

// PostThreadMessage to send a message

                // to your new thread to call up MFC dialogs.

                //***********************************

                break;

            }

            case RQSUBR:

            {

                scode = dofun == RTNORM ? RSRSLT : RSERR;

                break;

            }

            case RQXUNLD:

            {

                UninitializeDDE;

            }

            default:

            {

                break;

            }

        } /* switch (stat) */

    } /* for ( ; ; ) */

    return(0);

} /* main */

This function returns the RTNORM or RTERROR.

See Also

dlg_unload_dialog

Programming Overview of SDS


sds_loaded
struct sds_resbuf *sds_loaded (void);

"Determine which SDS™ applications are loaded."	SDS Function

This function tells you which SDS applications are loaded by returning a linked list of all the currently loaded application names. When no applications are loaded, this function returns NULL.

Example

struct sds_resbuf *loadlist;

struct sds_resbuf *templist;

char string1[512];

int howmany = 0;

loadlist=sds_loaded;

for (templist=loadlist;templist->rbnext!=NULL;templist=templist->rbnext){

   if (templist->restype!=RTSTR)	// It *should* be a string, but if not...

      sds_getstring(0,"\nWrong type. Press Enter.",string1);

   else {

      sds_printf("\nThe application %s is loaded.",templist->resval.rstring);

      howmany++;

   }

}

sds_printf("\nThere are %i applications loaded at this time.",howmany);

sds_relrb(loadlist);

loadlist=NULL;

templist=NULL;

See Also

Programming Overview of SDS


sds_malloc
void *sds_malloc (size_t bytes);

"Allocate memory."  	SDS Function

This function allocates memory equal in size the amount returned by the memory functions.

The argument bytes is the amount of memory to allocate.

This function returns a pointer to the memory region. When the memory cannot be allocated, this function returns NULL.

See Also

Programming Overview of SDS


sds_menucmd
int sds_menucmd (const char *string);

"Execute this menu command."	SDS Function

This function executes a command in the menu bar (cursor menu and pull-down menus). The string parameter uses the following formats:

"menu=value"

"menu=*"

The menu parameter has two parts, such as (menucmd "P1.2=*). In this case, the "P1" refers to the first pull-down menu (usually the File menu). the ".2" refers to the first item on the menu (usually the Open item). The first values of menucmd permitted in IntelliCAD® are:

Menu	Meaning
P0	Cursor menu
P1–P16	Pull-down menus 1–16
The value parameter has the following meanings:

Value	Meaning
?	What is status of the menu item?
*	Display the menu.
~	Disable the menu item (grayed out).
!.	Prefix menu item with a checkmark.
	(blank) Remove properties.
name	Load the menu name.
This function returns RTNORM (when the function is successful), RTKWORD (when value = ?), or an error code.

See Also

Programming Overview of SDS


DLG_mode_tile
int dlg_mode_tile (sds_hdlg handle, char *key, int mode);

"Set the mode of the dialog box's tile."	SDS Function

This function sets the mode of the tile identified by key.

The handle argument is the name of the dialog box.

The key argument is the case-sensitive name of the tile.

The mode argument takes one of the following integers:

Mode	Name	Meaning
0	MODE_ENABLE	Enable tile.
1	MODE_DISABLE	Disable tile.
2	MODE_SETFOCUS	Set the focus to the tile.
3	MODE_SETSEL	Select the contents of an edit box.
4	MODE_FLIP	Change image highlighting between on and off.
This function returns RTNORM or an error code.

See Also

dlg_get_attr

dlg_get_tile

Programming Overview of SDS


sds_name_clear
int sds_name_clear (sds_name name);

"Clear an entity name or selection set."	SDS Function

This function clears an entity name or a selection set.

The argument name is the name of the entity or selection set.

See Also

Programming Overview of SDS


sds_name_equal
int sds_name_equal (sds_name name1; sds_name name2);

"Determine whether these two entity names or selection sets are equal."	SDS Function

This function checks whether two entity names or two selection sets are the same.

The argument name1 is the name of one entity or selection set, while name2 is the name of the other entity or selection set.

See Also

Programming Overview of SDS


sds_name_nil
int sds_name_nil (sds_name name);

"Determine whether the entity name or selection set been cleared."	SDS Function

This function checks whether an entity name or a selection set has been cleared by the sds_name_clear function.

The argument name is the name of the entity or selection set being checked.

See Also

Programming Overview of SDS


sds_name_set
int sds_name_set (sds_name name1; sds_name name2);

"Copy n entity name or selection set to another."	SDS Function

This function copies an entity name (or a selection set name) to another name.

The argument name1 is the name of originating entity or selection set, while name2 is the target name to which to copy.

See Also

Programming Overview of SDS


sds_nentsel
int sds_nentsel (const char *prompt, sds_name entityname, sds_point point,  isds_matrix ecs2wcs[4], struct sds_resbuf **nestblks);

"Get information about this nested object."	SDS Function

NOTE Do not use this function in new programs. It is provided for backward compatibility with third-party applications written for earlier CAD programs. For new programs, use sds_nentselp.

This function works exactly like sds_nentselp except that instead of a 4 x 4 transformation matrix, sds_nentsel creates a 4 x 3 matrix stored as an array of four points.

Example

char *prompt;

sds_name entname;

sds_point entpoint;

int userpick;

sds_matrix ecs2wcs;

struct sds_resbuf *nestblks;

sds_nentsel("Pick your favorite object: ",entname, entpoint, userpick,

    ecs2wcs, &nestblks);

See Also

sds_nentselp

sds_entsel

Programming Overview of SDS


sds_nentselp
int sds_nentselp (const char *prompt, sds_name entity-name, sds_point point, int userpick, sds_matrix ecs2wcs[4], struct sds_resbuf **nestblks);

"Get information about this nested object."	SDS Function

This function works very much like sds_entsel but has features especially suited to dealing with objects nested within other objects, such as polyline vertices and block components.

Just as in sds_entsel, entity-name is the object selected, and point is the point used to select it. Also, here you have the option of prompting the user with prompt or using a predefined point with userpick, and a way to specify the prompt's wording.

There are two additional outputs with information specific to nested objects:

A transformation matrix for converting from the entity's Coordinate System to the World Coordinate System;

A linked list of objects in which the selected object is nested.

The prompt argument is the string that prompts the user for input. This argument may be null. If userpick is 1, this is not needed and is ignored. If userpick is 0, and this prompt is NULL, IntelliCAD® displays the default pick prompt..

The argument entity-name is the name of the object selected.

The argument point variable serves two purposes:

Userpick	Meaning
1	point is used as the selection point.
0	sds_nentselp sets point to the point used to select the object.
The userpick argument is a toggle indicating whether to prompt the user to pick an object, or to accept the current value of entpoint as the pickpoint. If userpick is set to 0, the user is asked to pick an object. If userpick is 1, point is taken as the selection point.

The argument ecs2wcs is a transformation matrix for converting point from the Entity Coordinate System to the World Coordinate System in the case that the object is nested inside a block or blocks. If not, this is an identity matrix. In sds_nentselp this is a 4x4 transformation matrix, whereas in sds_nentsel it is a 4x3 matrix.

NOTE The 4x4 matrix of sds_nentselp is preferred. The other function, sds_nentsel, is available because some programs written for other CAD systems rely on it; however, you should not use it in a new program.

The nestblks argument is a linked list of nested blocks, in which the chosen object is contained. The first block in the list is the one that directly contains the object; the next contains the first, and so on.

This function returns RTNORM, RTCAN, RTERROR, or RTKWORD.

Example

char *prompt;

sds_name entname;

sds_point entpoint;

int userpick;

sds_matrix ecs2wcs;

struct sds_resbuf *nestblks;

sds_nentselp("Pick your favorite object: ",entname, entpoint, userpick,

    ecs2wcs, nestblks);

See Also

sds_nentsel

sds_entsel

Programming Overview of SDS


DLG_new_dialog
int dlg_new_dialog (char *dialog, int dlg-file, void *callback, sds_hdlg *handle);

"Display a dialog box."	SDS Function

Use this function to display a dialog box.

The dialog box is identified by dialog within the DCL file named dcl-file. The string dialog is obtained from the dlg_load_dialog function.

The dlg_new_dialog function optionally executes the routine identified by the callback argument. To ignore this argument, use NULLCB.

When the dlg_new_dialog function is successful, it returns RTNORM and sets the handle argument with a handle name. When an error occurs, this function returns RTERROR and sets the handle argument with NULL.

NOTE After you use dlg_new_dialog the first time to initialize a dialog box, then use the dlg_new_dialog_positioned function to display a dialog box at a specific screen location.

See Also

dlg_load_dialog

dlg_start_dialog

Programming Overview of SDS


DLG_new_dialog_positioned
int dlg_new_dialog_positioned (char *dialog, int dcl-file, void *callback, int x, int y, sds_hdlg *handle);

"Display a dialog box at a specific location."	SDS Function

Use this function to display a dialog box at a specific location on the screen. This function is meant to be used the second time you open this dialog box. Because you do not know what the size of the IntelliCAD® window will be, use the dlg_new_dialog function the first time you initialize the dialog box.

The dialog box is identified by dialog within the DCL file named dcl-file. The string dialog is obtained from the dlg_load_dialog function.

The dlg_new_dialog function optionally executes the routine identified by the callback argument. To ignore this argument, use NULLCB.

The x and y arguments are the coordinates of the lower-right corner of the dialog box. The upper-left coordinates are (0,0). You should get the x,y coordinates frof dlg_done_positioned_dialog. When x and y are both set to -1, IntelliCAD opens the dialog box in the center of the window.

When the dlg_new_dialog_positioned function is successful, it returns RTNORM and sets the handle argument with a handle name. When an error occurs,  this function returns RTERROR and sets the handle argument with NULL.

See Also

dlg_load_dialog

dlg_start_dialog

Programming Overview of SDS


sds_newrb
struct sds_resbuf *sds_newrb (int result);

"Create a new result buffer."	SDS Function

This function creates a new result buffer.

The argument result can be any of the result types (e.g. RTREAL) or any of the DXF group codes present in object definitions.

Example

struct sds_resbuf *newbuffer;

newbuffer=sds_newrb(RTREAL);

newbuffer->resval.rreal=121.50;

sds_printf("\nThe Real in the new buffer is %f.",newbuffer->resval.rreal);

sds_relrb(newbuffer);

See Also

Programming Overview of SDS


sds_osnap
int sds_osnap (const sds_point point, const char *mode, sds_point answer);

"Find a point based on this snap mode and point."	SDS Function

This function uses the specified object snap mode(s) to determine the resulting point, given a 3-D point.

The argument point is a 3-D point, which is the center of a square area defined by the system variable APERTURE. Sds_osnap looks for the object selected by this point.

The mode argument is the snap mode or modes used to find the resulting point :

Mode	Meaning
"nea"	NEArest
"end"	ENDpoint
"mid"	MIDpoint
"cen"	CENter
"per"	PERpendicular
"tan"	TANgent
"qua"	QUAdrant
"ins"	INSertion
"po"	POint
"int"	INTersection (3D intersection)
"pla"	PLAnview (2D intersection)
"vis"	VISible (apparent intersection)
"off"	Off
Note: Separate multiple object snap modes with a comma, such as: "tan, qua, cen".

The argument answer is the 3-D point determined by the original point and the snap mode, such as the end of a line.

This function returns RTNORM (when it finds a point); otherwise, it returns an error code.

See Also

Programming Overview of SDS


sds_pmtssget
int sds_pmtssget (const char *msg, const char *method, void *point1, const void  *point2, const struct sds_resbuf *filter, sds_name newset, const int omitss);

"Display a selective prompt for getting objects."	SDS Function

This function is like the sds_ssget function but allows you to specify the wording of the prompt, according to the situation. Pmtssget is short for prompted ssget. The sds_pmtssget function is unique to IntelliCAD®.

This function will allocate and point point1 to a single point when the user selects one point. Or, this will be a list of points when the user selects Crossing (for Stretch). If multiple selection methods are used, they are chained together. There are no result buffers added to the list for removals.

The argument msg determines how this function operates:

Msg	Meaning
NULL	The sds_pmtssget function acts exactly like the sds_ssget function.
non-NULL	The function takes into account the method and omitss arguments.
The argument method determines how this function selects objects:

Method	Meaning
""	Single mode.

The following characters are prefixes:

*	Only the passed string is used, and no other options are appended; multiple mode is enabled.
&	The passed string is appended to the beginning of the "big list" for entity selection; multiple mode is forced.
The * and & prefixes work with the following selection key words: Window, Crossing, Last, Box, All, Fence, WPolygon, and CPolygon.

Mode	Meaning	Points
"B"	Box	point 1 point 2
"C"	Crossing	point1 point2
"CP"	Crossing Polygon	points-list
"F"	Fence	points-list
"L"	Last	none
"W"	Window	point1 point2
"WP"	Window Polygon	points-list
"X"	All	none
The argument point1 (and many times point2) specifies the pick point for the selection mode, as shown by the above table.

Note: You must set point1 to NULL before calling this function.

The argument filter is a list that specifies object properties in dotted-pair format, such as:

(ssget "X" '((0 . "CIRCLE") (62 . 1)))

which selects all circles colored red (color 1). In addition, the special dotted-pair of -4 lets you include a relational test, such as:

(ssget "X" '((0 . "CIRCLE") (62 . 1) (-4 . "<") (40 . 15.0))

which selects all red circles less than 15 units in radius.

For the purposes of this function, the operators recognized by IntelliCAD are:

Operator	Meaning
"&"	Bitwise AND (integers only).
"&="	Bitwise masked equals (integers only).
"*"	All.
"="	Equals.
"!="	Not equal to.
"/="	Not equal to.
"<>"	Not equal to.
"<"	Less than.
"<="	Less than or equal to.
">"	Greater than.
">="	Greater than or equal to.
NOTE The operators listed above are used with integers. The bitwise operators cannot be used with real numbers. The "*" operator is the only one that can be used with strings.

The argument newset is the name of the selection set.

The argument omitss determines whether or not the selected objects are placed in the previous selection set:

Omitss	Meaning
0	Selected objects are placed in the previous selection set. In this case, sds_pmtssget works like sds_ssget.
1	Selected objects are not placed in previous selection set.
When you set any key words, this function returns RTKWORD.

See Also

Programming Overview of SDS


sds_point_set
void sds_point_set (sds_point point1, sds_point point2);

"Copy a point from one variable to another."	SDS Function

This function copies a point from one variable to another. This sds_point_set function is unique to the implementation of SDS™ included with IntelliCAD®.

The argument point1 is contains the 3-D source point.

The argument point2 is the destination for the 3-D point.

See Also

Programming Overview of SDS


sds_polar
void sds_polar (const sds_point point, double angle, double dist, sds_point result);

"Find a point, using polar coordinates."	SDS Function

This function gives the point resulting from a given center point, angle, and distance.

The argument point is the center point for the polar coordinate system.

The angle argument is the angle, counter-clockwise from a line extending horizontally to the right, along which the point will be located.

The dist argument is the distance along the line, from the center point to the resulting point.

The result argument is the point on the line.

This function does not return a value.

Example

sds_real angle,dist;

sds_point point1,returnp;

sds_getpoint(NULL,"\nPick the center pt for the polar function: ",point1);

sds_getangle(NULL,"\nEnter an angle: ",&angle);

sds_getdist(NULL,"\nEnter a distance: ",&dist);

sds_polar(point1,angle,dist,returnp);

sds_printf("\nThe point is (%f,%f,%f)",returnp[0],returnp[1],returnp[2]);

See Also

Programming Overview of SDS


sds_printf
int sds_printf (const char *format, ...);

"Print this at the command line."	SDS Function

This function prints a given string to the command line. Although this function looks identical to the C-language printf function, the SDS version prints to the command line and Prompt History window.

The argument format is the text to be printed to the screen. The maximum string length is 132 characters. You should enclose the text in double-quotes. The argument can include escape sequences (such as \n or \t) and references to variables (such as %f or %s), which are listed, in order, immediately after the string.

This function returns RTNORM or an error code.

Example

char food[512];

sds_getstring(1,"\nWhat is your favorite food? ",food);

sds_printf("\nYou must really like %s.",food);

See Also

Programming Overview of SDS


sds_progresspercent
int sds_progresspercent (int pcdone);

"Display the % of progress."	SDS Function

This function displays a percentage-completed gas gauge. The sds_progresspercent function is unique to the implementation of SDS™ included with IntelliCAD®.

The argument pcdone is an integer that indicates the percentage completed. The value of this argument is between 0 and 100 and should reflect a percentage.

See Also

sds_progressstart

sds_progressstop

Programming Overview of SDS


sds_progressstart
int sds_progressstart (void);

"Start the progress dialog box."	SDS Function

This function displays a percentage-completed gas gauge. The sds_progressstart function is unique to the implementation of SDS™ included with IntelliCAD®.

See Also

sds_progresspercent

sds_progressstop

Programming Overview of SDS


sds_progressstop
int sds_progressstop (void);

"Dismiss the progress dialog box."  	SDS Function

This function dismisses the percentage-completed gas gauge. The sds_progressstop function is unique to the implementation of SDS™ included with IntelliCAD®.

See Also

sds_progresspercent

sds_progressstart

Programming Overview of SDS


sds_prompt
int sds_prompt (const char *prompt);

"Prompt the user."	SDS Function

This function displays a prompt on the command line. The prompt argument is a string.

This function returns SDS_RTNORM or an error code.

See Also

Programming Overview of SDS


sds_putsym
int sds_putsym (const char *symbol, struct sds_resbuf *value);

"Set this LISP symbol to that value."	SDS Function

This function finds or creates a LISP symbol and stores a value.

The argument symbol is the name of the LISP symbol in which you want to store a given value. When this symbol already exists, the value is simply stored there. If not, it is created, then the value is stored in it.

The argument value is the result buffer from which the value is obtained.

This function returns RTNORM or RTERROR with an error code.

Example

struct sds_resbuf valuein;

valuein.restype=RTREAL;

valuein.resval.rreal=121.50;

sds_putsym("LISPsym",&valuein);     // Put value in symbol "LISPsym

See Also

sds_getsym

Programming Overview of LISP


sds_readaliasfile
int sds_readaliasfile (char *filename);

"Read a PGP file."	SDS Function

This function loads a *.PGP file into IntelliCAD®'s aliases.

The argument filename is the name of the PGP file (the file in which the AutoCAD® command aliases have been defined).

See Also

Programming Overview of SDS


sds_realloc
void *sds_realloc (void *memloc, size_t bytes);

"Change the size of a memory allocation."	SDS Function

This function changes the size of memory that has been previously allocated. The contents of the memory region are preserved if the size is increased; some contents may be lost when the memory size is decreased.

The argument memloc is a pointer to the memory region.

The bytes argument is the new size of the memory allocation.

This function returns a pointer to the memory region. If the function fails, it returns null.

See Also

Programming Overview of SDS


sds_redraw
int sds_redraw (const sds_name entity-name, int mode);

"Redraw that, like this"	SDS Function

This function redraws the specified object(s) or the entire viewport.

The argument entity-name defines what is to be redrawn. When this argument is NULL, the entire viewport is redrawn.

The argument mode describes how the specified objects are to be redrawn:

Mode	Descriptions
1 or -1	Redraw the specified object(s).
2 or -2	Disappear the specified object(s).
3 or -3	Highlight the specified object(s).
4 or -4	Redraw highlighted object(s) in normal (non-highlighted) mode.
When you are working with complex objects, such as polylines, use the positive value to update all the parts of the object; use the negative value to update only the first part.

This function returns RTNORM or an error code.

Example

sds_name entity1;

sds_point point1;

sds_entsel("\nPick another object: ",entity1,point1);

sds_redraw(NULL,4);	\\ Un-highlights everything.

sds_redraw(entity1,3);	\\ Highlights selected object.

See Also

sds_grclear

Programming Overview of SDS


sds_regapp
int sds_regapp (const char *appname);

"Register extended entity data."	SDS Function

This function adds the application name to the drawing's list of registered applications. You can register as many applications as you like in each drawing.

The appname argument is the name of the application to be registered. This argument is limited to 32 characters.

This function returns RTNORM or an error code if the application is already registered

Example

sds_regapp("mybase");

See Also

sds_regfunc

Programming Overview of SDS


sds_regfunc
int sds_regfunc (int (*function) (void), int funcode);

"Register an external function."	SDS Function

You can register any function that is in your SDS application but outside of main. This allows you to call it directly, without going through the dispatch loop. To be used in this way, the function must not require any arguments (be of type "(void)" ), and must return an int.

The argument int (*function) (void) is the name of the function just as in the code, and not necessarily the same as the name you specified when you defined the function using sds_defun.

The argument funcode is the code number you specified for the function in sds_defun.

This function returns RTNORM or RTERROR.

Example

sds_defun("C:MYCOMMAND"  ,6);

sds_regfunc(MYCMDFUNC    ,6);

See Also

sds_regapp

Programming Overview of SDS


sds_relrb
int sds_relrb (struct sds_resbuf *buffer);

"Release this result buffer."	SDS Function

This function releases a result buffer structure, as well as all following result buffers that appear in a linked list. Use this function each time you are done with a result buffer.

The argument buffer is the result buffer to be freed.

This function returns RTNORM or an error code.

Example

struct sds_resbuf *entlist = NULL;

. . .

if (entlist != NULL)         // If there's anything in the entlist...

    sds_relrb(entlist);      // Release it.

entlist = NULL;              // Make it a NULL pointer - a good idea.

See Also

Programming Overview of SDS


sds_retint
int sds_retint (int integer);

"Return this integer to LISP."	SDS Function

This function returns an integer value to LISP. The argument integer is an integer. This function returns RTNORM.

See Also

Programming Overview of SDS


sds_retlist
int sds_retlist (const struct sds_resbuf *list);

"Return this list to LISP."	SDS Function

This function returns a list to LISP.

The argument list is a pointer to the first structure in a linked list that is to be returned to LISP as a list. The list can of be any length but must only contain these result type codes: RT3DPOINT, RTANG, RTDOTE., RTENAME, RTLB, RTLE, RTNIL, RTORINT, RTPICKS, RTPOINT, RTREAL, RTSHORT, RTSTR, and RTT.

This function returns RTNORM (when it is successful) or returns RTERROR (when there is an error is list argument).

Example

struct sds_resbuf *listbuf;

listbuf=sds_buildlist(RTREAL,3.57,RTSHORT,12,RTSTR,"Test String",RTNONE);

sds_printf("\nsds_retlist returns:  ");

sds_retlist(listbuf);

sds_relrb(listbuf);     //Release memory

// LISP receives:  (3.57 12 "Test String")

See Also

sds_buildlist

Programming Overview of SDS


sds_retname
int sds_retname (const sds_name name, int flag);

"Return this set or object to LISP."	SDS Function

This function returns the name of a selection set or object to LISP.

The argument name is the name of the object or selection set.

The argument flag can be:

Flag	Meaning
SDS_RTENAME	name is the name of an object.
SDS_RTPICKS	name is the name of a selection set.
This function returns RTNORM (if it is successful) or RTERROR (when it fails or name is null).

Example

sds_name itsname;

int itstype;

sds_entlast(itsname);

sds_printf("\nsds_retname(itsname,itstype) returns:  ");

sds_retname(itsname,itstype);

See Also

Programming Overview of SDS


sds_retnil
int sds_retnil (void);

"Return nil to LISP."	SDS Function

This command returns nil to LISP.

NOTE Although the raison d'etre of this function at first seems unclear, it does have a purpose. The sds_retnil function can signal an error, an empty list, or the success of an external void function.

Example

sds_retnil;

See Also

Programming Overview of SDS


sds_retpoint
int sds_retpoint (const sds_point point);

"Return this 3D point to LISP."	SDS Function

This function returns a point to LISP.

The argument point represents the 3-D point to be returned to LISP. It must be an array of three double-precision real numbers.

This function returns just RTNORM.

Example

sds_point point1;

point1[0]=10.0;

point1[1]=5.75;

point1[2]=0.0;

sds_retpoint(point1);

See Also

Programming Overview of SDS


sds_retreal
int sds_retreal (double real);

"Return this real number to LISP."	SDS Function

This function returns a real value to LISP.

The argument real is the real value to be returned to LISP. It must be a double-precision real number.

This function returns just RTNORM.

Example

sds_retreal(12.3456789);

See Also

Programming Overview of SDS


sds_retstr
int sds_retstr (const char *string);

"Return this string to LISP."	SDS Function

This function returns a string to LISP.

The argument string is the string to be returned to LISP. It must be no longer than 503 characters; the 504th character is the end-of-string character.

This function returns RTNORM, or RTERROR if the string is a NULL pointer or if sds_retstr fails.

Example

sds_retstr("A string");

See Also

Programming Overview of SDS


sds_rett
int sds_rett (void);

"Return True to LISP."	SDS Function

This function returns the T (short for true) symbol to LISP.

This function returns just RTNORM.

Example

sds_rett();

See Also

Programming Overview of SDS


sds_retval
int sds_retval (const struct sds_resbuf *value);

"Return this value to LISP."	SDS Function

This function returns the value contained in the result buffer to LISP.

The argument value is a result buffer containing any of the usual types, which may be returned to the calling LISP function.

This function returns RTNORM or RTERROR.

Example

struct sds_resbuf *argbuf;

sds_getsym("argument",&argbuf);

if(argbuf==NULL) return(RTERROR);

sds_printf("\nThe type is %i.",argbuf->restype);

switch(argbuf->restype){

    case RTREAL:

    	sds_printf("\nThe value is %f. ",argbuf->resval.rreal);

    	break;

    // And so on through the other cases.

    }

sds_retval(argbuf);

See Also

Programming Overview of SDS


sds_retvoid
int sds_retvoid (void);

"Return void to LISP"	SDS Function

This function returns nothing to LISP. Since LISP only returns the last value sent to it, you can use sds_retvoid to cause LISP to return nothing. Use this as the last function to keep from printing what would have otherwise been the last function.

This function returns just RTNORM.

Example

sds_retvoid();

See Also

Programming Overview of SDS


sds_rtos
int sds_rtos (double real, int format, int places, char *string);

"Change this real number to a string."	SDS Function

This function converts a given real number to a string, formatted in one of five ways.

The argument real is the real number to be converted.

The argument format is the type of string to which sds_rtos will convert the given real number:

Format	Meaning	Example
1	Scientific units	635e-1
2	Decimal units	63.500
3	Engineering units	5'3.5"
4	Architectural units	5'3-1/2"
5	Fractional units	63-1/2"
The argument places represents the number of decimal places to which the number in the string is displayed. To use the default (as specified by the LUPREC system variable), use -1.

The argument string is the given number, converted to a string, according to the specified format and number of decimal places.

This function returns RTNORM or an error code.

Example

int format=1;

sds_real real1;

char string1[512];

sds_getreal("\nEnter any real number: ",&real1);

sds_rtos(real1,format,-1,string1);

sds_printf("\nThat's %s in scientific notation.",string1);

See Also

Programming Overview of SDS


sds_sendmessage
int sds_sendmessage (const *string);

"Send a message."  	SDS Function

This function sends a message to the IntelliCAD® command line. The sds_sendmessage function is unique to IntelliCAD's implementation of SDS™.

The argument *string is the message you want to send to the command line.

See Also

Programming Overview of SDS


sds_setcallbackfunc
int sds_setcallbackfunc (int flag, void *arg1, void *arg2, void *arg3);

"IntelliCAD… call me at this function."	SDS Function

This function monitors callbacks from IntelliCAD commands and sends them to a specified function. For example, IntelliCAD sends a callback that it is going to erase an entity before doing so. This callback could be sent to the function specified by sds_setcallbackfunc..

The sds_setcallbackfunc function is unique to IntelliCAD's implementation of SDS™.

Example

Suppose you need to know whenever the ERASE command is used in IntelliCAD so that application-specific data can be stripped from entities before they are erased. You create a function named cbfunc to monitor callbacks from IntelliCAD so you can trap all uses of the ERASE command.

First, you would issue the following when your SDS application is loaded:

sds_setcallbackfunc(cbfunc);

From then on, all callbacks from IntelliCAD will pass through cbfunc. When the ERASE command is used in IntelliCAD, cbfunc will detect it, as in the following section of code:

int cbfunc(int flag,void *arg1,void *arg2,void *arg3)

{

int res = RTNORM;

switch (flag) {

// Command Start/End.

case SDS_CBCMDBEGIN:

// arg1="command name"     cast as (char *)

// Callback return RTERROR will cause command to not be called.

// Any processing needed for the erase command goes here.

// For example, if you wanted to disable the erase command to

// prevent users from erasing entities, you could use the

// following code:

if (!stricmp(arg1, "erase"))

res = RTERROR;

break;

case default:

break;

}

return res;

}

As the comment above indicates, the callback return of RTERROR will cause the command not to be issued. This is because IntelliCAD broadcasted the fact that it is about to run the ERASE command. The program intercepted ERASE so a different action could be taken. If you wanted to know when the ERASE command had been completed, you could add a case for SDS_CBMDBEGIN and compare the argument sent by IntellCAD to see if it is what you are looking for.

See Also

Programming Overview of SDS


sds_setfunhelp
int sds_setfunhelp (char *function, char *helpfile, char *topic, int flag);

"Register help for SDS™ commands."  	SDS Function

This function registers help topics for SDS™ commands that are used in IntelliCAD®. This function works with any SDS and LISP command prefixed by C: (to turn it into a command).

The argument function is the name of the SDS or LISP function.

The argument helpfile is the name of the HLP file containing the help text.

The argument topic is the name of a topic within the help file, such as a command name. When this argument is missing, IntelliCAD displays the first topic of the help file.

The argument flag displays one of the following:

Flag	Meaning
help_contents	Display the initial topic in the HLP file.
help_helponhelp	Display help on using help.
help_partialkey	Display the Search dialog box using topic as the search text.
This function returns RTNORM or RTERROR.

Notes

Use the sds_help function to call Help from a dialog box Help button.

For more information about creating a dialog box with a Help button, see these topics in the DCL Programming Reference: ok_cancel_help,  ok_cancel_help_errtile,  ok_cancel_help_info.

See Also

Programming Overview of SDS


DLG_set_tile
int dlg_set_tile (sds_hdlg handle, char *key, char *value);

"Set the value of the dialog box tile."	SDS Function

This function sets the value of a dialog box tile.

The handle argument is the name of the dialog box.

The key argument is a case-sensitive string that specifies the tile.

The value attribute is the value to assign to the tile.

The function returns RTNORM if successful; otherwise, it returns an error code.

See Also

dlg_get_tile

Programming Overview of SDS


sds_setvar
int sds_setvar (const char *sysvar, const struct sds_resbuf *result);

"Set this variable to this value."	SDS Function

This function sets an IntelliCAD® system variable to a new value.

The argument sysvar represents the system variable whose value is to be set.

The result argument is the new value for the above variable.

This function returns RTNORM or RTERROR.

Example

char sysvar[512];

struct sds_resbuf rb1;

sds_getstring(0,"\nEnter a variable name:  ",sysvar);

sds_getvar(sysvar,&rb1);

switch(rb1.restype){

   . . .

   case RTREAL:

      sds_printf("\n %s is currently %f. ",sysvar,rb1.resval.rreal);

      sds_getreal("\nEnter a new real number: ",&rb1.resval.rreal);

      sds_setvar(sysvar,&rb1);

      sds_printf("\n%s is now set at %f. ",sysvar,rb1.resval.rreal);

      break;

   . . .

}

See Also

sds_getvar

Programming Overview of SDS


sds_setview
int sds_setview (const struct sds_resbuf *views, int vport);

"Set a 3-D viewpoint."  	SDS Function

This function changes the 3-D viewpoint of a specified viewport.

The views argument is pointer to a list of result buffers. It does not look like the simple x,y,z coordinates, such as '(1.0 2.0 3.0), that you might expect from the Viewpoint command. Instead, views requires the view descriptor table as returned by the sds_tblsearch function.

One way to create the viewpoint data is with the View Save command.

The vport argument is specifies the viewport number. When you have a single viewport, its value is 2. To use the current viewport, set vport to 0. To get the number of the current viewport, use the Cvport system variable.

This function returns RTNORM or RTERROR.

See Also

Programming Overview of SDS


DLG_slide_image
int dlg_slide_image (int x, int y, int width, int height, char *name);

"Display a slide in the dialog box."	SDS Function

This function displays an image in a dialog box. The image is positioned at x,y coordinates. These coordinates are the upper-left corner of the image.

The width argument specifies the relative width of the image in the negative x-direction. The height argument specifies the relative height of the image in the negative y-direction. The origin is the upper-left corner of the image.

 The name argument is the name of the snapshot file, which can be in EMF (enhanced metatfile), WMF (windows metafile), or SLD (slide) format.

Notes

Use the MSlide command to create an image. For good reproduction, create the snapshot at the same size and aspect ratio (usually 4:3) that you plan to display the image in the dialog box.

Obtain the coordinates of the lower-right corner by calling the dlg_dimension_tile function

This function returns RTNORM if successful; otherwise, it returns an error code.

See Also

Programming Overview of SDS


sds_snvalid
int sds_snvalid (const char *tblname, int pipe);

"Determine whether the symbol table has valid characters."	SDS Function

This function determines whether the symbol table contains valid characters.

The tblname argument is the name of a table, including "LAYER", "LTYPE", "VIEW", "STYLE", "BLOCK", "UCS", "VPORT", "DIMSTYLE", and "APPID."

The pipe argument toggles whether the vertical bar ( |  or "pipe") character is valid:

Flag	Meaning
0	Vertical bar is not permitted.
1	Vertical bar is permitted.
This function returns RTNORM or an error code.

See Also

Programming Overview of SDS


sds_ssadd
int sds_ssadd (const sds_name entity-name, const sds_name setname1, sds_name setname2);

"Add this object to that selection set."	SDS Function

This function adds an object to the specified selection set and stores the updated set by another name. If an object is given, but no name, the sds_ssadd function creates a new set containing only the given object.

The argument entity-name is the entity name of the object to be included in the set.

The argument setname1 is the existing selection set and can be NULL.

The argument setname2 is the resulting selection set. The object has been added to this set..

This function returns RTNORM or an error code.

Example

sds_name entname1,entname2,setname1,setname2;

sds_point point1;

sds_entsel("\nPick an object: ",entname1,point1);

sds_ssadd(entname1,NULL,setname1);

sds_entsel("\nPick another object to add to the set: ",entname2,point1);

sds_ssadd(entname2,setname1,setname2);

See Also

sds_ssdel

Programming Overview of SDS


sds_ssdel
int sds_ssdel (const sds_name entity-name, const sds_name setname);

"Remove this object from this selection set."	SDS Function

This function removes a given object from a given selection set.

The argument entity-name is the object to be removed from the selection set.

The argument setname is the set from which the object will be removed.

This function returns RTNORM or an error code.

Example

sds_printf("\nNow removing the first object from the set...");

sds_ssdel(entname1,setname1);	// Delete the first object.

returni=sds_ssmemb(entname1,setname1);	// Is the first object there?

if (returni==RTNORM)

    sds_printf("\nAn error has occured...the first object was not deleted. ");

else

    sds_printf("\nThe first object was successfully deleted from the set. ");

See Also

sds_ssadd

Programming Overview of SDS


sds_ssfree
int sds_ssfree (sds_name setname);

"End use of this selection set. Free it."	SDS Function

This function frees the selection set since IntelliCAD® is limited to having 128 selection sets total.

The argument setname is the selection set to be freed.

This function returns RTNORM or an error code.

Example

int returni = sds_ssfree(setname1);

if (returni != RTNORM)

sds_printf("\nAn error has occured... the set was not freed. ");

See Also

Programming Overview of SDS


sds_ssget
int sds_ssget (const char *mode, const void *point1, const void *point2, const struct sds_resbuf *filter, sds_name setname);

"Make a new set of objects, based on this."	SDS Function

This function gets a whole new selection set of objects, using the specified selection method and is limited by a filter.

The mode argument specifies the object selection method:

Mode	Meaning	Points
NULL	(none) Single pick point	point1
"B"	Box	point1 point2
"C"	Crossing	point1 point2
"CC"	Crossing Circle	point1 point2
"CP"	Crossing Polygon	points-list
"F"	Fence	points-list
"I"	Implied	none
"L"	Last	none
"O"	Outside	points-list
"OC"	Outside Circle	point1 point2
"OP"	Outside Polygon	points-list
"P"	Previous	none
"PO"	POint	point1
"W"	Window	point1 point2
"WC"	Window Circle	point1 point2
"WP"	Window Polygon	points-list
"X"	All	none
Notes

The "I" mode creates an "implied" selection set of objects selected while system variable PICKFIRST is on.

The "PO" mode selects all closed objects covering the specified point.

The point1 (and many times point2) argument specifies the pick point for the selection mode, as noted in the table above.

The filter argument is a list that specifies object properties in dotted-pair format, such as selecting all circles colored red (color 1). In addition, the special dotted-pair of -4 lets you include a relational test, which selects all red circles less than 15 units in radius. The operators recognized by IntelliCAD are:

Operator	Meaning
"="	Equals.
"!="	Not equal to.
"/="	Not equal to.
"<>"	Not equal to.
"<"	Less than.
"<="	Less than or equal to.
">"	Greater than.
">="	Greater than or equal to.
"*"	All.
The following are not used with real numbers:

"&" 	Bitwise AND (integers only).

"&=" 	Bitwise masked equals (integers only).

The "*" operator is the only that can be used with strings.

The setname argument holds the resulting selection set.

Notes

The current object snap setting is ignored by the sds_ssget function.

When the selection set is used in model space, paper space objects are not selected, and vice versa: objects from the drawing space not currently in effect are filtered out.

See Also

Programming Overview of SDS


sds_ssgetfirst
int sds_ssgetfirst (struct sds_resbuf **gripped, struct sds_resbuf **selected);

"Determine which objects are highlighted and/or gripped."	SDS Function

This function reports the number of objects in drawing that are highlighted (selected) and gripped. Grips are the small squares that surround an object. The sds_ssgetfirst function returns a list with two elements: the first element a selection set of objects that are gripped but not selected; the second element is a selection set of objects that are gripped and selected.

The gripped argument points to a result buffer containing a selection set of objects that are currently gripped in the drawing. When no objects are gripped, the result is null.

The selected argument points to a result buffer containing a selection set of objects that are currently selected in the drawing. When no objects are selected, the result is null.

This function returns RTNORM or RTREJ.

See Also

Programming Overview of SDS


sds_sslength
int sds_sslength (const sds_name setname, long *number);

"Determine the number of objects in this set."	SDS Function

This function finds the number of objects in a selection set.

The argument setname is the selection set for which you wish to find the number of objects.

The argument number represents the number of objects in the selection set. Note that this is a long, not an int, because there can be more objects in a set than an integer (65,535) can represent.

This function returns RTNORM or an error code.

Example

long setlen;

sds_name setname1;

sds_sslength(setname1,&setlen);

sds_printf("\nThere are %li objects in the set. ",setlen);

See Also

Programming Overview of SDS


sds_ssmemb
int sds_ssmemb (const sds_name entity-name, const sds_name setname);

"Determine whether this object is in this set."	SDS Function

This function determines whether an object is a member of the selection set.

The argument entity-name represents the object in question.

The setname argument represents the selection set.

This function returns RTNORM or RTERROR. Check system variable ERRNO for the error code.

See Also

Programming Overview of SDS


sds_ssname
int sds_ssname (const sds_name setname, long index, sds_name entity-name);

"Get the nth object from this set."	SDS Function

This function gets the name of an object, given the selection set name and the index for the item.

The argument setname is the selection set from which you want to get the object.

The argument index represents the object from the set. The first item is #0, the second item is #1. Use the sds_sslength function to first determine the number of items in the selection set, and then subtract 1 to get the highest index number. Since there may be more than 65,535 items in the selection set, this argument is a long integer.

The entity-name argument represents the name of the object at the position index in the set.

This function returns RTNORM or an error code.

Example

int returni;

long setlen,index;

char string1[512];

sds_name entnameX,setname1;

while (index < setlen){

    returni=sds_ssname(setname1,index,entnameX);

    if (returni != RTNORM)

        sds_getstring(0,"\nNot able to find the object. ",string1);

    else{

        sds_redraw(entnameX,3);     // Highlights the object.

        index++;

    }

}

See Also

Programming Overview of SDS


sds_sssetfirst
int sds_sssetfirst (const sds_name grips, const sds_name select);

"Highlight and/or grip these objects."	SDS Function

This function causes objects in a drawing to be gripped and/or highlighted (selected). Grips are the small selection squares that surround an object.

The grips argument is a selection set of objects to be gripped in the drawing.

The select argument is a selection set of objects to be selected in the drawing

This function returns RTNORM or RTREJ.

See Also

Programming Overview of SDS


DLG_start_dialog
int dlg_start_dialog (sds_hdlg handle, int *status);

"Start that dialog box."	SDS Function

This function displays a dialog box and accepts user clicks of the mouse.

The handle argument is the name of the dialog box.

This function returns a code in the status argument, which is later used by the dlg_done_dialog function:

Status	Meaning
DLGOK	User clicked OK button.
DLGCANCEL	User clicked Cancel button.
DLGALLDONE	The dlg_term_dialog function was used.
NOTE A dialog box is first initialized by the dlg_new_dialog function.

See Also

dlg_done_dialog

dlg_new_dialog

dlg_term_dialog

Programming Overview of SDS


DLG_start_image
int dlg_start_image (sds_hdlg handle, char *key);

"Start creating a dialog box image."	SDS Function

This function signals the start of the image key in a dialog box. This function is used to precede the other dialog box drawing functions: dlg_fill_image, dlg_slide_image, and dlg_vector_image. End the drawing with the dlg_end_image function.

The handle argument is the name of the dialog box.

The key argument identifies the tile.

This function returns RTNORM if successful; otherwise, it returns an error code.

See Also

dlg_fill_image

dlg_slide_image

dlg_vector_image

Programming Overview of SDS


DLG_start_list
int dlg_start_list (sds_hdlg handle, char *key, int value, int item);

"Start processing a list box."	SDS Function

This function signals the start of processing a list key in a dialog box.

The handle argument is the name of the dialog box.

The key argument identifies the tile.

The optional value argument describes the list operation to be performed (default = 3):

Value	Symbol	Meaning
1	LIST_CHANGE	Change contents of the list.
2	LIST_APPEND	Append new data to the list.
3	LIST_NEW	Replace the list with a new one (default).
The optional index argument is used only when operation = 1. It indicates the item # to be changed. The first item is #0; the second item is #1, etc.

This function returns RTNORM if successful; otherwise, it returns an error code.

See Also

dlg_add_list

dlg_end_list

Programming Overview of SDS


sds_swapscreen
int sds_swapscreen (void);

"Display the other window."	SDS Function

This function displays the other window. IntelliCAD® has two windows: the drawing window and the Prompt History window. When one is covered by the other, this function displays the hidden window.

The sds_swapscreen function is unique to IntelliCAD.

The function has no arguments.

See Also

Programming Overview of SDS


sds_tblnext
struct sds_resbuf *sds_tblnext (const char *tablename, int flag);

"Get me the next item in the table."	SDS Function

This function finds the first (or next, depending on the flag) instance of a symbol type in the drawing table.

The argument tablename represents the name of symbol type to search for. Valid tablenames are:

Table Name	Meaning
“appid”	Application identification.
“block”	Block names.
“dimstyle	”Dimension style names.
“layer”	Layer names.
“ltype”	Linetype names.
“style”	Text style names.
“view”	View names.
“ucs”	UCS names.
“vport”	Viewport names.
The sds_tblnext function first returns the first specified symbol in the table. When the symbol is found, it is returned as a list of dotted pairs. Used repeatedly, the next symbol is returned in order. When no more symbols exist in the list, nil is returned.

When the flag argument is supplied (typically 1), the search begins from the top (beginning) of the table.

This function sets a value in system variable ERRNO describing the error.

Example

char *tablename[]={"APPID", "BLOCK", "DIMSTYLE", "STYLE", "LAYER",

                   "LTYPE", "UCS", "VIEW", "VPORT"};

char lookfor[512];

int types;

struct sds_resbuf *nextbuf    = NULL;

for (types=0; types<sizeof(tablename)/sizeof(tablename[0]); types++) {

    for (nextbuf=sds_tblnext(tablename[types],1); nextbuf!=NULL;

         nextbuf=sds_tblnext(tablename[types],0)) {

            ob_listdxf(nextbuf);

            sds_relrb(nextbuf);	// release the buffer

}

sds_printf("\nTested %s.",tablename[types]);

}

nextbuf=NULL;

    sds_printf("\nDone testing sds_tblnext. ");

See Also

Programming Overview of SDS


sds_tblsearch
struct sds_resbuf *sds_tblsearch (const char *tblname, const char *symbol, int flag);

"Search a table for a symbol."	SDS Function

This function obtains information about a known symbol from a drawing tblname. After entering in the tblname argument and the known symbol name, a list is returned containing dotted pairs for the symbol.

The flag (when set non-nil, such as 1) lets the sds_tblnext function retrieve the next item in the table:

The list returned is exactly like that returned from sds_tblnext.

This function returns the data as a linked list of result buffers, using DXF group codes and values. Otherwise, it returns NULL.

See Also

Programming Overview of SDS


sds_tblobjname
int sds_tblobjname (const char *tblname, const char *this-entity, sds_name entity-name);

"Determine the name of the object associated with that symbol."	SDS Function

This function returns the entity name of a specified symbol table entry. The tblobjname function searches the symbol table tblname for entity-name. It returns entity-name of that symbol table entry.

Valid tblnames are:

Table Name	Meaning
“appid”	Application identification.
“block”	Block names.
“dimstyle”	Dimension style names.
“layer”	Layer names.
“ltype”	Linetype names.
“style”	Text style names.
“view”	View names.
“ucs”	UCS names.
“vport”	Viewport names.
Default symbol names are:

Symbol	Meaning
"CONTINUOUS"	Default linetype.
"0"	Default layer.
"STANDARD"	Default text style.
"STANDARD"	Default dimension style.
This function returns an error code, depending on the success or failure of locating the entity name.

NOTE This function is typically used to pass an entity name to the sds_entget and sds_entmod functions.

See Also

Programming Overview of SDS


DLG_term_dialog
int dlg_term_dialog (void);

"Terminate all dialog boxes."	SDS Function

This function terminates all dialog boxes. This function is especially useful for closing several nested dialog boxes all at once.

This function only returns RTNORM.

See Also

dlg_unload_dialog

Programming Overview of SDS


sds_textbox
int sds_textbox (const struct sds_resbuf *entity-name, sds_point point1, sds_point point2);

"Determine the x,y-dimensions of this text object."	SDS Function

This function returns the relative 2-D coordinates of a box that encloses a text object. The lower-left corner is always (0,0).

The argument entity-name must refer to a text object or attributes, but not text in dimensions and blocks.

This function sets point1 to 0,0 and sets point2 to the maximum coordinates of a rectangle bounding the text.

This function returns RTNORM or RTERROR with an error number in system variable ERRNO.

See Also

Programming Overview of SDS


sds_textpage
int sds_textpage (void);

"Switch to the cleared text window."	SDS Function

This function switches to the text window from the graphics window. This functions differs from sds_textscr in that this function clears the text screen first.

This function returns RTNORM or RTERROR.

Example

char string1[512];

sds_getstring(0,"\nTo switch to the text screen, press Enter. ",string1);

sds_textpage();

See Also

sds_textscr

sds_graphscr

Programming Overview of SDS


sds_textscr
int sds_textscr (void);

"Switch to the text window with text."	SDS Function

This function switches to the text screen from the graphics screen. This function differs from sds_textpage in that this function does not first clear the text screen.

This function returns RTNORM or RTERROR

Example

char string1[512];

sds_getstring(0,"\nTo switch to the text screen, press Enter. ",string1);

sds_textscr();

See Also

sds_textpage

sds_graphscr

Programming Overview of SDS


sds_tolower
int sds_tolower (int value);

"Change this character to lower-case."	SDS Function

This function converts a given character from upper- to lower-case.

The argument value is the ASCII value of a character.

This function returns the ASCII value for its lower case counterpart when the character is upper-case. If the given character is lower-case already, sds_tolower leaves it as it is.

Example

int returni;

char string1[512];

sds_getstring(1,"\nEnter an upper case character: ");

returni=sds_tolower(string1[0]);

sds_printf("\nsds_tolower returned %i",returni);

See Also

sds_toupper

sds_isupper

sds_islower

Programming Overview of SDS


sds_toupper
int sds_toupper (int value);

"Change this character to upper-case."	SDS Function

This command converts a given character from lower- to upper-case.

The argument value is the ASCII value of a character.

This function returns  the ASCII value for its uppercase counterpart when the given character is lower-case. If the given character is upper-case already, sds_toupper leaves it as it is.

Example

int returni;

char string1[512];

sds_getstring(1,"\nEnter a lower case character: ",string1);

returni=sds_toupper(string1[0]);

sds_printf("\nsds_toupper returned %i",returni);

See Also

sds_tolower

sds_isupper

sds_islower

Programming Overview of SDS


sds_trans
int sds_trans (const sds_point point, const struct sds_resbuf *from, const struct sds_resbuf *to, int disp, sds_point answer);

"Translate this point from one coordinate system to another."	SDS Function

This function translates (moves) a point from to another coordinate system.

The point argument is a 3-D point in list format. The meaning of this argument depends on the setting of from and to.

The from argument describes the current coordinate system. The to argument describes the destination coordinate system, using the same codes as from. Unlike the LISP version of the trans function, the from and to hold other arguments:

Entity Name (RTENAME) specifies the Entity Coordinate System used by the entity.

3D Extrusion Vector (RT3DPOINT) is a 3-D displacement vector.

Integer Code (RTSHORT) is another form of displacement vector, as described below:

Code	Coordinate System
0	World coordinate system (WCS).
1	Current user-defined coordinate system (UCS).
2	Display coordinate system ( DCS) of current viewport—with code 0 or 1. DCS of current model space viewport—with code 3.
3	Paper space DCS.
This function returns RTNORM or an error code in system variable ERRNO.

See Also

Programming Overview of SDS


sds_undef
int sds_undef (const char *funname, short funcode);

"Undefine a previously defined SDS™ function."	SDS Function

This function undefines an previously defined SDS function, which was previously defined by the sds_defun function. This function requires the same arguments as sds_defun.

The argument funname represents the command name for the function to be undefined.

The argument funcode is the function code by which sds_getfuncode would access this function.

This function returns RTNORM or an error code in system variable ERRNO.

See Also

sds_defun

sds_getfuncode

Programming Overview of SDS


DLG_unload_dialog
int dlg_unload_dialog (int dlgid);

"Unload that dialog box."	SDS Function

This function unloads a dialog box identified as dclid. Obtain ddlid from the dlg_new_dialog function).

This function only returns RTNORM.

See Also

dlg_new_dialog

dlg_load_dialog

Programming Overview of SDS


sds_usrbrk
int sds_usrbrk (void);

"Determine whether the user pressed Esc."	SDS Function

This function checks to see if the user has pressed the Esc key. If so, this function returns 1; if not, it returns 0.

See Also

Programming Overview of SDS


DLG_vector_image
int dlg_vector_image (int x1, int y1, int x2, int y2, int color);

"Draw a vector in the dialog box."	SDS Function

This function draws a vector of a specified color in a dialog box.

The vector is drawn from x1,y1 to x2,y2. The origin (0,0) of the dialog box tile is at the upper-left corner.

The color argument is one of the standard 255 colors in IntelliCAD® or can take one of these special meanings:

Color	Mnemonic	Meaning
-2	BGLCOLOR	Current background of the IntelliCAD graphics screen.
-15	DBGLCOLOR	Current dialog box background color.
-16	DFGLCOLOR	Current dialog box foreground color of text.
-18	LINELCOLOR	Current dialog box line color.
This function returns RTNORM if successful; otherwise, it returns an error code.

See Also

dlg_dimension_tile

Programming Overview of SDS


sds_vports
int sds_vports (struct sds_resbuf **vlist);

"Get information about this viewport."	SDS Function

This function returns a description of all current viewports. The description returned by the sds_vports function is a list that includes the viewport identification number, followed by viewport coordinates. These coordinates vary, depending on the setting of Tilemode:

When TileMode = 1, the list consists of the viewports created by the VPorts command. Coordinates of the viewport's corners, ranging from (0.0, 0.0) for the lower-left corner, to (1.0, 1.0) for the upper-right corner.

When TileMode = 0, the list consists of the viewports created with the MView command. The corners are described by paper space coordinates.

NOTE In model space, the first viewport number is #2; viewport #1 is paper space when Tilemode = 0. The current viewport is listed first.

See Also

Programming Overview of SDS


sds_wcmatch
int sds_wcmatch (const char *string, const char *match);

"Determine whether this matches that."	SDS Function

This function checks to see if one string matches another string. It can be used to find an exact literal match, or by using any of the wildcard options listed below.

The argument string is the string to be tested.

The argument match is the string against which string is checked. This function is case-sensitive. The string match may contain any of the following special characters:

Character	Description
` (reverse single-quote)	Forces sds_wcmatch to check against the next character exactly. Use this with any special characters if you want to disregard their special meanings and interpret them literally.
~ (tilde)	Causes sds_wcmatch to match anything that is not the same as matchthat. It must be the first character in the string. If you have a tilde at any other point in the string, sds_wcmatch looks to match it with a tilde.
*	The asterisk is an unlimited wildcard. Use it to match any character, or series of characters, at any place in matchthat.
?	The question mark works just like the asterisk, but for just one character at a time, as opposed to a series of characters.
# @	At, pound, and period are limited wildcards. They can be used to match single characters of specific types:
@ (at)	Any alphabetic character (A-Z)
- (hyphen)	Indicates a range of characters, such as sds_wcmatch(3-7).
, (comma)	You can use more than one pattern in matchthat. Just use the comma to separate the patterns. Sds_wcmatch looks for a match  to any of the patterns (a OR b), but not necessarily all of them.
# (pound)	Any numeric character (0-9)
. (period)	Any non-alphanumeric character (&,%,+, etc.)

In addition to the above, the square brackets allow even greater flexibility:

[xyz123] looks for a match between doesthis and any of the characters enclosed in the brackets.

[~xyz123] finds something that is not a match between doesthis and any of the characters enclosed in the brackets; use the tilde just as with any other characters.

This function returns RTNORM if the strings match, and RTERROR if they do not.

Example

The following example tries to match this string:  char *doesthis = "1A2B3C";

sds_wcmatch(doesthis,"[CAT],[~DOG]");

This would return RTNORM because the string "1A2B3C" does include characters from the first set: C, A, or T. Since the comma works as an OR, sds_wcmatch would return RTNORM whether or not there was a match in the second pattern.

sds_wcmatch(doesthis,"1a2b3c");

This would return RTERROR because upper- and lower-case characters do not match.

sds_wcmatch(doesthis,"#@#@??");

This would return RTNORM because the string "1A2B3C" does match the pattern of numeric character, alpha character, followed by any other 4 characters.

See Also

Programming Overview of SDS


sds_xdroom
int sds_xdroom (const sds_name entity-name, long *memavail);

"Determine how much space is left for EED."	SDS Function

This function reports the amount of extended entity data (or "xdata") space still free in the object identified by entity-name. All objects in IntelliCAD® have 16KB (actually, 16,383 bytes) each to store any kind of user-defined data. This function tells you how many bytes are still remaining.

The argument entity-name is the object name for the object you wish to check.

The argument memavil the amount of memory, in bytes, still available for extended object data.

This function returns RTNORM or an error code in system variable ERRNO.

Example

sds_name            EntName;

sds_point           Point1;

struct sds_resbuf *EntList = NULL;

long	  MemLeft = 0l;

ReturnI=sds_entsel("\nPick an object: ",EntName,Point1);

if (ReturnI == RTNORM){

    sds_xdroom(EntName,&MemLeft);

    sds_printf("\n %ld bytes are availablefor EED on this object. ",MemLeft);

} else

    sds_printf("\nNo object was found. Press Enter to try again.");

sds_relrb(EntList);

EntList = NULL;

See Also

sds_xdsize

Programming Overview of SDS


sds_xdsize
int sds_xdsize (const struct sds_resbuf *entity-data, long *memused);

"Determine how much space this xdata takes up."	SDS Function

This function returns the size (in bytes) that extended entity data takes up in an object.

The argument entity-data is a result buffer containing only the extended entity data for the object in question.

The argument memused is the amount of memory, in bytes, used by the extended entity data.

This function returns RTNORM or an error code in system variable ERRNO.

Example

sds_name            EntName;

sds_point           Point1;

struct sds_resbuf *EntList = NULL;

long                MemUsed = 0l;

ReturnI=sds_entsel("\nPick an object: ",EntName,Point1);

if (ReturnI == RTNORM){

    EntList=sds_entget(EntName);

    ReturnI=sds_xdsize(EntList,&MemUsed);

    sds_printf("\nEntity's EED occupies %ld bytes of memory. ",MemUsed);

    if (MemUsed == 0)

        sds_printf("\nRTERROR is normal if there is no EED on the object.");

    sds_printf("\nsds_xdsize returned %i",ReturnI);

} else

    sds_printf("\nNo object was found. Press Enter to try again.");

sds_relrb(EntList);

EntList = NULL;

See Also

sds_xdroom

Programming Overview of SDS


sds_xformss
int sds_xformss (const sds_name setname, sds_matrix transform);

“Change this set according to this matrix."	SDS Function

This function changes the positional information for a selection set using the transformation matrix. The sds_xformss function can be used to scale, rotate, or move the selection, as long as the relative proportions of the set are maintained (aspect ratio). This function will not accept a matrix that attempts to change the x-, y-, and z-axes by different values.

The argument setname is the name of the selection set to be transformed.

The argument transform is the transformation matrix to be applied to setname. The matrix may scale the selection set, as long as the scaling factors for each axis are the same.

This function returns RTNORM or an error code in system variable ERRNO.

See Also

Programming Overview of SDS


sds_xload
int sds_xload (const char *appname);

"Load this SDS™ application."	SDS Function

This function loads an SDS application. If the program is already loaded, this function ignores the request to load it again.

The argument appname is the name of the application to load.

This function returns RTNORM or an error code in system variable ERRNO.

Example

if ((sds_xload("myapp")) != RTNORM)

    sds_printf("\nThe file \"myapp\" was not loaded.");

else

    sds_printf("\n\"myapp\" was loaded successfully.");

See Also

sds_loaded

sds_xunload

Programming Overview of SDS


sds_xstrcase
int sds_xstrcase (const char *string);

"Convert a string to UPPER-CASE."	SDS Function

This function converts strings to upper-case, to make it compatible with the DWG file format.

The argument string is the text string to be converted.

See Also

Programming Overview of SDS


sds_xunload
int sds_xunload (const char *appname);

"Unload this SDS™ application."	SDS Function

This function unloads an SDS program application. If that program is not currently loaded, this function ignores the request to unload it and returns RTERROR.

The argument appname is the name of the application to be unloaded.

This function returns RTNORM or an error code in system variable ERRNO.

Example

if ((sds_xunload("myapp")) != RTNORM)

    sds_printf("\nThe file \"myapp\" was not unloaded.");

else

    sds_printf("\n\"myapp\" was unloaded successfully.");

See Also

sds_loaded

sds_xload

Programming Overview of SDS