rajapower Posted May 30, 2015 Share Posted May 30, 2015 hi Hi This is my first post in this awesome forum. I’ m raja in drafting Kindly help me with a lisp program. That Asks the user to select various blocks in the drawing Places an attribute text over the value combine of text and unique no. Makes an attribute value with that att texts and sequence no. The values of the att block should contain the blocks Note: The tag name should be have a ID of tags in that value is (EXAMPLE : L00-350-01-EPC-6QE-01 (in end of the value change each block) for refer i attached the sample file of attributes Please help me. Daily I have to spend one hell of time in this work .Text with number.dwg Quote Link to comment Share on other sites More sharing options...
Tharwat Posted June 1, 2015 Share Posted June 1, 2015 In general what you are trying to do is doable but we need more details about the process and the outcome of the program to be able to write something useful . The two uploaded drawings are the same in contents , aren't they ? I could not see any difference and you might did uploaded two copies by mistake unless you have something important that you did forget to mention ! Quote Link to comment Share on other sites More sharing options...
rajapower Posted June 2, 2015 Author Share Posted June 2, 2015 In general what you are trying to do is doable but we need more details about the process and the outcome of the program to be able to write something useful .The two uploaded drawings are the same in contents , aren't they ? I could not see any difference and you might did uploaded two copies by mistake unless you have something important that you did forget to mention ! thks for reply, sorry the files uploaded twices... Quote Link to comment Share on other sites More sharing options...
Tharwat Posted June 2, 2015 Share Posted June 2, 2015 And then ... Quote Link to comment Share on other sites More sharing options...
rajapower Posted June 2, 2015 Author Share Posted June 2, 2015 i need to fill the attribute value in the block syntax of attribute tag is "ID" in that unique value to update the each attribute block, like each block should have been sequence no. Ex: L00-350-01-EPC-6QE-01 in this (end of the value to change each block) that means next block once to pick i need to get sequence no of L00-350-01-EPC-6QE-02 Quote Link to comment Share on other sites More sharing options...
rajapower Posted June 2, 2015 Author Share Posted June 2, 2015 string with autonumber attribute Quote Link to comment Share on other sites More sharing options...
Tharwat Posted June 2, 2015 Share Posted June 2, 2015 So you want the program to ask the user to specify the first increment number then after select a bunch of attributed blocks, the program should combine the current text string in the ID tag name with the new increment number ? Is that what you are after ? Quote Link to comment Share on other sites More sharing options...
rajapower Posted June 2, 2015 Author Share Posted June 2, 2015 yes, your right Quote Link to comment Share on other sites More sharing options...
rajapower Posted June 2, 2015 Author Share Posted June 2, 2015 i have number incrementally but in that i need the string also. fYR the lisp (defun c:UPNUMBER (/ tagname addno ss en an ad ch) (setq tagname "ID") (or def_addno (setq def_addno 1)) (initget 6) (setq addno (getint (strcat "\nStarting Number (itoa def_addno) ">: " ) ) ) (or addno (setq addno def_addno)) (and (setq ss (ssget '((0 . "INSERT") (66 . 1)))) (while (setq en (ssname ss 0)) (setq an (entnext en) ad (entget an) ch nil ) (while (and (= "ATTRIB" (cdr (assoc 0 ad))) (not ch) ) (and (= (strcase tagname) (strcase (cdr (assoc 2 ad))) ) (setq ch T) (entmod (subst (cons 1 (itoa addno)) (assoc 1 ad) ad ) ) (setq addno (1+ addno)) ) (setq an (entnext an) ad (entget an) ) ) (if ch (entupd en) (progn (redraw en 3) (alert "ID Tag Not Found In This Block") (redraw en 1) ) ) (ssdel en ss) ) ) (setq def_addno addno) (prin1) ) Quote Link to comment Share on other sites More sharing options...
Tharwat Posted June 3, 2015 Share Posted June 3, 2015 (edited) This ? (defun c:Test (/ v lst n s ss) ;;------------------------------------;; ;; Tharwat 03.06.2015 ;; ;; Increment with a number entered ;; ;; by a user if the tag string is ID ;; ;;------------------------------------;; (if (and (setq v (getstring "\nSpecify String with integer number at the end :" ) ) (if (setq lst (_parseInt v)) (setq n (read (car lst)) s (cadr lst) ) (progn (alert "\nEntered value must have integer number at the end !" ) nil ) ) (princ "\nSelect Attributed Block that have ID tag name :") (setq ss (ssget "_:L" '((0 . "INSERT") (66 . 1)))) ) ((lambda (i / sn) (while (setq sn (ssname ss (setq i (1+ i)))) (mapcar '(lambda (a) (if (eq (strcase (vla-get-tagstring a)) "ID") (progn (vla-put-textstring a (strcat s (if (< n 10) (strcat "0" (itoa n)) (itoa n) ) ) ) (setq n (1+ n)) ) ) ) (vlax-invoke (vlax-ename->vla-object sn) 'getattributes) ) ) ) -1 ) ) (princ) )(vl-load-com) (defun _parseInt (v / l) (setq v (vl-list->string (reverse (vl-string->list v)))) (while (and v (numberp (read (setq n (substr v 1 1))))) (setq l (cons n l) v (substr v 2) ) ) (if l (list (apply 'strcat l) (vl-list->string (reverse (vl-string->list v))) ) ) ) Edited June 3, 2015 by Tharwat Quote Link to comment Share on other sites More sharing options...
rajapower Posted June 3, 2015 Author Share Posted June 3, 2015 thks for your reply, your given in the lisp is only having the integer value only accepting. but i need with string and integer value ex : L03-314-01-EPC-6QR-01 upto highlighted in red text (string) is remaining same in end the number (integer) value alone will be increment the value. Quote Link to comment Share on other sites More sharing options...
Tharwat Posted June 3, 2015 Share Posted June 3, 2015 I modified the previous program and now it does accept number or string with integer at the end . Try it and let me know. Quote Link to comment Share on other sites More sharing options...
rajapower Posted June 3, 2015 Author Share Posted June 3, 2015 it's working.... thks alot......... nice lisp for me........... Quote Link to comment Share on other sites More sharing options...
Tharwat Posted June 3, 2015 Share Posted June 3, 2015 Nice , you are welcome. 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.