+ Reply to Thread
Page 2 of 3 FirstFirst 1 2 3 LastLast
Results 11 to 20 of 29
  1. #11
    Super Member rlx's Avatar
    Computer Details
    rlx's Computer Details
    Operating System:
    W10
    Computer:
    i74ghz/ssd500/2tbhdd
    Discipline
    Electrical
    rlx's Discipline Details
    Occupation
    electrical designer dragon
    Discipline
    Electrical
    Details
    I dont excel in anything but I rearly give up
    Using
    AutoCAD 2016
    Join Date
    Nov 2014
    Location
    Bergen op Zoom , Netherlands
    Posts
    1,106

    Default

    Registered forum members do not see this ad.

    Quote Originally Posted by lido View Post
    (vl-cmdf "abcde") return: Unknown command "abcde". Press F1 for help. T

    (command "abcde") return: Unknown command "abcde". Press F1 for help. nil

    Finally, always vl-cmdf function return T and command function return nil.
    How could I manage an error like "Unknow command" without an error code??

    Testing the AutoCAD version may be a path... But if the client uses an other CAD platform? First test the platform (PROGRAM system variable). Then test the version (VERNUM system variable) and decide if EATTEDIT is implemented or not by reading specific CAD manuals. No, please...
    mabe app needs rewrite or better error catching

    Code:
     (setq test (vl-catch-all-apply 'command-s (list "eattedit"))) vs (setq test (vl-catch-all-apply 'command-s (list "lido-edit")))
    but if client uses other CAD platform you're even further from a solution. but doesn't (Roy's) getcname work?

  2. #12
    Forum Newbie lido's Avatar
    Computer Details
    lido's Computer Details
    Operating System:
    Windows 10 x64
    Discipline
    Multi-disciplinary
    Using
    AutoCAD 2005
    Join Date
    Jan 2017
    Posts
    9

    Default

    I tried these functions before posting on this forum!
    Under AutoCAD 2015:
    (getcname "_eattedit") return nil
    (getcname "eattedit") return nil

    (= (type 'eattedit) 'sym) return T
    (= (type 'abcde) 'sym) return T

  3. #13
    Super Member
    Computer Details
    ronjonp's Computer Details
    Operating System:
    Windows 10
    Using
    AutoCAD 2018
    Join Date
    Apr 2009
    Location
    Colorado
    Posts
    948

    Default

    Quote Originally Posted by lido View Post
    I tried these functions before posting on this forum!
    ...
    Then learn to ask a better question.

    "Describe the diagnostic steps you took to try and pin down the problem yourself before you asked the question."

  4. #14
    Forum Newbie lido's Avatar
    Computer Details
    lido's Computer Details
    Operating System:
    Windows 10 x64
    Discipline
    Multi-disciplinary
    Using
    AutoCAD 2005
    Join Date
    Jan 2017
    Posts
    9

    Default

    Catching error with vl-catch-all-apply and vl-catch-all-error-p functions are OK but don't solve the problem entirely. Because of command-s function. Using command or vl-cmdf functions, fails.
    Unfortunately, the command-s function is not implemented under older AutoCAD releases (e.g. AutoCAD 2000) or under some CAD platforms (e.g. ZWCAD).
    So, in my opinion, the only way to solve the problem is by getting that damn list of all built-in AutoCAD commands. It is possible or not?

  5. #15
    Forum Newbie lido's Avatar
    Computer Details
    lido's Computer Details
    Operating System:
    Windows 10 x64
    Discipline
    Multi-disciplinary
    Using
    AutoCAD 2005
    Join Date
    Jan 2017
    Posts
    9

    Default

    Sorry mr. ronjonp for wasting your time.
    Aggression cannot, under any circumstances, solve none problem!

  6. #16
    Super Member rlx's Avatar
    Computer Details
    rlx's Computer Details
    Operating System:
    W10
    Computer:
    i74ghz/ssd500/2tbhdd
    Discipline
    Electrical
    rlx's Discipline Details
    Occupation
    electrical designer dragon
    Discipline
    Electrical
    Details
    I dont excel in anything but I rearly give up
    Using
    AutoCAD 2016
    Join Date
    Nov 2014
    Location
    Bergen op Zoom , Netherlands
    Posts
    1,106

    Default

    Maybe a certain L(ist) M(anipulator) has some bright idea or knows of a undocumented command. But I am curious ,if and when you know eattedit is not available , what are you gonna do with this knowledge. Just display a message with sorry command not available or do you have a backup routine? I think there are more than enough people on this site able and willing to help you to rewrite your routine or just the part you need. Just 'be kind & rewind' ...

  7. #17
    Super Member
    Using
    not applicable
    Join Date
    Jun 2016
    Posts
    699

    Default

    To my knowledge there is no way to obtain a list of command names via Lisp code.

    For _eattedit and other commands that require user input something like this should work (on most CAD platforms I believe):
    Code:
    (defun CommandAvailable_P (cmd / ret)
      (setvar 'cmdecho 0)
      (command cmd)
      (setq ret
        (if (zerop (getvar 'cmdactive))
          (progn
            (princ "\r") ; Remove: 'Unable to recognize command "ABC". Please try again.' prompt.
            nil
          )
          (progn
            (command nil)
            T
          )
        )
      )
      (setvar 'cmdecho 1)
      ret
    )
    BricsCAD 18

  8. #18
    Super Member
    Using
    not applicable
    Join Date
    Jun 2016
    Posts
    699

    Default

    FYI: getcname works fine in BricsCAD:
    Code:
    (getcname "_eattedit") => "EATTEDIT"
    (getcname "_doesnotexist") => nil
    BricsCAD 18

  9. #19
    Forum Newbie lido's Avatar
    Computer Details
    lido's Computer Details
    Operating System:
    Windows 10 x64
    Discipline
    Multi-disciplinary
    Using
    AutoCAD 2005
    Join Date
    Jan 2017
    Posts
    9

    Default

    Thank you very much Roy_043.
    Using the system variable CMDACTIVE is the key!
    I never think about this approach. Brilliant.

    Thank you one more time.

  10. #20
    Super Member hanhphuc's Avatar
    Using
    AutoCAD 2007
    Join Date
    Apr 2013
    Location
    Happy Garden
    Posts
    755

    Default

    Registered forum members do not see this ad.

    Just test only..
    Code:
    ;At this level we can list out  
    (vl-registry-descendents  (strcat "HKEY_LOCAL_MACHINE\\"
    		 (vlax-product-key)
    		 "\\Applications\\")
      )
    
    
    ;but why this level doesn't work ???
    (vl-registry-descendents
      (strcat "HKEY_LOCAL_MACHINE\\"
    	  (vlax-product-key)
    	  "\\Applications\\"
    	  "AcEAttEdit"
    	  "\\Commands"
    	  ) 
      )
    another approach
    Code:
    (defun foo (app ac cmd)
      (and (setq app (findfile app))
           (vl-registry-read
    	 (strcat "HKEY_LOCAL_MACHINE\\"
    		 (vlax-product-key)
    		 "\\Applications\\"
    		 ac
    		 "\\Commands")
    		 (strcase cmd )
    		 ) 
    	 
           ) 
      )
    Code:
    _$ (foo "AcEAttEdit.arx" "AcEAttEdit" "EATTEDIT")
    T
    _$ (foo "AcTable.arx" "AcadTable" "EATTEDIT")
    nil
    _$ (foo "AcTable.arx" "AcadTable" "TINSERT")
    T
    Last edited by hanhphuc; 12th Apr 2018 at 08:50 pm. Reason: added ac
    _$ ( apply 'equal "hp" "happy" "hạnh phúc" "ハッピー" "幸福" "행복" )
    ; error: too many arguments

Similar Threads

  1. How to Getvar from List Command Autolisp..?
    By GopinadhGvs in forum AutoCAD 2D Drafting, Object Properties & Interface
    Replies: 4
    Last Post: 10th Apr 2015, 02:40 pm
  2. How to utilize built-in Rotate command with SelectionSet?
    By Alex_AMF in forum .NET, ObjectARX & VBA
    Replies: 7
    Last Post: 3rd Dec 2014, 04:08 pm
  3. Is it possible to add a button/icon for an AutoLISP command to AutoCAD?
    By jjatho in forum AutoLISP, Visual LISP & DCL
    Replies: 4
    Last Post: 3rd Jul 2013, 08:02 am
  4. Tutorial: Create a custom command for AutoCAD using AutoLISP
    By AutoCAD Tips Blog in forum AutoCAD RSS Feeds
    Replies: 0
    Last Post: 16th Jul 2012, 08:50 pm

Tags for this Thread

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