Well, I'll take you're word for it, that it works (but i have my doubts), but it's been a long time since i've seen such overkill of if's 😁
I just couldn't resist rewriting the lot.
Some explanation should be in place, but there's just to much...
I'll advice you to take a good look at the IF & COND statements and the use of variables.
Both by comparing your code to mine and by reading up on them in a manual or tutorial.
- you REALY don't need to check a variable 3 times, for 3 different var=value
- there's no need to repeat the same code 5 times, for 1 different number
- you can't (setq ...) a sysvar, neither can you compare it just by name as regular variables. Always use setvar and getvar for those.
& are you sure the "result" variable is EVER going to be above 1?
- getstring 1"" -to- getstring 5"" ???
See why I have my doubts that it works, correctly ?
and i found another custom function, not mentioned before:
EditAttribute2
So, here's the massively reduced code, which should do exactly the same (untested, bc: no sample dwg)
(vl-load-com)
(defun c:Submittal ( / result subDate subWhy subTo tag1 tag2 tag3)
(command "-layer" "ON" "*" "")
(command "-layer"
"OFF"
"Cutlist-FULL,*|Cutlist-FULL,Cutlist-2,*|Cutlist-2,Cutlist-4,*|Cutlist-4,Cutlist-8,*|Cutlist-8,Cutlist-12,*|Cutlist-12,Cutlist-16,*|Cutlist-16,Cutlist-24,*|Cutlist-24,Cutlist-32,*|Cutlist-32,Cutlist-48,*|Cutlist-48,Cutlist-96,*|Cutlist-96"
""
)
(while (= (getvar 'users1) "")
(initget "ONE ALL")
(setvar 'users1 (getkword "\n(O)ne Tab or (A)ll? : ")))
)
(If (= (getvar 'users1) "ONE")(setvar 'users1 "CTAB"))
(while (not (getvar useri3))
(setvar 'useri3 (getint "\nEnter Submittal Number <1-5> : "))
)
(Setq Date (YMD))
(if (= (setq SubDate (getstring "\nEnter Submittal Date or Enter for Today: ")) "")(setq Subdate1 Date))
(while (not SubWhy)
(initget "Approval Resubmittal ForRecord")
(setq SubWhy (getkword "\nfor (A)pproval/(R)esubmit for approval/(F)or record: "))
)
(cond
((= SubWhy "Approval")
(Setq SubWhy "FOR APPROVAL" SubStatus "OUT FOR APPROVAL")
(setvar 'users4 "SUBMITTAL PENDING")
)
((= SubWhy "Resubmittal")
(Setq SubWhy "RESUBMIT FOR APPROVAL" SubStatus "OUT FOR APPROVAL")
(setvar 'users4 "RESUBMITTAL PENDING")
)
((= SubWhy "ForRecord")
(Setq SubWhy "SUBMIT FOR RECORD" SubStatus "RECORD SET")
(setvar 'users4 "RESUBMITTAL PENDING")
)
)
(while (or (not subTo)(= subTo ""))
(setq SubTo (getstring T "\nSubmitted to: "))
)
(setq subnum (itoa (getvar 'useri3))
tag1 (strcat "SubDATE" subnum)
tag2 (strcat "SubWhy" subnum)
tag3 (strcat "SubTo" subnum)
)
(setq result (EditAttribute2 "Submittals" tag1 SubDate))
(setq result (EditAttribute2 "Submittals" tag2 SubWhy))
(setq result (EditAttribute2 "Submittals" tag3 SubTo))
(If (/= SubStatus "RECORD SET")
(setq result (EditAttribute2 "DrawingInformation" "Status" SubStatus))
)
(princ (cond ((= result 0) "Nothing changed.")
((= result 1) "Changed one attribute.")
(T (strcat "Changed "(itoa result) " attributes."))
))
(DWGInfo)
(setvar 'users2 JOBYEAR)
(setvar 'users3 JOBNUMBER)
(setvar 'users4 SERIES)
(command "-vbarun" "exportattribsSubmittals" "")
(princ)
)