How can I change LDD drawing scale using lisp?

Discussion in 'AutoCAD' started by Tomdum, Dec 21, 2004.

  1. Tomdum

    Tomdum Guest

    How can I change LDD drawing scale using lisp? Changing "ltscale" and "dimscale" isn't working. It seems like after I call a LDD function the scale goes back to what it was in Project>Drawing Setup...
    Anyone?
    Thanks,
    Tom
     
    Tomdum, Dec 21, 2004
    #1
  2. Tomdum

    Walt Engle Guest

    Been a very long time since I programmed lisp, but:

    (command "setvar" "dimscale" "x")
    (command "setvar" "ltscale" "y")

    I use the following in my acad.lsp:
    (COMMAND "SETVAR" "LTSCALE" (/ (GETVAR "DIMSCALE") 2))

    to make certain my ltscale is 1/2 the dimscale of new or older dwgs.
     
    Walt Engle, Dec 21, 2004
    #2
  3. Tomdum

    R.K. McSwain Guest


    Why do you want it different than what you specify in "Drawing Setup"?

    ------------

    If you are just looking for a way to programatically control those
    settings, you need to look into the LDT API.

    Open \Program Files\Land Desktop 2005\Help\landauto-reference.chm

    Check out the Object Model, specifically the DatabasePreferences object.
     
    R.K. McSwain, Dec 21, 2004
    #3
  4. Tomdum

    Josh Guest

    I wrote this to solve the problem you are having...it saves me from having
    to start LDD just to change the DIMSCALE and make it stick. It sets LDD's
    scale as well as the current DIMSCALE.

    ;;;grabs the AEC dict that contains the LDD scale and sets it to current
    DIMSCALE
    (defun c:dimscale (/ a b dimscale)

    (defun dxf (code elist) (cdr (assoc code elist)))

    (setq a (dictsearch (namedobjdict) "AEC_VARS"))
    (if a
    (progn
    (setq b (dictnext (dxf -1 a) t))
    (while (not (= (dxf 0 b) "AEC_VARS_DWG_SETUP"))
    (setq b (dictnext (dxf -1 a)))
    )
    (setq
    dimscale (getreal (strcat "\nEnter new value for DIMSCALE <"
    (rtos (dxf 40 b))
    ">: "
    )
    )
    )
    (if (not dimscale)
    (setq dimscale (dxf 40 b))
    )
    (setq b (entmod (subst (cons 40 dimscale) (assoc 40 b) b)))
    )
    (progn
    (setq
    dimscale (getreal (strcat "\nEnter new value for DIMSCALE <"
    (rtos (getvar "dimscale"))
    ">: "
    )
    )
    )
    (if (not dimscale)
    (setq dimscale (getvar "dimscale"))
    )
    )
    )
    (setvar "dimscale" dimscale)
    (princ)
    )



    "dimscale" isn't working. It seems like after I call a LDD function the
    scale goes back to what it was in Project>Drawing Setup...
     
    Josh, Dec 22, 2004
    #4
  5. Tomdum

    John Uhden Guest

    You should use the DatabaseScale property of the DatabasePreferences object of
    the ActiveDocument object of the ActiveProject object of the current
    AeccApplication.

    You probably need to study the landauto-reference.chm help file.

    Now I could give you a copy of my dictionary method that Josh suggested, but
    you'd be better off learning ActiveX methods.




    "dimscale" isn't working. It seems like after I call a LDD function the scale
    goes back to what it was in Project>Drawing Setup...
     
    John Uhden, Dec 22, 2004
    #5
  6. Tomdum

    Tomdum Guest

    Thanks, That's what I was looking for.
    Tom
     
    Tomdum, Dec 22, 2004
    #6
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.