PSC Code Manual

util/xdata.lsp [src]

XDATA-handling functions

Functions

Function signature Description
(assign-xdata source app-id xd-lst) Applies a formatted data list to an entity as xdata
(combine-like-data datalsts keys primary-key) Combines similar data lists
(data-list-p data) Returns T if DATA is a data list
(expect-with-data funcname) Throws an error if not inside with-data
(format-xdata xdata_list) Formats a list to be applied to an entity as xdata
(get-ent-xdata appids) Prompts for entity selection and gets XDATA from one of supplied APPIDS
(get-land-xdata) Wrapper for get-ent-xdata for landings
(get-stair-xdata) Wrapper for get-ent-xdata for stairs
(get-xdata-find obj app) Returns the most recently edited OBJ with APP xdata in the current drawing
(has-duplicate-keys-p data) Returns T if any keys in data list DATA are repeated
(read-xdata source app-id) Extracts xdata from an entity and returns a data list
(read-xdata-migrate ename-var appid) Reads xdata from an entity, performing migrations if it is an old version
(subst-key key new-val lst) Returns data list LST with value of KEY replaced with NEW-VAL
(subst-key! key new-val lst-sym) Updates data list at LST-SYM in place using subst-key
(tk lst) Alias for translate-keys
(tkmx lst) Alias for composition of translate-keys and macro-expand
(translate-keys lst exp-lst) Translates key names in EXP-LST based on their value in data list LST
(translate-keys-block lst-sym block) DEPRECATED
(vla-appid-defined appname) Returns the RegisteredApplication object for APPNAME, if it exists
(with-data datalst exprs) Evals EXPRS with DATALST as the environment
(with-data-get-land exprs) Evals EXPRS in landing xdata context
(with-data-get-stair exprs) Evals EXPRS in stair xdata context
(xd-value key datalst) Return the value of KEY in DATALIST

(assign-xdata source app-id xd-lst)

Applies a formatted data list to an entity as xdata

(combine-like-data datalsts keys primary-key)

Combines similar data lists

Similarity is determined by equality on the values of keys listed in KEYS. PRIMARY-KEY, if
provided, is the unique ID key for a list. The values of this key are preserved in the
final grouping. If a key named 'qty' is present in DATALSTS, it will be preserved and
incremented to reflect grouping.

(data-list-p data)

Returns T if DATA is a data list

(expect-with-data funcname)

Throws an error if not inside with-data

(format-xdata xdata_list)

Formats a list to be applied to an entity as xdata

(get-ent-xdata appids)

Prompts for entity selection and gets XDATA from one of supplied APPIDS

Throws an error if selected entity has no data for any of the APPIDS.

VARS:
(APPIDS LIST (VL-EVERY 'STRINGP APPIDS))

(get-land-xdata)

Wrapper for get-ent-xdata for landings

(get-stair-xdata)

Wrapper for get-ent-xdata for stairs

(get-xdata-find obj app)

Returns the most recently edited OBJ with APP xdata in the current drawing

(has-duplicate-keys-p data)

Returns T if any keys in data list DATA are repeated

VARS:
(DATA nil (DATA-LIST-P DATA))

TESTS:
(HAS-DUPLICATE-KEYS-P '(("a" 1) ("b" 2) ("a" 3)))
(NOT (HAS-DUPLICATE-KEYS-P '(("a" 1) ("b" 2))))

(read-xdata source app-id)

Extracts xdata from an entity and returns a data list

(read-xdata-migrate ename-var appid)

Reads xdata from an entity, performing migrations if it is an old version

(subst-key key new-val lst)

Returns data list LST with value of KEY replaced with NEW-VAL

VARS:
(KEY STR)
(LST nil (DATA-LIST-P LST))

TESTS:
(EQUAL (SUBST-KEY 'A 2 '((A 1))) '((A 2)))
(EQUAL (SUBST-KEY 'A 2 '((B 1))) '((B 1)))

(subst-key! key new-val lst-sym)

Updates data list at LST-SYM in place using subst-key

VARS:
(KEY STR)
(LST-SYM SYM (DATA-LIST-P (VL-SYMBOL-VALUE LST-SYM)))

TESTS:
(EQUAL ((LAMBDA (LST) (SUBST-KEY! 'A 2 'LST) LST) '((A 1))) '((A 2)))
(EQUAL ((LAMBDA (LST) (SUBST-KEY! 'A 2 'LST) LST) '((B 1))) '((B 1)))

(tk lst)

Alias for translate-keys

DEPRECATED

(tkmx lst)

Alias for composition of translate-keys and macro-expand

 DEPRECATED

(translate-keys lst exp-lst)

Translates key names in EXP-LST based on their value in data list LST

DEPRECATED: use with-data to do this sort of thing

(translate-keys-block lst-sym block)

DEPRECATED

(vla-appid-defined appname)

Returns the RegisteredApplication object for APPNAME, if it exists

(with-data datalst exprs)

Evals EXPRS with DATALST as the environment

(with-data-get-land exprs)

Evals EXPRS in landing xdata context

(with-data-get-stair exprs)

Evals EXPRS in stair xdata context

(xd-value key datalst)

Return the value of KEY in DATALIST