PSC Code Manual

util/conversion.lsp [src]

Functions related to conversions

Functions

Function signature Description
(? x) Alias for (if X X)
(?? x default) Alias for (if X X DEFAULT)
(?f n) Alias for (if N N 0.0)
(?n n) Alias for (if N N 0)
(?s s) Alias for (if S S "")
(collection->list collection) Returns vlax COLLECTION as a list
(dtr rad) Returns RAD in radians
(frac n) Alias for (rtos n 5 2)
(num-val x) Alias for (if (numberp X) X 0)
(rtd deg) Return DEG in degrees
(safe-atoi str) Wrapper for atoi that returns nil if there was no number
(safearray->list safearray) Converts arbitrary-dimension SAFEARRAY to a list
(to-string x) Returns X as a string
(unit-dir n) Returns 0 if N is 0, 1 if N is positive, or -1 if N is negative
(vlax-collection->lst collection) Convert COLLECTION to a list of names
(vlist->safearray vertices) Returns VERTICES as a safearray

(? x)

Alias for (if X X)

(?? x default)

Alias for (if X X DEFAULT)

(?f n)

Alias for (if N N 0.0)

(?n n)

Alias for (if N N 0)

(?s s)

Alias for (if S S "")

(collection->list collection)

Returns vlax COLLECTION as a list

VARS:
(COLLECTION VLA-OBJECT)

(dtr rad)

Returns RAD in radians

VARS:
(RAD (INT REAL))

(frac n)

Alias for (rtos n 5 2)

(num-val x)

Alias for (if (numberp X) X 0)

(rtd deg)

Return DEG in degrees

(safe-atoi str)

Wrapper for atoi that returns nil if there was no number

(atoi "")      => 0
(safe-atoi "") => nil

(safearray->list safearray)

Converts arbitrary-dimension SAFEARRAY to a list

VARS:
(safearray safearray)

(to-string x)

Returns X as a string

Essentially a wrapper for vl-prin1-to-string that returns the empty string for nil rather
than "nil".

(unit-dir n)

Returns 0 if N is 0, 1 if N is positive, or -1 if N is negative

Uses a precision fuzz of 0.00001 for comparison. See >f.

(vlax-collection->lst collection)

Convert COLLECTION to a list of names

COLLECTION should be a vlax collection of objects that support a Name property.

VARS:
(COLLECTION VLA-OBJECT)

(vlist->safearray vertices)

Returns VERTICES as a safearray

VERTICES should be a list of lists of numbers.

VARS:
(VERTICES (LIST nil) (VL-EVERY 'POINT-P VERTICES))