Author Topic: _undefine a command in localized version  (Read 2677 times)

0 Members and 1 Guest are viewing this topic.

Peter2

  • Swamp Rat
  • Posts: 653
_undefine a command in localized version
« on: January 18, 2015, 03:39:45 PM »
I try to undefine the "qsave" in a German AutoCAD. It seem to work reasonably, but I'm not absolutely sure what defines what and why.

Prolog:
Quote
"qsave"            creates an error "unknown command" (that's clear in a localized version)
"_qsave"          works fine
"ksich"             is the German word for qsave, but in the CUI it is only a command-name(!) which invokes the command "^c^c_qsave;"

The following code works, but look at the comments for my questions:
Code: [Select]
(defun C:qsave ( )   ; why not "c:_qsave" or "c:ksich"?
    (princ "\nbla bla\n")
    (command "_.qsave")
    (c:mylisp1)
    (c:mylisp2)
    (princ)
)

(command "_undefine" "qsave"); why not "c:_qsave" or "c:ksich"?

But - a problematic side effect is that now the "German standard command KSICH" (written in all tutorials and help files and used very often ....) turns into "unknown command"   :-o :-o

Is there an instruction / definition / information how to handle this issue?

Have a fine week..

EDIT: Addendum
If I use '(command "_qsave") while the drawing is completely new, then I get always the command-line-version instead the dialogue. (filedia = 1, cmddia = 1) ...
« Last Edit: January 18, 2015, 04:05:06 PM by Peter2 »
Peter

AutoCAD Map 3D 2023 German (so some technical terms will be badly retranslated to English)
BricsCAD V23

owenwengerd

  • Bull Frog
  • Posts: 451
Re: _undefine a command in localized version
« Reply #1 on: January 18, 2015, 04:46:47 PM »
You imply two separate questions. First, you must define (c:qsave) because the AutoCAD UI ordinarily executes commands by their international name. Second, you can define c:ksich if you wish, but doing so invites improper usage, and I highly recommend against it. If you want the KSICH command to be defined, then do not undefine it in the first place.

As for (command "_qsave") behavior, this is controlled by (initdia).

Peter2

  • Swamp Rat
  • Posts: 653
Re: _undefine a command in localized version
« Reply #2 on: January 19, 2015, 04:22:22 PM »
Hi Owen

thank you for the advices.

Second, you can define c:ksich if you wish, but doing so invites improper usage, and I highly recommend against it. ...
What to you mean with "improper usage"? And what is the best alternative? "KSICH" is very often used in German scripts and lisps and manually written commands. To change it to "Unknown command" is critical ...

...If you want the KSICH command to be defined, then do not undefine it in the first place....
You mean
- at first to undefine "qsave" and
- then undefine "Ksich"?
Peter

AutoCAD Map 3D 2023 German (so some technical terms will be badly retranslated to English)
BricsCAD V23

divtiply

  • Guest
Re: _undefine a command in localized version
« Reply #3 on: January 19, 2015, 05:06:50 PM »
Have you tried getcname function?

owenwengerd

  • Bull Frog
  • Posts: 451
Re: _undefine a command in localized version
« Reply #4 on: January 19, 2015, 08:14:47 PM »
What to you mean with "improper usage"? And what is the best alternative?

I meant that using the localized name in scripts and lisp code is not a good practice, and you should not enable such unadvisable usage, but rather discourage it by allowing the malfunction.


- at first to undefine "qsave" and
- then undefine "Ksich"?

Sorry, I was not clear. Perhaps the better solution in your case is to use a different approach that does not involve undefining/redefining the _QSAVE command.

Peter2

  • Swamp Rat
  • Posts: 653
Re: _undefine a command in localized version
« Reply #5 on: January 20, 2015, 05:12:30 AM »
Have you tried getcname function?
Here is the result:
Code: [Select]
Befehl: (getcname "ksich")
"_QSAVE"
Befehl: (getcname "_qsave")
"KSICH"
Befehl: (getcname "qsave")
nil

But nevertheless I will discuss with the customer to create a solution without "_undefine".

Thanks to all.
Peter

AutoCAD Map 3D 2023 German (so some technical terms will be badly retranslated to English)
BricsCAD V23