Page 1 of 3 123 LastLast
Results 1 to 10 of 24

Thread: Attribute replacing

  1. #1
    Member
    Join Date
    2009-02
    Posts
    7
    Login to Give a bone
    0

    Post Attribute replacing

    Is there any LISP that can replace the one attribute tag value with another..Actually in my title block there are revision numbers as follows

    Rev Description Date Dwn Chkd Appd Appd

    0 For review 02/aug/10 NS BG JG YF

    1 For Approval 02/--/10 NS BG JG YF

    A For construction 02/--/10 NS BG JG YF

    B For construction 02/--/10 NS BG JG YF

    My intension is to replace the Rev 0 line with rev A & Rev 1 line with Rev B in order to submit as built…

    Please Advise

  2. #2
    I could stop if I wanted to
    Join Date
    2009-03
    Location
    London, England
    Posts
    304
    Login to Give a bone
    0

    Default Re: Attribute replacing

    Do each of your values have the same attribute tag?, i.e. Do "0" and "1" both have attribute tag "Rev"? (similar for Description etc.)

    If they do, a program would have to rely on the order of the attributes in the block definition and *hope* it turns out OK..

  3. #3
    Member
    Join Date
    2009-02
    Posts
    7
    Login to Give a bone
    0

    Post Re: Attribute replacing

    No each have different tags as rev_0 ,rev_1 etccc

    Thank you....

  4. #4
    Member
    Join Date
    2009-02
    Posts
    7
    Login to Give a bone
    0

    Question Re: Attribute replacing

    Is there any LISP that can replace the one attribute tag value with another..Actually in my title block there are revision numbers as follows

    Rev Description Date Dwn Chkd Appd Appd

    0 For review 02/aug/10 NS BG JG YF

    1 For Approval 02/--/10 NS BG JG YF

    A For construction 02/--/10 NS BG JG YF

    B For construction 02/--/10 NS BG JG YF

    My intension is to replace the Rev 0 line with rev A & Rev 1 line with Rev B in order to submit as built…

    Please Advise

  5. #5
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,100
    Login to Give a bone
    0

    Default Re: Attribute replacing

    Have you tried searching the AutoLISP forums for threads that deal with attributes?
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

  6. #6
    Certifiable AUGI Addict
    Join Date
    2015-11
    Location
    Jo'burg SA
    Posts
    4,512
    Login to Give a bone
    0

    Default Re: Attribute replacing

    Let me get this straight: you have a TB with 4 separate AttDefs inside for revisions. Named rev_0, rev_1, ...

    Methinks a dynamic block might do! Unless I'm completely misunderstanding.

  7. #7
    Member
    Join Date
    2009-02
    Posts
    7
    Login to Give a bone
    0

    Default Re: Attribute replacing

    @ Irneb,Thank you very much for your response sorry I am littlebit delayed to reply ..

    Exactly what you said I needed.. Actually the title block has given by the client and its not permitted to change that..So there is no option to use dynamic blocks..I have gone through all the threads here. But I couldn't find out the exact one..if you find similar please refer it to me... .. It will be fine if I could find a single lisp programme to do this..Thanks in advance.....
    ...

  8. #8
    Certifiable AUGI Addict
    Join Date
    2015-11
    Location
    Jo'burg SA
    Posts
    4,512
    Login to Give a bone
    0

    Default Re: Attribute replacing

    You might be lucky to find such, but I wouldn't make my hopes up too high. Your scenario is quite unique, very few would have made their TB's that way - so your best bet would be to get hold of some of those more general routines (e.g. My BlockData.LSP in this thread) - there are various others if you prefer.

    Then you need to either modify them, or (as per those in mine) just re-use the functions in your own code. Basically something like:
    Code:
    (load "BlockData")
    (if (setq bRef (entsel "\nPick title block: "))
      (progn
        (setq bObj (vlax-ename->vla-object (car bRef)))
        (cond
          ((wcmatch (Blocks:GetAttrValue bObj "Rev") "0") ;Test if Rev is 0
           (Blocks:PutAttrValue bObj "Rev" "A") ;Change to A
           (Blocks:PutAttrValue bObj "Description" "For construction")
           ;; Etc.
          )
          ((wcmatch (Blocks:GetAttrValue bObj "Rev") "1")
           (Blocks:PutAttrValue bObj "Rev" "B")
           (Blocks:PutAttrValue bObj "Description" "For construction")
           ;; Etc.
          )
        )
      )
    )
    Edit: This may need quite some customizing for your case. Unfortunately it's not very simple to figure it out without a sample drawing.

  9. #9
    Member
    Join Date
    2009-02
    Posts
    7
    Login to Give a bone
    0

    Default Re: Attribute replacing

    Thank you,,
    Let me play with this

  10. #10
    All AUGI, all the time
    Join Date
    2010-10
    Posts
    535
    Login to Give a bone
    0

    Default Re: Attribute replacing

    I saw one a similar request like this way back. written by Peter of this forum called Bump.lsp

    http://www.augi.com/forums/showthread.php?t=126841

    Quote Originally Posted by Lee Mac View Post
    Do each of your values have the same attribute tag?, i.e. Do "0" and "1" both have attribute tag "Rev"? (similar for Description etc.)

    If they do, a program would have to rely on the order of the attributes in the block definition and *hope* it turns out OK..
    You're right Lee. a program like this will be block and position/order specific. in which case Tag Name is irrelevant

    One thing i dont get is the way you "bump" the Rev box. I would have think it would be like B would take place where A was and C -> B 0->C 1->0 and leave the top one as blank forthe As built info

    Code:
    (defun c:test (/ TB AttColl cnt)
    (setq TB (vlax-ename->vla-object (car (entsel))))
    (setq AttColl (vlax-invoke TB 'GetAttributes) cnt 6)
          (repeat (- (length AttColl) 7)
                (setq TheText (vla-get-textstring (nth (setq cnt (1+ cnt)) AttColl)))
                (vla-put-textstring (nth (- cnt 7) AttColl) TheText
                      ))
          (repeat 7
                (vla-put-textstring (nth cnt  AttColl) ""
                      )(setq cnt (1- cnt))
                )
          )
    In this example. (see attached) I already know that the second line of this revision box starts with attribute number 7 (rev_1)
    (actually 6 of the list <index 0>). I can tell the code to start reading and pass it on the (rev_0)
    and leave the last one as blank, or we can write it in such away the code will prompt you for the values on the last 7 tags

    like this
    Code:
    (defun c:test2 (/ TB AttColl cnt)
    (setq TB (vlax-ename->vla-object (car (entsel))))
    (setq AttColl (vlax-invoke TB 'GetAttributes) cnt 6)
          (repeat (- (length AttColl) 7)
                (setq TheText (vla-get-textstring (nth (setq cnt (1+ cnt)) AttColl)))
                (vla-put-textstring (nth (- cnt 7) AttColl) TheText
                      ))
          (setq cnt 20)
          (foreach  prmpt '("Revision Number/Letter: "
                        "Description: "
                        "Date: "
                        "Drawn By: "
                        "Checked By"
                        "Approved By [1]: "
                        "Approved By [2]: ")
         (while (eq ""
           (setq New (getstring (strcat "\n" prmpt)))))
    	 (vla-put-textstring (nth (setq cnt (1+ cnt)) AttColl)  New)
           )
          )
    Attached Files Attached Files

Page 1 of 3 123 LastLast

Similar Threads

  1. Replacing attribute values via an excel file
    By jgardner.79905 in forum AutoLISP
    Replies: 9
    Last Post: 2010-07-28, 12:16 PM
  2. Replacing Blocks
    By jitesh789 in forum AutoLISP
    Replies: 2
    Last Post: 2008-04-05, 05:21 PM
  3. Replacing Doors
    By nsinha73 in forum Revit Architecture - General
    Replies: 3
    Last Post: 2007-01-29, 10:35 PM
  4. Replacing Text
    By masonjur in forum Revit Architecture - General
    Replies: 2
    Last Post: 2006-08-28, 03:46 PM
  5. Replacing Blocks
    By bwilliams.72594 in forum AutoCAD General
    Replies: 2
    Last Post: 2005-10-05, 05:52 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •