;; *positionsPropertiesDB* = Global variable for test
;; (setq *positionsPropertiesDB*
;; '(
;; (1 (1 . "test1") (2 . "test11") (3 . "test111"))
;; (2 (1 . "test2") (2 . "test22") (3 . "test222"))
;; )
;; )
;; getPositionProperties
;; Get list by index
;; Call : (getPositionProperties 1)
;; Return : (1 (1 . "test1") (2 . "test11") (3 . "test111"))
(defun getPositionProperties
(positionName
) )
)
*positionsPropertiesDB*
)
)
)
;; addPositionProperties
;; Append assoc list by index and refresh global database
;; Call : (addPositionProperties 1 'SYMBOL "VALUE")
;; Updates to : (1 (1 . "test1") (2 . "test11") (3 . "test111") (SYMBOL . "VALUE"))
(defun addPositionProperties
(positionName
sym
value
/
properties
oldValue)
(setq properties
(getPositionProperties positionName
)) (refreshProperties
positionName
properties
)
)
)
)
;; removePositionProperties
;; Remove assoc list by index and refresh global database
;; Call : (removePositionProperties 1 'SYMBOL)
;; Updates to : (1 (1 . "test1") (2 . "test11") (3 . "test111"))
(defun removePositionProperties
(positionName
sym)
(refreshProperties
positionName
)
)
)
(getPositionProperties positionName)
)
)
)
;; Refresh Properties
;; Update global variable
(defun refreshProperties
(positionName
newProperties)
(setq *positionsPropertiesDB
* (if (= (car properties
) positionName
) newProperties
properties
)
)
)
*positionsPropertiesDB*
)
)
)
;; Delete list by index
;; Update global variable
(defun deletePosition
(positionName
) (setq *positionsPropertiesDB
* )
)
*positionsPropertiesDB*
)
)
)
;; Inserts new indexes
;; Update global variable
(defun addPosition
(positionName
) *positionsPropertiesDB*
(append *positionsPropertiesDB
* )
)
)
;http://forums.augi.com/showthread.php?121467-Selection-Set-Performance
(defun BenchTime
(start
/ millisecs
) ) ;_ >princ
)
(princ "\nThere's an error. The bechmark wasn't started yet." )
)
)
t
)
;---------------------------------------------------------------
(setq *positionsPropertiesDB
* nil *counter* 100) ;Modify as needed
;Inserts new indexes
(addPosition id)
)
;test 1
;Put data
(BenchTime t)
(addPositionProperties id 'PARTNUMBER "000.00.0.00")
(addPositionProperties id 'GAUGE "18AWG")
(addPositionProperties id 'DIAMETEREXT 1.6)
(addPositionProperties id 'COLOR "RED")
(addPositionProperties id 'MINRADIUS 0.7)
(addPositionProperties id 'STANDARD "SAE J1128")
(addPositionProperties id 'FAMILY "FLEX_A")
(BenchTime nil)
)
;test 2
;Update data
(BenchTime t)
(addPositionProperties id 'PARTNUMBER "111.11.1.11")
(addPositionProperties id 'GAUGE "0.75")
(addPositionProperties id 'DIAMETEREXT 1.3)
(addPositionProperties id 'COLOR "BLU")
(addPositionProperties id 'MINRADIUS 0.5)
(addPositionProperties id 'STANDARD "DIM 72551-6")
(addPositionProperties id 'FAMILY "FLEX_B")
(BenchTime nil)
)
;test 3
;remove data
(BenchTime t)
(removePositionProperties id 'PARTNUMBER)
(removePositionProperties id 'GAUGE)
(removePositionProperties id 'DIAMETEREXT)
(removePositionProperties id 'COLOR)
(removePositionProperties id 'MINRADIUS)
(removePositionProperties id 'STANDARD)
(removePositionProperties id 'FAMILY)
(BenchTime nil)
)
;test 4
;remove index
(deletePosition id)
)
)