Results 1 to 7 of 7

Thread: Remove the .dwg from value returned via DwgName

  1. #1
    Member
    Join Date
    2002-02
    Posts
    37
    Login to Give a bone
    0

    Default Remove the .dwg from value returned via DwgName

    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

  2. #2
    AUGI Addict
    Join Date
    2005-08
    Posts
    1,043
    Login to Give a bone
    0

    Default Re: Remove the .dwg from value returned via DwgName

    Code:
    (vl-filename-base (getvar "dwgname"))
    or
    Code:
    (setq Str (getvar "dwgname"))
    (setq Str (substr Str 1 (- (strlen Str) 4)))

  3. #3
    Member
    Join Date
    2002-02
    Posts
    37
    Login to Give a bone
    0

    Default Re: Remove the .dwg from value returned via DwgName

    Thank you very much!

    Beth

  4. #4
    AUGI Addict
    Join Date
    2005-08
    Posts
    1,043
    Login to Give a bone
    0

    Default Re: Remove the .dwg from value returned via DwgName

    You're welcome Beth.

  5. #5
    100 Club CADmium's Avatar
    Join Date
    2004-08
    Location
    Eberswalde, Germany, Europe
    Posts
    128
    Login to Give a bone
    0

    Default Re: Remove the .dwg from value returned via DwgName

    another way:
    Code:
    (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

  6. #6
    AUGI Addict kennet.sjoberg's Avatar
    Join Date
    2002-05
    Posts
    1,707
    Login to Give a bone
    0

    Default Re: Remove the .dwg from value returned via DwgName

    Quote Originally Posted by thomas.krueger
    . . . fnsplitl is undocumented. . .
    Great Thomas, do you have more undocumented candy ?

    : ) Happy Computing !

    kennet
    The essential thing is what you write in the post. . . .not the numbers of posts.

  7. #7
    I could stop if I wanted to
    Join Date
    2003-11
    Posts
    277
    Login to Give a bone
    0

    Default Re: Remove the .dwg from value returned via DwgName

    Hi kennet,
    Here others undocumented function
    Code:
    (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
    Quote Originally Posted by kennet.sjoberg
    Great Thomas, do you have more undocumented candy ?

    : ) Happy Computing !

    kennet

Similar Threads

  1. Replies: 5
    Last Post: 2014-08-06, 09:33 PM
  2. Borrowed Licenses not being returned
    By ROBinHI in forum Revit Architecture - General
    Replies: 0
    Last Post: 2010-03-04, 10:52 PM
  3. Publishing PLTs without DWGname infront of Layout name
    By ReachAndre in forum AutoCAD Plotting
    Replies: 2
    Last Post: 2009-04-10, 11:41 AM
  4. Differences in content of Mtext returned
    By jmcshane in forum AutoLISP
    Replies: 2
    Last Post: 2007-06-14, 08:50 PM
  5. Installed '07, and '06 returned
    By dmarx in forum AutoCAD Civil 3D - General
    Replies: 1
    Last Post: 2006-05-08, 06:50 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •