Jump to content

Renumbering block atributte tags


Kevin v/d Berg

Recommended Posts

Hey my name is Kevin and I’m in need of a Autolisp program that help's me runumber a large amount of blocks inculdit whit an atribute used to number it

For example:

 

folowing x or y cordinates

 

1234 left to right

5678

 

Or

369

258

147

I need this program to rearrange the attribute valus of my foundation plan

 

there ar alot of progams on the internet but nun of them works just fine most of them scrambel to fil in the corect numbers and at the end i stil have to put it in al manualie

Edited by Kevin v/d Berg
Link to comment
Share on other sites

  • Replies 64
  • Created
  • Last Reply

Top Posters In This Topic

  • Kevin v/d Berg

    22

  • ReMark

    17

  • Tharwat

    14

  • Lee Mac

    7

Popular Days

Top Posters In This Topic

Welcome to the forum kevin :)

 

What do you mean by rearrange ? do you want to replace with these values with another or to adjust their locations ?

 

More clear explanation from you , would let people give the best they can . :)

Link to comment
Share on other sites

what i meen is i have a large amount of blocks whits inculde an atribute

to indicate the number of te pillar

 

i'm trying to create or get som help to get a lisp to renumber the values of a specific atrubute tag in oorder to corect the numbers in mij foundation plan

 

here is an exampel

RK_PR_1.dwg

test.dwg

Link to comment
Share on other sites

Try this .... Kevin :)

 

(defun c:TesT (/ blks i sn n st e)
;;; Tharwat 05. Dec. 2011 ;;;
 (if
   (setq blks (ssget '((0 . "INSERT") (66 . 1))))
   (repeat
     (setq i (sslength blks))
     (setq sn (ssname blks (setq i (1- i))))
     (setq n (entnext sn))
     (while
       (not
         (eq
           (cdr
             (assoc 0 (setq e (entget n)))) "SEQEND"))
       (if (eq (cdr (assoc 0 e)) "ATTRIB")
         (progn (setq st (cdr (assoc 1 e)))
                (entmod
                  (subst
                    (cons 1 (vl-list->string (reverse (vl-sort (vl-string->list st) '>))))
                    (assoc 1 e) e)
                )
         )
       )
       (setq n (entnext n))
     )
   )
 )
 (princ)
)

Link to comment
Share on other sites

unfortunately the only thing it does is select and noting more

 

 

maby the block and mij exampel wil help you get what i mean

Link to comment
Share on other sites

unfortunately the only thing it does is select and noting more

 

 

maby the block and mij exampel wil help you get what i mean

 

There is no attributed block within these drawings that you have already uploaded . :shock: Check your drawings again .:)

Link to comment
Share on other sites

Test.dwg blocks do have attributes PNUM and SCH. PNUM is different for each block but SCH is the same for every block. There are no values for the remaining seven attributes.

 

RK_PR_1.dwg is for the block used in Test.dwg and really isn't of any value as far as I can determine.

 

Where are the X and Y coordinates you mentioned?

Link to comment
Share on other sites

Block RK_PR_1 has the following attributes:

 

PNUM

SCH

PLEN

INHEI

AFHAK

SLEN

PWAP

DRAAGF

TREKF

 

If so , my codes would work for him .

But as I can see the property of these texts are attributes and not attributed blocks at all , and the only block that you can insert from the drawing is only

one without a text either .

Link to comment
Share on other sites

This works for attributes only ....

 

(defun c:TesT (/ ss i sn n st e)
;;; Tharwat 05. Dec. 2011 ;;;
 (if
   (setq ss (ssget '((0 . "ATTDEF"))))
   (repeat
     (setq i (sslength ss))
     (setq sn (ssname ss (setq i (1- i))))
     (setq st (cdr (assoc 2 (setq e (entget sn)))))
     (entmod
       (subst (cons 2 (vl-list->string (reverse (vl-sort (vl-string->list st) '>))))
              (assoc 2 e)
              e)
     )
   )
   (princ)
 )
 (princ)
)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...