Author Topic: Cross layout attribute editting  (Read 8861 times)

0 Members and 1 Guest are viewing this topic.

CADaver

  • Guest
Cross layout attribute editting
« Reply #15 on: March 18, 2004, 02:41:01 PM »
Quote from: SMadsen
Hey, you're not allowed to hog CADaver by having him spend time on thinking about how to write lisp. I need him to keep my favorite subject alive in Lagniappe :)

.. and that stuff was previously written anyway


 :D That "one" over there makes my head hurt.  It's been 2 years since I left university and I'm having to re-research ('cuz I'm old, can't remember) a lot of the data about current constructs. :horror:

ronjonp

  • Needs a day job
  • Posts: 7529
Cross layout attribute editting
« Reply #16 on: March 18, 2004, 02:42:11 PM »
Quote
Man I gotta learn this stuff.


I hear ya there.....

 :D

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

CADaver

  • Guest
Cross layout attribute editting
« Reply #17 on: March 18, 2004, 05:57:45 PM »
Thanks for the help guys.  Here's what I wound up with (until I can get my head around the code daron posted)

Code: [Select]
;;
;;Stamp block editor, with a lotta help from
;;the guys at The Swamp -
;;Mark Thomas, Stig Madsen, and
;;Daron the postin’ fool over
;;
;;18-Mar-04
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun changeAtt (ent tag val / entl ins)
  (setq ins ent)
  (while (and ent
           (/= "SEQEND" (cdr (assoc 0 (setq entl (entget ent))))))
    (if (and (= (cdr (assoc 0 entl)) "ATTRIB")
             (= (cdr (assoc 2 entl)) tag))
      (entmod (subst (cons 1 val) (assoc 1 entl) entl)))
    (setq ent (entnext ent)))
  (entupd ins)
)
(defun C:STAMP ()
(setq userid (getstring "\nEnter User Initials: "))
(setq pldate (menucmd "m=$(edtime, $(getvar, date),dd-mon-yy hh:mmam/pm)"))
  (cond ((setq sset (ssget "x" '((2 . "mat*") (66 . 1))))
         (setq a 0)
         (repeat (sslength sset)
           (setq ent (ssname sset a)
                 a   (1+ a)
           )
           (if (/= userid "")
           (changeAtt ent "LAST" userid) ;<- change value
           )
           (changeAtt ent "PLOT" pldate) ;<- change value
         )
        )
  )
  (princ)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


Thanks agian.