Jump to content

Recommended Posts

Posted

Hello all!

I have an AutoLISP code that goes to the client along with drawings. The code contains a sequence for attribute editing with either EATTEDIT built-in command or an AutoLISP snippet.

 

On this stage, I don't know if the EATTEDIT built-in command is implemented under the client CAD platform, so that I must check the availability of the command.

 

Is there any possibility to obtain via AutoLISP a complete list of AutoCAD internal (built-in) commands?

 

Thank you in advance.

  • Replies 28
  • Created
  • Last Reply

Top Posters In This Topic

  • lido

    9

  • rlx

    6

  • ronjonp

    5

  • hanhphuc

    4

Top Posters In This Topic

Posted

Sorry, but atoms-family function don't return the built-in command names. Please try it.

Posted
Sorry, but atoms-family function don't return the built-in command names. Please try it.

 

 

oh darn... hope other reply does better... maybe vl-cmdf can offer a quick test because it first tests if a command can be successful before it executes it else just check autocad version

Posted

I know the trick with ARX, option "C".

EATTEDIT still missing from the list (AutoCAD 2015). Please give it a try.

Posted (edited)

Not a full list .. but here's a quick check:

...

Edited by ronjonp
*removed code suggestion does not work DOH!
Posted

How about?:

(getcname "_eattedit")

Posted

(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...

Posted

Use Roy's suggestion .. or better yet get rid of command calls in your code. ;)

Posted
(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

 

 (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?

Posted

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

Posted
I tried these functions before posting on this forum!

...

Then learn to ask a better question. :lol:

 

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

Posted

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?

Posted

Sorry mr. ronjonp for wasting your time.

Aggression cannot, under any circumstances, solve none problem!

Posted

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' ...

Posted

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):

(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
)

Posted

FYI: getcname works fine in BricsCAD:

(getcname "_eattedit") => "EATTEDIT"
(getcname "_doesnotexist") => nil

Posted

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.

Posted (edited)

Just test only..

[color="green"];At this level we can list out [/color] 
([color="blue"]vl-registry-descendents[/color]  (strcat "HKEY_LOCAL_MACHINE\\"
	 (vlax-product-key)
	 "\\Applications\\")
 )


[color="green"];but why this level doesn't work ???[/color]
([color="blue"]vl-registry-descendents[/color]
 (strcat "HKEY_LOCAL_MACHINE\\"
  (vlax-product-key)
  "\\Applications\\"
  "AcEAttEdit"
  [color="red"]"\\Commands"[/color]
  ) 
 ) 
 

 

another approach

(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 )
	 ) 
 
      ) 
 )
 

 

_$ (foo "AcEAttEdit.arx" "AcEAttEdit" "EATTEDIT")
T
_$ (foo "AcTable.arx" "AcadTable" "EATTEDIT")
nil
_$ (foo "AcTable.arx" "AcadTable" "TINSERT")
T

 
Edited by hanhphuc
added ac

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...