ade_oddefinetab

AutoCAD Map 3D AutoLISP

Up a level
ade_oddefinetab
 
 

Creates an object data table.

(ade_oddefinetab tab_defn)

Returns T or nil.

tab_defn List of table elements: the table name, the table description, and a sequence field definitions.

The table name is specified by an a-list:

("tablename" . "NEWTABLE")

The name must be unique, contain no spaces, and start with a character. The name can be up to 25 characters long.

The table description is specified the same way, except that spaces are allowed:

("tabledesc" . "New Sample Table")

The field definitions are introduced by the string, "columns". At least one field definition is required. Each field definition is a list of a-lists, and each a-list consists of a field property and a value, as follows:

Field propertyField name
colname Field name (string) can be up to 31 characters long. Must be unique, contain no spaces, and start with an alphanumeric character
coldesc Field description (string)
coltype Field data type
defaultval Default field value

The following code creates a table.

; Define new table
(setq tabldefn 
    '(("tablename" . "NEWTABLE")  
       ("tabledesc" . "New Sample Table") 
       ("columns" 
            ; Define a field 
            (("colname" . "FIELD1") 
             ("coldesc" . "Field1 Description")  
             ("coltype" . "character") 
             ("defaultval" . "Default Value")) 
            ; Define more fields as needed 
             . 
             . 
             . 
            ; For an example of defining fields, click .
 )))
; Create the new table
(ade_oddefinetab tabldefn)

Here is another example of creating a table.

(setq pt1 "2,2")
(ade_oddefinetab
   (list 
       '("tablename" . "valve_id") 
       '("tabledesc" . "Valve Storage") 
       (list "columns" 
       (list 
            '("colname" . "LOCATION") 
            '("coldesc" . "Valve_id") 
            '("coltype" . "point") 
            (cons "defaultval"  pt1) ) ) )