Jump to content

Renumbering block atributte tags


Recommended Posts

Posted (edited)

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
  • 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

Posted

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 . :)

Posted

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

Posted

yes but folowing x or y condinates

Posted

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)
)

Posted

unfortunately the only thing it does is select and noting more

 

 

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

Posted
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 .:)

Posted

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?

Posted
Maybe he used invisible ultra top secret attributes.

confidential attributes ? :lol: :lol:

Posted

QUOTE=Tharwat;442699]There is no attributed block within these drawings that you have already uploaded . :shock: Check your drawings again .:)

 

block

RK_PR_1.dwg

 

exampel drwawing

test.dwg[

Posted

There is not any attributed block into these drawing either .

 

Check this drawing which contain attributed block .

TesT.dwg

Posted

Wait I got it . :D

 

You have attributes but not attributed blocks . :o Right ?

Posted

Block RK_PR_1 has the following attributes:

 

PNUM

SCH

PLEN

INHEI

AFHAK

SLEN

PWAP

DRAAGF

TREKF

Posted
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 .

Posted

so the block inculdes atributes sory if my misconseptions maaks it a atributed block xd cominucatiion fail

Posted

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)
)

Posted

the only value that maters is the PNUM ! it only has to renumber that !

Posted

but that would men i have to explode evry thing and thas not handy at al

Posted
the only value that maters is the PNUM ! it only has to renumber that !

I couldn't get what you mean , but try the code and tell me back .

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...