layer name to the object data field

layer name to the object data field

АлексЮстасу
Advisor Advisor
653 Views
1 Reply
Message 1 of 2

layer name to the object data field

АлексЮстасу
Advisor
Advisor

Hi,

 

Someone already solved the task of loading the layers names in the field of Object Data? Or other graphics properties in OD?
It seems to me that this is a simple task for Lisp or others?

 

 


-- Alexander, private person, pacifist, english only with translator 🙂 --

Object-modeling _ odclass-odedit.com _ Help

0 Likes
654 Views
1 Reply
Reply (1)
Message 2 of 2

CADaSchtroumpf
Advisor
Advisor

Hi,

For me with my tools I make this: it use 2 lisp.

At the first time I use Properties2OD.lsp (generic) and select only LAYER for input data

In second time I use this (it's adapted for the exemple in the link: "EXAMPLE OBJECT DATA _A_ version 2007.dwg")

And delete the table create by the first lisp.

(defun c:transfert_OD ( / js in n obj tbllist)
  (setq js
    (ssget
      (list
        (cons 67 (if (eq (getvar "CVPORT") 1) 1 0))
        (cons 410 (if (eq (getvar "CVPORT") 1) (getvar "CTAB") "Model"))
      )
    )
  )
  (cond
    (js
      (setq in
        '(
          ("TBL_AcDbPolyline" . "LAYER")
          ("A" . "CODE")
        )
      )
      (repeat (setq n (sslength js))
        (setq obj (ssname js (setq n (1- n))))
        (setq tbllist (ade_odgettables obj))
        (cond
          (tbllist
            (foreach tbl (mapcar 'car in)
              (cond
                ((not (member tbl tbllist))
                  (ssdel obj js)
                )
              )
            )
          )
          (T (ssdel obj js))
        )
      )
    )
  )
  (cond
    (js
      (repeat (setq n (sslength js))
        (setq obj (ssname js (setq n (1- n))))
        (ade_odsetfield obj
          (car (nth 1 in))
          (cdr (nth 1 in))
          0
          (atoi 
          (ade_odgetfield obj
            (car (nth 0 in))
            (cdr (nth 0 in))
            0
          )
          )
        )
      )
    )
  )
  (sssetfirst nil js)
  (princ (strcat "\n" (itoa (sslength js)) " entités ont subit des transferts d'OD de " (car (nth 0 in)) " vers " (car (nth 1 in))))
  (prin1)
)

 NB:

In this I must adapt the list for transfering data

'(("TBL_AcDbPolyline" . "LAYER") ("A" . "CODE"))

and for convert the string of layer to integer for the CODE I add (atoi) for (ade_odgetfield obj  (car (nth 0 in))           (cdr (nth 0 in)) 0) because the type of data is not the same.