AutoCAD Electrical Forum
Welcome to Autodesk’s AutoCAD Electrical Forums. Share your knowledge, ask questions, and explore popular AutoCAD Electrical topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

sheet number lisp rotine help

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
acade2012
1497 Views, 4 Replies

sheet number lisp rotine help

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

4 REPLIES 4
Message 2 of 5
acade2012
in reply to: acade2012

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?

Message 3 of 5
acade2012
in reply to: acade2012

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

 

 

Message 4 of 5
erg.cgs
in reply to: acade2012

This worked perfect for me. One thing, the "SmileyFrustrated" (:S) is really a colon (":") followed by a capital "S".

Message 5 of 5
rhesusminus
in reply to: erg.cgs

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

 


Trond Hasse Lie
AutoCAD Electrical and EPLAN expert
Ctrl Alt El
Please select "Accept Solution" if this post answers your question. 'Likes' won't hurt either. 😉

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost