See the top rated post in this thread. Click here

Results 1 to 7 of 7

Thread: Can't get DefaultFormatForSave to work in Lisp

  1. #1
    Member
    Join Date
    2006-10
    Posts
    5
    Login to Give a bone
    0

    Post Can't get DefaultFormatForSave to work in Lisp

    As we deploy 2019 AutoCAD, I'm wanting to automate the default save format to AutoCAD 2013 until everyone is upgraded, then switch it back to AutoCAD 2018. We have a pointer in our acad2019doc.lsp that looks to our main lisp file on the network, it has our custom tools built into it. Everything in there works fine, except the format save will not work. Any ideas out there on what the reason might be?

    (setenv "DefaultFormatForSave" "60")

    Thanks!

  2. #2
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,096
    Login to Give a bone
    1

    Default Re: Can't get DefaultFormatForSave to work in Lisp

    I'm not on 2019 yet, but have you tried using vlisp instead?

    Code:
    (vla-put-SaveAsType
        (vla-get-OpenSave
          (vla-get-Preferences (vlax-get-acad-object))
        )
        60
      )
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

  3. #3
    Member
    Join Date
    2006-10
    Posts
    5
    Login to Give a bone
    0

    Post Re: Can't get DefaultFormatForSave to work in Lisp

    I tried it on both our 2017 and 2019 versions and wouldn't work on either. No Idea why.

  4. #4
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,096
    Login to Give a bone
    0

    Default Re: Can't get DefaultFormatForSave to work in Lisp

    Quote Originally Posted by GoPackGo View Post
    I tried it on both our 2017 and 2019 versions and wouldn't work on either. No Idea why.
    You tried what? My code? or your code?

    My code is loaded in my acad.lsp file, which is run each time I start AutoCAD 2018. It was previously run in 2017 as well. I've successfully tested your code in 2018.
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

  5. #5
    Member
    Join Date
    2006-10
    Posts
    5
    Login to Give a bone
    0

    Default Re: Can't get DefaultFormatForSave to work in Lisp

    We load another lisp file that is on the network from our acad2017doc.lsp file that is shown below, then I tried your code and mine in the custom2017.lsp file. It's strange because I even have code to turn off automatic backup creation and that all works fine. I appreciate the help though.

    ;; Custom code/menu load up
    (load "r:\\custom\\Scripts\\custom2017.lsp")
    (setvar "menubar" 1)
    (c:safemenu)

  6. #6
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,658
    Login to Give a bone
    1

    Default Re: Can't get DefaultFormatForSave to work in Lisp

    Quote Originally Posted by GoPackGo View Post
    As we deploy 2019 AutoCAD, I'm wanting to automate the default save format to AutoCAD 2013 until everyone is upgraded, then switch it back to AutoCAD 2018. We have a pointer in our acad2019doc.lsp that looks to our main lisp file on the network, it has our custom tools built into it. Everything in there works fine, except the format save will not work. Any ideas out there on what the reason might be?

    (setenv "DefaultFormatForSave" "60")

    Thanks!
    Works perfectly fine here running from the command line. Try adding it to Acad.lsp, the acad2019doc.lsp file isn't intended for user modification.
    https://knowledge.autodesk.com/searc...42520-htm.html
    Note: Do not modify the reserved acad<release>doc.lsp file. Autodesk provides the acad<release>doc.lsp file, which contains required, release-specific, AutoLISP-defined functions. This file is loaded into memory immediately before the acaddoc.lsp file is loaded. <release> represents the release of the AutoCAD-based product; for example, acad2019doc.lsp would be the file loaded by AutoCAD 2019-based products.

  7. #7
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,803
    Login to Give a bone
    0

    Default Re: Can't get DefaultFormatForSave to work in Lisp

    Quote Originally Posted by GoPackGo View Post
    We have a pointer in our acad2019doc.lsp that looks
    Not that it directly affects this issue, but you shouldn't edit this file since those edits are subject to being lost during a hotfix, update, upgrade, etc.
    Use the placeholder provided for end users (Acaddoc.lsp)

    - - - Updated - - -

    Quote Originally Posted by GoPackGo View Post
    Everything in there works fine, except the format save will not work. Any ideas out there on what the reason might be?

    (setenv "DefaultFormatForSave" "60")
    So in your network lisp file, I presume there are other things being done, like

    Code:
    (function blah blah)
    (function2 blah blah)
    (setenv "DefaultFormatForSave" "60")
    (function3 blah blah)
    Perhaps a line of code *above* your (setenv) call is failing, in which case the rest of the file fails to load.
    Try placing (setenv "DefaultFormatForSave" "60") as the FIRST line of the lisp, or as a test add something like (alert "OK") to the line immediately following the (setenv) call.
    If the (alert) executes, then you know the (setenv) line at least tried to execute.
    R.K. McSwain | CAD Panacea |

Similar Threads

  1. Replies: 1
    Last Post: 2016-02-15, 03:45 PM
  2. Lisp routines don't work
    By boyerd492098 in forum AutoLISP
    Replies: 28
    Last Post: 2015-07-31, 06:51 PM
  3. Lisp routine doesn't work
    By boyerd492098 in forum AutoLISP
    Replies: 16
    Last Post: 2015-01-27, 10:13 PM
  4. lisp worked in 07 doesn't work in 09?
    By Hammer.John.J in forum AutoLISP
    Replies: 9
    Last Post: 2009-08-07, 04:22 PM
  5. Lisp won't work
    By BCrouse in forum AutoLISP
    Replies: 2
    Last Post: 2005-06-13, 09:54 PM

Tags for this Thread

Posting Permissions

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