;; | ---------------------------------------------------------------------------- ;; | XD_WriteX ;; | ---------------------------------------------------------------------------- ;; | Function : Writes extended entity into an entity ;; | Argument : [e] - entity name ;; | [xdLst] - list of data ;; | [AppName] - Application Name (must be already registered) ;; | Return : complete entity list is returned if (XD_WriteX ...) is successful, ;; | else nil is returned ;; | Updated : August 11, 1998 ;; | Comment : - Program can detect data types (STR, REAL,INT, LIST). ;; | - Entitiy handles must be prefixed by a "#" sign ;; | (eg. (XD_WriteX e (list "300XLCU" "#5DE")). ;; | - 1010 group stores points, which is a list of 3 reals ;; | - If you want to store a nested list, it should have {} ;; | - as the first element of the list ;; | e-mail : rakesh.rao@4d-technologies.com ;; | Web : www.4d-technologies.com ;; | ---------------------------------------------------------------------------- (defun XD_WriteX (ename xdLst AppName / entl xd) (setq xd (reverse (XD_WriteX@ xdLst)) xd (list -3 (cons AppName xd)) entl (append (entget ename) (list xd)) ) (entmod entl) entl ) ) (defun XD_WriteX@ (xdLst / xd xd1 itm) (setq xd '()) (foreach itm xdLst (cond ((and (= (type itm) 'LIST) (= (car itm) "{}")) (setq xd1 (cons (cons 1002 "}") (XD_WriteX@ (cdr itm))) xd1 (append xd1 (list (cons 1002 "{"))) xd (append xd1 xd) ) ) ((and (= (type itm) 'LIST) (= (length itm) 3)) (setq xd (cons (cons 1010 itm) xd)) ) ((and (= (type itm) 'STR) (= (substr itm 1 1) "#")) (setq xd (cons (cons 1005 (substr itm 2)) xd)) ) ((= (type itm) 'STR) (setq xd (cons (cons 1000 itm) xd)) ) ((= (type itm) 'INT) (setq xd (cons (cons 1070 itm) xd)) ) ((= (type itm) 'REAL) (setq xd (cons (cons 1040 itm) xd)) ) ) ) xd )