+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 14
  1. #1
    Senior Member
    Using
    Map 3D 2007
    Join Date
    Sep 2009
    Posts
    142

    Default Commands vrom VLX in Lisp

    Registered forum members do not see this ad.

    Hi

    I'm trying to run a command inside a lisp, that is loaded from a vlx file into autocad. But it gives me an unkown command error. If I simply run it from the command line it works, but not through a lisp. Do I need to do something extra for the command to be avaialable from a lisp? I don't have access to the source of the vlx.

  2. #2
    Senior Member
    Using
    not applicable
    Join Date
    May 2007
    Posts
    126

    Default

    Code:
    (c:your_command_here)

  3. #3
    Senior Member
    Using
    Map 3D 2007
    Join Date
    Sep 2009
    Posts
    142

    Default

    Thanks, now that I see it I remember there was something like this.

  4. #4
    Senior Member
    Using
    Map 3D 2007
    Join Date
    Sep 2009
    Posts
    142

    Default

    I don't get it, how do I pass parameters to the command this way?

  5. #5
    Super Member asos2000's Avatar
    Computer Details
    asos2000's Computer Details
    Operating System:
    WinXP
    Using
    AutoCAD 2007
    Join Date
    Sep 2007
    Location
    Cairo Egypt
    Posts
    678

    Default

    upload the lisp
    Sorry for my English.

  6. #6
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Win 7 Pro / Win 10 Pro / Linux Mint
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2018
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    19,593

    Default

    Depending on how it is written,

    Code:
    (your_command_here par1 par2 par3 ... parN)
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

  7. #7
    Senior Member
    Using
    Map 3D 2007
    Join Date
    Sep 2009
    Posts
    142

    Default

    No, I'm using a command from another file. (c:command) works, but that way I can't supply parameters.

  8. #8
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Win 7 Pro / Win 10 Pro / Linux Mint
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2018
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    19,593

    Default

    So you are stuck with this construct?

    Code:
    (defun c:test (/ str)
      (setq str (getstring "\nEnter a String: "))
      (print str)
      (princ))
    
    (defun CallTest nil
      (c:test)
      (princ))
    This causes a problem as when the 'test' function is called (red), the blue code is evaluated, and the green code is not evaluated until the blue code is completed.

    Lee
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

  9. #9
    Luminous Being alanjt's Avatar
    Using
    Civil 3D 2013
    Join Date
    Apr 2008
    Posts
    6,199

    Default

    You're not giving a lot of information. However, it sounds like the vlx prompts for selection and a few questions.

    What you could do is create your selection, then feed the selection and other required parameters to the routine through vla-sendcommand (I know I plug this command a lot).

    eg.

    ssget (no pickfirst)
    Code:
    (defun c:Test (/ ss)
      (if (setq ss (ssget "_:L"))
        (vla-sendcommand (vla-get-activedocument (vlax-get-acad-object)) "CommandName !ss Y N 0.5 ")))
    ssget (with pickfirst available)
    Code:
    (defun c:Test (/ ss)
      (and (setq ss (ssget "_:L"))
           (sssetfirst nil ss)
           (vla-sendcommand (vla-get-activedocument (vlax-get-acad-object)) "CommandName Y N 0.5 ")))
    entsel
    Code:
    (defun c:Test (/ e)
      (if (setq e (car (entsel)))
        (vla-sendcommand (vla-get-activedocument (vlax-get-acad-object))
          "CommandName !e Y N 0.5 ")))
    Oh yeah, and if in a situation where a space " " will not force the command to continue (ie: (getstring T "\nEnter String: ") ), you can replace the " " with "\n", which will act the same as if the user pressed the Enter key.
    DropBox
    Seann: ...it went crazy ex-girlfriend on me...
    eric_monceaux...its pretty funny seeing two AutoCAD Gods give each other flak...

  10. #10
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Win 7 Pro / Win 10 Pro / Linux Mint
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2018
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    19,593

    Default

    Registered forum members do not see this ad.

    Nice idea Alan I hadn't thought of using that
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

Similar Threads

  1. Best LISP Commands for Architecture
    By CADMASTER1128 in forum AutoLISP, Visual LISP & DCL
    Replies: 16
    Last Post: 22nd Aug 2009, 04:50 pm
  2. New to lisp commands
    By Dan5 in forum AutoLISP, Visual LISP & DCL
    Replies: 2
    Last Post: 26th May 2008, 06:47 pm
  3. Loading LISP Commands
    By samanisc in forum AutoCAD General
    Replies: 8
    Last Post: 21st Aug 2007, 02:12 pm
  4. Undo multiple commands in lisp as one
    By gman in forum AutoLISP, Visual LISP & DCL
    Replies: 2
    Last Post: 9th Jun 2006, 05:57 pm
  5. Lisp for a sequence of commands...
    By Joro-- in forum AutoLISP, Visual LISP & DCL
    Replies: 3
    Last Post: 13th Feb 2006, 08:30 pm

Bookmarks

Posting Permissions

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