View Full Version : Remove the .dwg from value returned via DwgName
bboss
2007-05-11, 03:23 PM
I often run a program that asks for the directory and then the name of the drawing and then combine them together.
(princ)
(setq FILE nil)
(setq PREFIX (getvar "dwgprefix"))
(setq DNAME (getvar "dwgname"))
(setq FNAME (strcat PREFIX DNAME ".DAT"))
Is there a way I can drop the .dwg from "dwgname" since I really want to make a .dat file?
Thanks,
Beth
T.Willey
2007-05-11, 03:26 PM
(vl-filename-base (getvar "dwgname"))
or
(setq Str (getvar "dwgname"))
(setq Str (substr Str 1 (- (strlen Str) 4)))
bboss
2007-05-11, 03:42 PM
Thank you very much!
Beth
T.Willey
2007-05-11, 04:16 PM
You're welcome Beth.
CADmium
2007-05-14, 05:43 AM
another way:
(cadr(fnsplitl (getvar "DWGname")))
fnsplitl is undocumented. The function splits the path:
(fnsplitl (strcat(getvar "dwgprefix")(getvar "DWGname")))
-first entry is the directory
-second entry the filename
-third entry the fileextension
kennet.sjoberg
2007-05-14, 05:59 AM
. . . fnsplitl is undocumented. . .
Great Thomas, do you have more undocumented candy ?
: ) Happy Computing !
kennet
Adesu
2007-05-14, 07:24 AM
Hi kennet,
Here others undocumented function
(xstrcase "adesu") ; => "ADESU"
(vmon) ; Virtual Memory On ... Release 10 ???
; Function Notes
(_ver) ; Returns AutoLISP build number (?).
(report) ; Inroduced in R12/DOS; never worked in Windows.
(vmon) ; Discontinued. Once used to enable virtual memory
; still there for compatibility, but does nothing.
(xstrcase) ; An international-friendly version of (strcase).
; From thomas.krueger (AUGI)
(fnsplitl) ; fnsplitl is undocumented. The function splits the path:
; (fnsplitl (strcat(getvar "dwgprefix")(getvar "DWGname")))
; -first entry is the directory
; -second entry the filename
; -third entry the fileextension
Great Thomas, do you have more undocumented candy ?
: ) Happy Computing !
kennet
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.