Kevin v/d Berg Posted December 5, 2011 Share Posted December 5, 2011 (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 December 5, 2011 by Kevin v/d Berg Quote Link to comment Share on other sites More sharing options...
Tharwat Posted December 5, 2011 Share Posted December 5, 2011 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 . Quote Link to comment Share on other sites More sharing options...
Kevin v/d Berg Posted December 5, 2011 Author Share Posted December 5, 2011 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 Quote Link to comment Share on other sites More sharing options...
ReMark Posted December 5, 2011 Share Posted December 5, 2011 Kind of like "find and replace" right? Quote Link to comment Share on other sites More sharing options...
Kevin v/d Berg Posted December 5, 2011 Author Share Posted December 5, 2011 yes but folowing x or y condinates Quote Link to comment Share on other sites More sharing options...
Tharwat Posted December 5, 2011 Share Posted December 5, 2011 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) ) Quote Link to comment Share on other sites More sharing options...
Kevin v/d Berg Posted December 5, 2011 Author Share Posted December 5, 2011 unfortunately the only thing it does is select and noting more maby the block and mij exampel wil help you get what i mean Quote Link to comment Share on other sites More sharing options...
Tharwat Posted December 5, 2011 Share Posted December 5, 2011 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 . Check your drawings again . Quote Link to comment Share on other sites More sharing options...
ReMark Posted December 5, 2011 Share Posted December 5, 2011 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? Quote Link to comment Share on other sites More sharing options...
Tharwat Posted December 5, 2011 Share Posted December 5, 2011 Maybe he used invisible ultra top secret attributes. confidential attributes ? :lol: Quote Link to comment Share on other sites More sharing options...
Kevin v/d Berg Posted December 5, 2011 Author Share Posted December 5, 2011 QUOTE=Tharwat;442699]There is no attributed block within these drawings that you have already uploaded . Check your drawings again . block RK_PR_1.dwg exampel drwawing test.dwg[ Quote Link to comment Share on other sites More sharing options...
Tharwat Posted December 5, 2011 Share Posted December 5, 2011 There is not any attributed block into these drawing either . Check this drawing which contain attributed block . TesT.dwg Quote Link to comment Share on other sites More sharing options...
Tharwat Posted December 5, 2011 Share Posted December 5, 2011 Wait I got it . You have attributes but not attributed blocks . Right ? Quote Link to comment Share on other sites More sharing options...
ReMark Posted December 5, 2011 Share Posted December 5, 2011 Block RK_PR_1 has the following attributes: PNUM SCH PLEN INHEI AFHAK SLEN PWAP DRAAGF TREKF Quote Link to comment Share on other sites More sharing options...
Tharwat Posted December 5, 2011 Share Posted December 5, 2011 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 . Quote Link to comment Share on other sites More sharing options...
Kevin v/d Berg Posted December 5, 2011 Author Share Posted December 5, 2011 so the block inculdes atributes sory if my misconseptions maaks it a atributed block xd cominucatiion fail Quote Link to comment Share on other sites More sharing options...
Tharwat Posted December 5, 2011 Share Posted December 5, 2011 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) ) Quote Link to comment Share on other sites More sharing options...
Kevin v/d Berg Posted December 5, 2011 Author Share Posted December 5, 2011 the only value that maters is the PNUM ! it only has to renumber that ! Quote Link to comment Share on other sites More sharing options...
Kevin v/d Berg Posted December 5, 2011 Author Share Posted December 5, 2011 but that would men i have to explode evry thing and thas not handy at al Quote Link to comment Share on other sites More sharing options...
Tharwat Posted December 5, 2011 Share Posted December 5, 2011 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 . Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.