LISP Functions

This page describes functions for LISP. If you're interested in obtaining, please contact us. Functions are written in a not bloated way , with speed in mind.

These functions are developed in BricsCAD and work with AutoCAD too - unless stated otherwise.

Examples expect LISP files are in the "File Support Search Path" and, only in case of AutoCAD, are part of trusted locations.

move-pr-00-ask

Moves the previous selection set from 0,0 and pauses for input.

(move-pr-00-ask)

Accepts a destination point.

muttoff, mutton

Turn muttering off and on.

(muttoff)

Turns muttering off.

(mutton)

Turns muttering on.

save-first

Check if a drawing is saved.

(save-first
    action
)

Arguments

  • "auto" for alert and save in appdata-local-temp.
  • "exit" for alert and exit.

sel-intersect, sel-subtract, sel-union

Create a Boolean selection set from two selection sets.

(sel-intersect
    ss-1
    ss-2
)

Return the intersecting selection of ss-1 and ss-2.

(sel-subtract
    ss-base
    ss-min
)

Return the subtraction selection set: Subtract ss-min from ss-base.

(sel-union)
    ss-base
    ss-add
)

Return the unionised selection set: Add ss-add to ss-base.

Return Values

A new selection set.

osoff, oson, osrec, osres, ostog

Sets and stores Object Snap.

(osoff)

Switches Object Snap off.

(oson)

Turns Object Snap on.

(osrec)

Stores the Object Snap bit sum value to local variable "osmod".

(osres)

Restores Object Snap to the bit sum value of "osmod", only if not nil.

(ostog)

Toggles Object Snap on and off.

Return Values

All functions return the resulting bit sum value.

Examples

Command: (osrec)
Command: (osoff)
Command: (command "line" "0.1,0.1" "1,1" "")
Command: (osres)
Command: (command "move" "last" "" "non" "0,0")

date-gen

Returns localized date string or sets local.

(date-gen
    language
    format_or_local
)

or

(date-gen <eng|ned|fry|...> <DD_MMMM_YYYY|...|set-local>)

Arguments

  • First argument is a supported language.
  • Second argument is a date format or "set-local".
    • "DD_MMMM_YYYY" returns for example "12 maart 2018"
    • "set-local" creates an environment variable "iso639" with a value as specified by the user.

Return Values

A date string based on CAD variable "CDATE" or nil if no language is set.

Examples The following example uses a line command to draw a line from coordinate 0,0 to 1,1 and ends with an empty return.

Command: (load "date-gen")
Command: (setq today-is (date-gen ned DD_MMMM_YYYY))
Command: _text 0,0 2.5 0 In Dutch, today is:
Text: !today-is

In depth

  • "date-gen.dat" contain localized data

ssv2command-list, ssv2list, char-sep-val2list

Reads a semicolon or other character separated string and returns a list.

(ssv2list
    semicolon-sep-val
)

Basic converter of semicolon separated string to a list. Corrects missing ending semicolons.

(char-sep-val2list
    char-sep-val
    character
)

Converter of character separated string to a list.

(ssv2command-list
    command-string
)

Strict converter of semicolon separated commands string to a list.

Arguments

Syntax of 'semicolon-sep-val',and 'ssv-string' with semicolons is similar to script and menu syntax. Argument char-sep-val can be anything specified by character.

Return Values

A list with string members.

Examples The following example uses a line command to draw a line from coordinate 0,0 to 1,1 and ends with an empty return.

Command: (setq command-string "_line;0,0;1,1;;")
Command: (load "ssv2command-list")
SSV2COMMAND-LIST
Command: (setq command-list (ssv2command-list command-string))
("_line" "0,0" "1,1" "")
Command: (command command-list)(princ)
Command: _line
Start of line: 0,0
Set end point or [Angle/Length/Undo]:1,1
Set end point or [Angle/Length/Follow/Undo]:

In depth

  • Since spaces equal returns, texts can be challenging. Consider the following four statements:
    • (setq command-string "_dtext;0,0;2.5;0;A_text;;")
      (setq command-string "_dtext;0,0;2.5;0;With space;;")
      (setq command-string "_text;0,0;2.5;0;With space;;")
      (setq command-string "_text;0,0;2.5;0;With space;")
      It is only the last statement that works well, despite the fact that it misses an empty return. Note that the current text style does not have a fixed height.

This site is hosted by NedCAD.

De inhoud van deze site wordt aangeboden zoals het is, zonder enige vorm van garantie en heeft verschillende licenties. Meer informatie over licenties staat hier.