S::Startup question

Discussion in 'AutoCAD' started by Tom Hanley, Oct 1, 2004.

  1. Tom Hanley

    Tom Hanley Guest

    why doesn't this work in my acad.lsp file? I get a "LFD" command unknown
    during the drawing startup but as soon as the command line is ready, typing
    "LFD" runs the routine.


    (defun-q MYSTARTUP ( )

    (defun C:LayerFiltersDelete ()
    (vl-Load-Com)
    (vl-Catch-All-Apply
    '(lambda ()
    (vla-Remove (vla-GetExtensionDictionary
    (vla-Get-Layers
    (vla-Get-ActiveDocument
    (vlax-Get-Acad-Object))))
    "ACAD_LAYERFILTERS")))
    (princ "\nAll layer filters have been deleted.")
    (princ))

    (defun C:LFD () (C:LayerFiltersDelete))

    )


    (setq S::STARTUP (append S::STARTUP MYSTARTUP))

    (command "LFD")
     
    Tom Hanley, Oct 1, 2004
    #1
  2. Instead of the (command) call, simply use:

    (C:LFD)

    --
    R. Robert Bell


    why doesn't this work in my acad.lsp file? I get a "LFD" command unknown
    during the drawing startup but as soon as the command line is ready, typing
    "LFD" runs the routine.


    (defun-q MYSTARTUP ( )

    (defun C:LayerFiltersDelete ()
    (vl-Load-Com)
    (vl-Catch-All-Apply
    '(lambda ()
    (vla-Remove (vla-GetExtensionDictionary
    (vla-Get-Layers
    (vla-Get-ActiveDocument
    (vlax-Get-Acad-Object))))
    "ACAD_LAYERFILTERS")))
    (princ "\nAll layer filters have been deleted.")
    (princ))

    (defun C:LFD () (C:LayerFiltersDelete))

    )


    (setq S::STARTUP (append S::STARTUP MYSTARTUP))

    (command "LFD")
     
    R. Robert Bell, Oct 1, 2004
    #2
  3. Tom Hanley

    R.K. McSwain Guest



    Why not just do this:
     
    R.K. McSwain, Oct 1, 2004
    #3
  4. Tom Hanley

    Tom Hanley Guest

    I failed to mention that I am using LDT2005...
    Also, the (c:lfd) doesn't work for me either... I get no function definition
    during drawing opening.
     
    Tom Hanley, Oct 1, 2004
    #4
  5. Tom Hanley

    Dan Allen Guest

    It seems you're loading a file that defines your s::startup, which defines
    the command. Your file then immediately calls the command. You have to wait
    till s::startup executes before the command is available. Should be as
    simple as putting the command call in right after you define the shortcut
    (defun C:LFD () (C:LayerFiltersDelete))

    Dan
     
    Dan Allen, Oct 1, 2004
    #5
  6. Tom Hanley

    Tom Hanley Guest

    That sounds logical but it doesn't seem to work when LDT2005 opens a drawing
    file. It may be some timing issue because the command can be run after the
    command line is ready to receive a command.
     
    Tom Hanley, Oct 1, 2004
    #6
  7. Tom Hanley

    Dan Allen Guest

    Right, that is because s::startup has loaded, after all the core autocad
    components have.

    Did you test my suggestion? Which file are you defining s::startup in?
     
    Dan Allen, Oct 1, 2004
    #7
  8. Tom Hanley

    Tom Hanley Guest

    I have it in my acad.lsp file. I misunderstood the first time I read what
    you told me to do. It did work after your suggestion, Thanks!
     
    Tom Hanley, Oct 1, 2004
    #8
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.