- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello!
I'm looking for a way to edit the name of a DWF file through LISP and I'm having trouble figuring out how to adjust the drawn date in the name of the file. Examples of the file names are as follows:
"410081 QC 20201214 (13355267_C6_04). MOD-R1-D.dwf"
"9902 QC 20200302 (13455921_C6_03). MOD-R1-D.dwf"
"206502 QC 20190528 (OAA153952_C6_03). MOD-R1-D.dwf"
"60 QC 20181104 (OAA251516_C6_08). MOD-R2-D.dwf"
"SiteNum QC DateInitiated (ProjectNum). MOD-ReviewNum-D.dwf"
The problem I'm running into is trying to figure out a way to return the date that the drawing was initiated. Our drawings are saved in a format such as;
"410081-MP-20201214-00.dwg"
"SiteNum-MP-DateInitiated-00.dwg"
(vl-load-com)
(setq si (vla-Get-SummaryInfo (vla-Get-ActiveDocument (vlax-Get-Acad-Object))))
(vla-GetCustomByKey si "Project Number" 'pval1)
(setq DWFOutFileName
(strcat (substr (getvar "dwgname") 1 (- (strlen (getvar "dwgname")) 19)) " QC " (substr (getvar "dwgname") 1 (- (strlen (getvar "dwgname")) 7)) " (" pval1 "). MOD-R1-D.dwf"))
What I have right now returns "410081 QC 410081-MP-20201214 (13355267_C6_04). MOD-R1-D.dwf"
but I need it to be re-named to "410081 QC 20201214 (13355267_C6_04). MOD-R1-D.dwf"
Is there an easy way to remove the "410081-MP-" from the line above, even if the SiteNum length varies?
Any help is appreciated as always!
Solved! Go to Solution.