+ Reply to Thread
Results 1 to 6 of 6
  1. #1
    Senior Member Enigma's Avatar
    Computer Details
    Enigma's Computer Details
    Operating System:
    Home PC: Windows 7, and yes it was my idea.
    Computer:
    Cyberpower Gamer Infinity 9800
    Motherboard:
    MSI G31
    CPU:
    Intel Core 2 Quad Q9550(2.83GHz)
    RAM:
    4GB (2x2GB) DDR2 800
    Graphics:
    NVIDIA GeForce 9800GT 512MB
    Primary Storage:
    500GB SATA-II 3.0Gb/s 7200RPM HDD
    Monitor:
    28" Hanns-G 1080P (it's freaking gorgeous!)
    Discipline
    Mechanical
    Enigma's Discipline Details
    Occupation
    Lead mechanical designer, renewable energy
    Discipline
    Mechanical
    Details
    Material handling, conveyor design, structural detailing and design, etc. As my mechanical instructor at BCIT once said, the mechanical discipline can do it all.
    Using
    Inventor 2013
    Join Date
    May 2008
    Location
    Vancouver, BC, Canada, eh!
    Posts
    119

    Default Too many Arguments

    Registered forum members do not see this ad.

    Let me start off by stating that I am no LSP expert, not even a newbie. I was hoping to find an explanation as to why the lsp code pasted in below has ceased to function. Its original function, written close to 20 years ago by a long since departed employee, was to be able to enter the command SL (short for Select Layer), click on an entity on the screen you wanted to become the current layer, and voila! new current layer. I cannot remember when it stopped working, and for some reason I have grown used to working with the new acad command _ai_molc, which does the exact same thing. Regardless, when I go to use it now, I get the error: Command: sl SELECT ENTITY ON TARGET LAYER Select object: ; error: too many arguments Any Ideas?
    Code:
    (DEFUN C:SL (/ A2 B2 L1 L2)   (GRAPHSCR)   (PROMPT "SELECT ENTITY ON TARGET LAYER ") (TERPRI)   (SETQ A2 (ENTSEL))   (SETQ B2 (ENTGET (CAR A2)))   (SETQ L1 (ASSOC 8 B2))   (SETQ L2 (CDR L1))   (PROMPT "Setting to Layer :" L2)    (COMMAND "LAYER" "S" L2 "")

  2. #2
    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,533

    Default

    The prompt string is missing a "strcat" to concatenate the Current Layer (L2) with "Setting to Layer: ".

    Also, code is missing a bracket from the end.

    I have re-written to this:

    Code:
    (defun c:sl (/ ent)
      (if (setq ent (car (entsel "\nSelect Entity on Target Layer: ")))
        (setvar "CLAYER" (cdr (assoc 8 (entget ent))))
        (princ "\n<!> Nothing Selected <!>"))
      (princ))
    which allows for a mis-click
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

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

  3. #3
    Senior Member Enigma's Avatar
    Computer Details
    Enigma's Computer Details
    Operating System:
    Home PC: Windows 7, and yes it was my idea.
    Computer:
    Cyberpower Gamer Infinity 9800
    Motherboard:
    MSI G31
    CPU:
    Intel Core 2 Quad Q9550(2.83GHz)
    RAM:
    4GB (2x2GB) DDR2 800
    Graphics:
    NVIDIA GeForce 9800GT 512MB
    Primary Storage:
    500GB SATA-II 3.0Gb/s 7200RPM HDD
    Monitor:
    28" Hanns-G 1080P (it's freaking gorgeous!)
    Discipline
    Mechanical
    Enigma's Discipline Details
    Occupation
    Lead mechanical designer, renewable energy
    Discipline
    Mechanical
    Details
    Material handling, conveyor design, structural detailing and design, etc. As my mechanical instructor at BCIT once said, the mechanical discipline can do it all.
    Using
    Inventor 2013
    Join Date
    May 2008
    Location
    Vancouver, BC, Canada, eh!
    Posts
    119

    Default

    You guys are Gods! Thanks!

  4. #4
    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,533

    Default

    No Probs, if you have any other questions, just ask

    Lee
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

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

  5. #5
    Senior Member Enigma's Avatar
    Computer Details
    Enigma's Computer Details
    Operating System:
    Home PC: Windows 7, and yes it was my idea.
    Computer:
    Cyberpower Gamer Infinity 9800
    Motherboard:
    MSI G31
    CPU:
    Intel Core 2 Quad Q9550(2.83GHz)
    RAM:
    4GB (2x2GB) DDR2 800
    Graphics:
    NVIDIA GeForce 9800GT 512MB
    Primary Storage:
    500GB SATA-II 3.0Gb/s 7200RPM HDD
    Monitor:
    28" Hanns-G 1080P (it's freaking gorgeous!)
    Discipline
    Mechanical
    Enigma's Discipline Details
    Occupation
    Lead mechanical designer, renewable energy
    Discipline
    Mechanical
    Details
    Material handling, conveyor design, structural detailing and design, etc. As my mechanical instructor at BCIT once said, the mechanical discipline can do it all.
    Using
    Inventor 2013
    Join Date
    May 2008
    Location
    Vancouver, BC, Canada, eh!
    Posts
    119

    Default

    So aside from the obvious of someone perhaps accidentally modifying the file, why would the .lsp file change? There were a few other routines that no longer worked as well, some were missing a colon or a bracket here and there. I mentioned that this file, which was only a portion of a much larger set of routines, was written a long time, and has been re-used continuously as we have have updated to all the latest releases of Autocad.

  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,533

    Default

    Registered forum members do not see this ad.

    I would only really be people editing them accidentally - they can't change any other way really - unless someone ran a LISP file that would open another LISP file and perform a (write-line) on it.. but I can't really see that happening.

    If you have others that don't work, just post them and I'll be more than happy to sort em out for ya

    Lee
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

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

Similar Threads

  1. List of arguments for 'render' dialog box
    By sylvan in forum AutoLISP, Visual LISP & DCL
    Replies: 1
    Last Post: 30th Dec 2005, 12:16 am
  2. arguments against drawing a detail on the layout?
    By ALEX3020 in forum AutoCAD Beginners' Area
    Replies: 4
    Last Post: 3rd Oct 2005, 04:10 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