hello All,
I am tring to develop a lisp routine to change the sheet number to match the last 3 digits of the drawing number.
I have been able to get and write the proper number the the sheet value but it adds it to the existing sheet value.
Can anyone help me with deleting or overwriting that sheet value before i add the correct value??
Thanks
Dennis
(prompt "\nType AAA to run.....")
(defun c:aaa ()
(COMMAND "-ATTEDIT" "N" "N" "WD_M" "SHEET" "" "" (SUBSTR (GETVAR "DWGNAME") (- (STRLEN (GETVAR "DWGNAME")) 6) 3))
(princ) )
the result finds the correct number and adds it to the existing sheet number i need it to overwrite the sheet number
Solved! Go to Solution.
Solved by acade2012. Go to Solution.
I did notice with the 2nd set of empty "". this is looking for a value to search for and replace. If i put in the current sheet value is changes it correctly.
the issue is that value changes from drawing to drawing.
I tried to get the current sheet value out but I am not having any luck.
i have tried the follwing
SETQ SHTNUM (GET_ATTR "WD_M" "SHEET" )
SETQ SHTNUM (GETVAR SHEET)
ANY IDEAS?
HERE IS WHAT I ENDED UP FIGURING OUT
FIRST LINE CLEARS THE SHEET NUMBER AND THE SECOND COPIES THE DRAWING NUMBER (ISTATING AT INTIGER 6 GOING 3 PLACES)
HOPE THIS WILL HELP SOMEONE!!!
(prompt "\nType SHTNUM to run.....")
(defun c:SHTNUM ()
(c:wd_modattrval (ssname(ssget "x" (list (cons 0 "insert")(cons 2 "WD_M"))) 0) "SHEET" "" 1) ;CLEARS SHEET VALUE
(COMMAND "-ATTEDIT" "N" "N" "WD_M" "SHEET" "" "" (SUBSTR (GETVAR "DWGNAME") (- (STRLEN (GETVAR "DWGNAME")) 6) 3)) ;SET SHEET VALUE=DWGNAME
(PRINC) )
This worked perfect for me. One thing, the "SmileyFrustrated" (:S) is really a colon (":") followed by a capital "S".
This "short version" does the same... No need to clear the value and then use the -ATTEDIT to set the new value. Just set it directly.
(prompt "\nType SHTNUM to run.....") (defun c:SHTNUM () (c:wd_modattrval (ssname(ssget "x" (list (cons 0 "insert")(cons 2 "WD_M"))) 0) "SHEET" (SUBSTR (GETVAR "DWGNAME") (- (STRLEN (GETVAR "DWGNAME")) 6) 3) 1) (PRINC) )