Author Topic: "attrib" MODIFY????  (Read 2038 times)

0 Members and 1 Guest are viewing this topic.

rlxozzang

  • Guest
"attrib" MODIFY????
« on: July 23, 2012, 08:51:46 PM »
Property, the character "attrib" I want to modify the value of a customized approach that did not work .. ATTRIB. ㅜ ㅜ
Code: [Select]
(defun KT:NextData ( ename / en)
(setq en (tblobjname "BLOCK" (cdr (assoc 2 (entget ename)))))
(while
(and
(setq en (entnext en))
(not (= (cdr (assoc 0 (entget en))) "ATTRIB"))
)
(setq en_lst (cons (cdr (assoc 1 en)) en_lst))
)
)
(KT:NextData (setq ename (car (entsel))))
« Last Edit: July 23, 2012, 11:52:33 PM by CAB »

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: "attrib" MODIFY????
« Reply #1 on: July 24, 2012, 03:52:10 AM »
Not sure what you want to do.

Your code fails because of this line:
Code: [Select]
(assoc 1 en)The variable en is not a list but an ename.

You should also localize the en_lst variable.

After these improvements your code would look like this:
Code - Auto/Visual Lisp: [Select]
  1. (defun KT:NextData ( ename / en en_lst )
  2.   (setq en (tblobjname "BLOCK" (cdr (assoc 2 (entget ename)))))
  3.   (while
  4.     (and
  5.       (setq en (entnext en))
  6.       (not (= (cdr (assoc 0 (entget en))) "ATTRIB"))
  7.     )
  8.     (setq en_lst (cons (cdr (assoc 1 (entget en))) en_lst))
  9.   )
  10. )
  11. (KT:NextData (setq ename (car (entsel))))

Maybe you actually want a list of the enames of the ATTDEF entities nested in the block?

rlxozzang

  • Guest
Re: "attrib" MODIFY????
« Reply #2 on: July 24, 2012, 08:27:25 PM »
I "ATTRIB" ename .. I would like to receive a list of
Not sure what you want to do.

Your code fails because of this line:
Code: [Select]
(assoc 1 en)The variable en is not a list but an ename.

You should also localize the en_lst variable.

After these improvements your code would look like this:
Code - Auto/Visual Lisp: [Select]
  1. (defun KT:NextData ( ename / en en_lst )
  2.   (setq en (tblobjname "BLOCK" (cdr (assoc 2 (entget ename)))))
  3.   (while
  4.     (and
  5.       (setq en (entnext en))
  6.       (not (= (cdr (assoc 0 (entget en))) "ATTRIB"))
  7.     )
  8.     (setq en_lst (cons (cdr (assoc 1 (entget en))) en_lst))
  9.   )
  10. )
  11. (KT:NextData (setq ename (car (entsel))))

Maybe you actually want a list of the enames of the ATTDEF entities nested in the block?

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: "attrib" MODIFY????
« Reply #3 on: July 24, 2012, 11:29:43 PM »
Are you looking for this?
Code: [Select]
(defun KT:NextData ( ename / en en_lst typ)
 (setq en (tblobjname "BLOCK" (cdr (assoc 2 (entget ename)))))
 (while
   (and
     (setq en (entnext en))
     (not (= (setq typ (cdr (assoc 0 (entget en)))) "ENDBLK"))
   )
   (if (= typ "ATTDEF")
     (setq en_lst (cons en en_lst))
   )
 )
  (reverse en_Lst)
)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

rlxozzang

  • Guest
Re: "attrib" MODIFY????
« Reply #4 on: July 25, 2012, 11:02:09 PM »
Thank you for any help. This has been resolved. "SEQEND" I'm wondering what this is.
Code: [Select]
(defun c:aa ( / ename lst elst )
    (setq ename (car(entsel)))

    (while
        (and
            (setq ename (entnext ename))
            (setq elst (entget ename))
            (not (eq "SEQEND" (cdr (assoc 0 elst))))
        )
;        (setq lst (cons (cdr (assoc 1 elst)) lst))
(setq lst (cons (cons ename (cdr (assoc 10 elst))) lst))
    )
)

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: "attrib" MODIFY????
« Reply #5 on: July 25, 2012, 11:23:09 PM »
Glad you worked it out.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.