Results 1 to 2 of 2

Thread: Sequentially change a attribute in block

  1. #1
    Active Member
    Join Date
    2015-09
    Posts
    72
    Login to Give a bone
    0

    Default Sequentially change a attribute in block

    Hello,
    I have a project that contains a lot of callout blocks for heat pumps.
    The attributes of the callout AHU type on top and number on bottom.
    Instead of do each one manually, is there a way to change the bottom number sequentially by order block selection?

  2. #2
    All AUGI, all the time
    Join Date
    2003-07
    Posts
    559
    Login to Give a bone
    0

    Default Re: Sequentially change a attribute in block

    This is a very simple method it uses the attribute order of creation so just enter the attribute sequence number as hinted if the bottom attribute is the second then enter 2 and the sequence number to start with.

    Code:
    (defun c:addnatt ( / x num att)
    (setq x (- (getint "\nEnter the attribute order position eg 1 is 1st attribute") 1))
    (setq num (getint "\nEnter start number"))
    (while (=  (vlax-property-available-p (setq obj (vlax-ename->vla-object (car (entsel "Select Block")))) 'Hasattributes) T)
    (setq att (vlax-invoke obj 'getattributes))
    (vla-put-textstring (nth x att) (rtos num 2 0))
    (setq num (+ num 1))
    )
    )
    (c:addnatt)

Similar Threads

  1. Change attribute textstyle within block
    By Corro in forum AutoLISP
    Replies: 10
    Last Post: 2017-05-01, 11:12 AM
  2. How to change dynamic block attribute default values based on block selected?
    By zeirz109180 in forum Dynamic Blocks - Technical
    Replies: 2
    Last Post: 2013-12-13, 02:20 PM
  3. Change the layer of a block using the attribute value
    By lee.harte.166277 in forum AutoLISP
    Replies: 0
    Last Post: 2012-09-20, 09:51 AM
  4. Replies: 13
    Last Post: 2012-09-18, 07:51 PM
  5. Title Block attribute change
    By jerry.smirl in forum AutoLISP
    Replies: 8
    Last Post: 2008-03-24, 03:22 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
  •