+ Reply to Thread
Results 1 to 10 of 10
  1. #1
    Full Member
    Using
    Electrical 2011
    Join Date
    Apr 2011
    Posts
    88

    Default numinc for attributes

    Registered forum members do not see this ad.

    Hello,
    Is there a version of Lee Mac's numinc.lsp that can be used with block attributes. So run the lisp, it askes to pick a block, it returs a screen with the question witch tag from the block to use and rest the same as numinc lisp. After that pick the blocks in your order and set the attributes.

    Thanks,

    Pmxcad

  2. #2
    Super Member Lt Dan's legs's Avatar
    Using
    AutoCAD 2007
    Join Date
    May 2010
    Location
    Florida
    Posts
    574

    Default

    NUMBER ATT.gif

    Here's a good start for you.

    Code:
     
    (defun c:test ( / ss->lst ss n )
      (vl-load-com)
      (defun ss->lst ( ss flag / id lst )
        (if (eq 'PICKSET (type ss))
          (repeat (setq id (sslength ss))
            (
              (lambda ( name )
                (setq lst
                  (cons
                    (if flag (vlax-ename->vla-object name)
                      name
                    )lst
                  )
                )
              )(ssname ss (setq id (1- id)))
            )
          )
        )
      )
      (if 
        (and 
          (setq ss 
            (ss->lst (ssget '((0 . "insert")(66  . 1))) t)
          ) (setq n 0)
        )
        (foreach x (reverse ss)
          (foreach p (vlax-invoke x 'GetAttributes)
            (if (eq (strcase (vla-get-textstring p)) "T")
              (vlax-put p 'TextString (itoa (setq n (1+ n))))
            )
          )
        )
      ) (princ)
    )

  3. #3
    Forum Deity pBe's Avatar
    Computer Details
    pBe's Computer Details
    Operating System:
    Windows XP
    Discipline
    Construction
    pBe's Discipline Details
    Discipline
    Construction
    Details
    Camp Construction planning and details
    Using
    AutoCAD 2009
    Join Date
    Apr 2010
    Posts
    2,106

    Default

    Here is my version:

    Code:
    (defun c:AdSel (/ aDoc TagSource ent Blk Var1 Var2)
    (vl-load-com)
           (setq aDoc (vla-get-ActiveDocument (vlax-get-acad-object)))
            (cond ((and
            (setq TagSource (car (nentselp "\nSelect Attribute: ")))
             (eq (cdr (assoc 0 (setq ent (entget TagSource)))) "ATTRIB")
             (setq Vlt (list (cdr (assoc 2 ent))(cdr (assoc 1 ent))))
             (setq i 0 AtVl (vlax-invoke (setq entV
                                    (vla-ObjectIdToObject
                                          aDoc
                                          (vla-get-OwnerId
                                                (vlax-ename->vla-object
                                                      TagSource))
                                          ))
                                    'GetAttributes))
     
              (while (not              
        (and  (eq (vla-get-tagstring (car AtVl)) (car Vlt))
                    (eq (vla-get-textstring (car AtVl)) (cadr Vlt))))
               (setq i (1+ i) Atvl (cdr Atvl))
                    )
             )
                   )
                  )
     (setq pt1 (getpoint "\nPick Base Point:"))
     (while 
           (setq pt2 (getpoint pt1 "\nNext Point"))
               (vlax-invoke (setq NewObj (vla-copy entV)) 'Move pt1 pt2)
             (setq At2Mod (nth i (vlax-invoke NewObj 'GetAttributes))
              str (vla-get-textstring At2Mod)
              crtVal
      (atoi (substr str (+ (strlen (setq prf_t
                               (vl-string-right-trim  "1234567890" str))) 1))))          
      (vla-put-textstring At2Mod (strcat prf_t (itoa (1+ crtVal))))
             (setq pt1 pt2 entv NewObj)
                      )
               )
    The difference with this one is as you copy the block the attrinbute you select (on prompt) will be the one that increments

    Hope this helps

  4. #4
    Full Member
    Using
    Electrical 2011
    Join Date
    Apr 2011
    Posts
    88

    Default

    The blocks are already in the drawing, and i want to pick the blocks one by one in my own order. I like the numinc lisp, i can set a frefix, suffix, etc etc...........

    Pmxcad

  5. #5
    Forum Deity pBe's Avatar
    Computer Details
    pBe's Computer Details
    Operating System:
    Windows XP
    Discipline
    Construction
    pBe's Discipline Details
    Discipline
    Construction
    Details
    Camp Construction planning and details
    Using
    AutoCAD 2009
    Join Date
    Apr 2010
    Posts
    2,106

    Default

    No worries pmxcad, the routine i posted is especially usefull for blocks with multiple attributes but having the same TAG name. <it happens more often that you think> and like i said, its different in such a way that it creates new copies of the the block and increments it. i.e.

    1 to 2
    Box12 to Box13

    Maybe one day i will modify it for existing blocks and add a prompt for suffix/prefix etc..

    Cheers

  6. #6
    Senior Member
    Computer Details
    VVA's Computer Details
    Operating System:
    Windows 7
    CPU:
    Intel Core i5-2400
    RAM:
    8 Gb
    Graphics:
    Nvidia Quadro 600
    Primary Storage:
    Seagate 500 GB + WD 750 GB
    Monitor:
    Philips 27"
    Using
    AutoCAD 2013
    Join Date
    Dec 2006
    Location
    Minsk, Belarus
    Posts
    401

    Default

    AsmiTools Renum?
    RENUM.LSP - This program converts TEXT, MTEXT and ATTRIBUTES in numbers with a prefix and a suffix.
    dwgru archive
    cadtutor archive

  7. #7
    Senior Member
    Computer Details
    VVA's Computer Details
    Operating System:
    Windows 7
    CPU:
    Intel Core i5-2400
    RAM:
    8 Gb
    Graphics:
    Nvidia Quadro 600
    Primary Storage:
    Seagate 500 GB + WD 750 GB
    Monitor:
    Philips 27"
    Using
    AutoCAD 2013
    Join Date
    Dec 2006
    Location
    Minsk, Belarus
    Posts
    401

    Default

    maybe it will be just as useful

    AutoLabel Attributes


  8. #8
    Full Member
    Using
    Electrical 2011
    Join Date
    Apr 2011
    Posts
    88

    Default

    Yep, RENUM.LSP comes very close. But in the numinc lisp from Lee Mac i can also choose alphanummeric characters to start with. I also like the dialogscreen.
    So renum.lsp is a good lisp but i like the options in the numinc lisp. Like layer, text high, text border, text style etc.


    PmxCAD

  9. #9
    Super Member Lt Dan's legs's Avatar
    Using
    AutoCAD 2007
    Join Date
    May 2010
    Location
    Florida
    Posts
    574

    Default

    dialog box http://web2.airmail.net/terrycad/Tut.../MyDialogs.htm

    another great tool:
    Code:
    (defun c:dump ( / e )
      (vl-load-com)
      (if (setq e (car (entsel "\nSelect an object: ")))
        (progn
          (vlax-dump-object (vlax-ename->vla-object e) t)
          (textscr)
        )
      ) (princ)
    )

  10. #10
    Full Member
    Using
    Electrical 2011
    Join Date
    Apr 2011
    Posts
    88

    Default

    Registered forum members do not see this ad.

    Oookay,
    it shows about everything of that block but i cannot change it. The dcl dialogs.......... lot of information to read and to learn. Ok, takes some time.

    Thanks

    Pmxcad

Similar Threads

  1. Attributes
    By camel_racer in forum AutoLISP, Visual LISP & DCL
    Replies: 11
    Last Post: 24th Feb 2011, 01:23 am
  2. I have an error message using NUMINC Lisp routine
    By Croftyno1 in forum AutoLISP, Visual LISP & DCL
    Replies: 2
    Last Post: 14th Feb 2011, 10:53 pm
  3. Replace block and its attributes with new block and attributes
    By SPACECADET in forum AutoCAD Drawing Management & Output
    Replies: 9
    Last Post: 11th Feb 2011, 03:10 pm
  4. What is Attributes
    By Sudhir in forum Tutorials & Tips'n'Tricks
    Replies: 32
    Last Post: 24th Mar 2010, 10:58 am
  5. attributes
    By chrisdarmanin in forum AutoCAD Drawing Management & Output
    Replies: 6
    Last Post: 18th Sep 2007, 03:07 pm

Bookmarks

Posting Permissions

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