Global attribute
CADForums.net Forum Index CADForums.net
Discussion of AutoCAD and other CAD software.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web cadforums.net
Global attribute

 
Post new topic   Reply to topic    CADForums.net Forum Index -> Customization
Author Message
masterbike360
Guest





Posted: Wed Jan 12, 2005 3:21 am    Post subject: Global attribute Reply with quote

I want to edit one attribute on several TAB. Normally I use GATTE (ExpreesTools) to do that manually.
I would like to include this in a lisp. I cant make it work.
I dont want to answer each promt manualy, I want everything included in the lisp file.
I try (c:gatte) but I don't know how to answer the question via my lisp.

Thanks, Simon

Back to top
T.Willey
Guest





Posted: Wed Jan 12, 2005 3:25 am    Post subject: Re: Global attribute Reply with quote

How many time is this block inserted? Is it only inserted as the ones you want to change? If so then you can search the entire drawing, then get the attributes and search for the one whose tag matches the one you want to change, then you can put in your new information.

Tim
Back to top
masterbike360
Guest





Posted: Wed Jan 12, 2005 3:46 am    Post subject: Re: Global attribute Reply with quote

Yes Tim, we inset it once (we load it from template at the TAB). It's a titleblock. I have to change the tag value (DOC_NAME) with (getvar "DWGNAME").
I try to modify this partial line of command from an another post...but it's not good, no result

(setq ss (ssget "x" '((0 . "INSERT") (66 . 1))))
(while (setq Ent (ssname ss 0))
(ssdel Ent ss)
(setq Att Ent)
(while (/= (cdr (assoc 0 (entget Att))) "CAD_JS2000_D")
(setq Att (entnext Att))
(if (= (cdr (assoc 2 (entget Att))) "DOC_NAME")
(entmod (cons 1 (getvar "dwgname")) (assoc 1 Att) Att)
)
)
)

Simon

Back to top
T.Willey
Guest





Posted: Wed Jan 12, 2005 3:54 am    Post subject: Re: Global attribute Reply with quote

That looks like one I wrote. Lol.

(setq ss (ssget "x" '((0 . "INSERT") (66 . 1)(2 . "CAD_JS000_D"))))
(while (setq Ent (ssname ss 0))
(setq Att Ent)
(while (setq Att (entnext Att))
(if (= (cdr (assoc 2 (entget Att))) "DOC_NAME")
(entmod (cons 1 (getvar "dwgname")) (assoc 1 Att) Att)
)
)
(ssdel Ent ss)
)

I took it as if "CAD_JS2000_D" is your title block name, so I just added that to the ssget search to get even less items.

See how this works for you.
Tim
Back to top
Jeff Mishler
Guest





Posted: Wed Jan 12, 2005 4:23 am    Post subject: Re: Global attribute Reply with quote

Here's one for editing 1 or more attributes globally. Use the second
function to get all of the attributes from one block to copy to all other
like named blocks. For changing only one attribute, use like this:
(global_atts "blockname" '(("tagstring" . "newvalue")))

Code:

;; Function to synchronize attributes of a given block, only those included
in
;; the list will be updated
;; usage- (global_atts "myblock" *att_list*)
;; *att_list* as returned (or in the same form as) by the second routine,
;; "make_att_list"
;; Author: Jeff Mishler
;; Date 1/11/05
(defun global_atts (bname attlist)
  (if (setq ss (ssget "x" (list '(0 . "INSERT")(cons 2 bname)'(66 . 1))))
    (progn
      (setq count -1)
      (while (< (setq count (1+ count)) (sslength ss))
 (setq blk (vlax-ename->vla-object (ssname ss count))
       atts2 (vlax-invoke blk "getattributes")
       )
 (foreach att2 atts2
   (foreach att1 attlist
     (if (= (car att1)(vla-get-tagstring att2))
       (progn
  (vla-put-textstring att2 (cdr att1))
  (vla-update att2)
       )
     )
   )
 (vla-update blk)
 )
      )
    )
  )

  ;; for use with the global_atts function above
(defun make_att_list (/ ent obj atts)
  (and (setq ent (car (entsel "\nSelect block to log attributes for: ")))
       (setq obj (vlax-ename->vla-object ent))
       (if (and (vlax-property-available-p obj 'hasattributes)
  (eq (vla-get-hasattributes obj) :vlax-true))
  (progn
    (setq atts (vlax-invoke obj 'getattributes))
    (foreach att atts
      (setq *att_list* (cons
    (cons
      (vla-get-tagstring att)
      (vla-get-textstring att)
      )
    *att_list*
    )
     )
      )
    )
  )
       )
  )
 


--
Jeff
check out www.cadvault.com
"masterbike360" <nospam@address.withheld> wrote in message
news:16188137.1105482138885.JavaMail.jive@jiveforum1.autodesk.com...
Quote:
I want to edit one attribute on several TAB. Normally I use GATTE
(ExpreesTools) to do that manually.
I would like to include this in a lisp. I cant make it work.
I dont want to answer each promt manualy, I want everything included in
the lisp file.
I try (c:gatte) but I don't know how to answer the question via my lisp.

Thanks, Simon
Back to top
masterbike360
Guest





Posted: Wed Jan 12, 2005 3:40 pm    Post subject: Re: Global attribute Reply with quote

Thank you guy's...Now everything work fine.

Simon
Back to top
 
Post new topic   Reply to topic    CADForums.net Forum Index -> Customization All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Windows Server DSP VoIP Electronics New Topics
Powered by phpBB