Community
AutoCAD Forum
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Command should be displayed in new window, not in CommandLine

10 REPLIES 10
Reply
Message 1 of 11
damian.wrobel
474 Views, 10 Replies

Command should be displayed in new window, not in CommandLine

If you type "DIMSTYLE", Enter, the new window "Dimension style manager" will be opened.

 

So, I made a lisp 

(defun C:DST () (command "_DIMSTYLE" )) 

but if I type "DST", Enter, there's no new window ! But in CommandLine are displayed prompts such as in command "-DIMSTYLE"

 

And what's funny, if I type "DIMSTYLE", Enter, the new window is displayed...

 

What's wrong?
Is there any system variable like ATTDIA which controls how is the command displayed - in CommandLine or in a new Dialog Box?

 

I have the same problem with commands HATCH, BHATCH, HATCHEDIT, LAYER and PLOT.

 

10 REPLIES 10
Message 2 of 11
pendean
in reply to: damian.wrobel

You created an lisp just to call DIMSTYLE and to do nothing else? Why don't you just edit the PGP file and add the abbreviation you want to that one command, it's much easier and built-in.
Message 3 of 11
Kent1Cooper
in reply to: damian.wrobel

In AutoLISP (command) functions, the default mode is to operate from the Command: prompt line rather than the dialog box [for commands that use them].  If you want the dialog box in such a command called from a (command) function, you must request it, that is, ask to initiate the dialog box immediately before the (command) function:

 

(initdia)

(command ....

Kent Cooper, AIA
Message 4 of 11
damian.wrobel
in reply to: Kent1Cooper

Thanks, you are great.

Message 5 of 11
damian.wrobel
in reply to: Kent1Cooper

Thank you  for your gold advice. It works for:

(DEFUN C:LA () (INITDIA) (COMMAND "_LAYER"))

(DEFUN C:H () (INITDIA) (COMMAND "_HATCH")) 

(DEFUN C:BH () (INITDIA) (COMMAND "_BHATCH")) 

(DEFUN C:HE () (INITDIA) (COMMAND "_HATCHEDIT")) 

(DEFUN C:PLO () (INITDIA) (COMMAND "_PLOT")) 

 

What is interesting: If you type a commad with minus sign at the beginning, the contextual menu (and not a dialog box) will be opened, even if you type (INITDIA) before (COMMAND "-..."), for example:  

(DEFUN C:LA1 () (INITDIA) (COMMAND "_-LAYER"))

(DEFUN C:H1 () (INITDIA) (COMMAND "_-HATCH")) 

(DEFUN C:BH1 () (INITDIA) (COMMAND "_BHATCH")) 

(DEFUN C:HE1 () (INITDIA) (COMMAND "_-HATCHEDIT")) 

(DEFUN C:PLO1 () (INITDIA) (COMMAND "_-PLOT"))

 

 

But, there is one problem.

For the command "_DIMSTYLE", your advice does not work  😞

I typed:

(defun C:DST () (INITDIA) (command "_DIMSTYLE" ))
(defun C:DSTT () (INITDIA) (command "_-DIMSTYLE" ))
(defun C:DSTTT () (INITDIA) (command "_'DIMSTYLE" ))

And all these three commands cause, that the contextual menu is opened.

 

Is there some way to open command "DIMSTYLE" in the dialog box?

Message 6 of 11
Kent1Cooper
in reply to: damian.wrobel


@damian.wrobel wrote:

...

For the command "_DIMSTYLE", your advice does not work  😞

... 

Is there some way to open command "DIMSTYLE" in the dialog box?


Yes!  There's an old, apparently no longer documented but still valid in 2015, command from way back before dialog boxes were the default mode for a lot of commands and there were assorted commands starting with D for the dialog-box version:  DDIM.  I find that:

 

(command "DDIM")

 

works, even without the preceding (initdia).

Kent Cooper, AIA
Message 7 of 11
damian.wrobel
in reply to: Kent1Cooper

Yes, it works, thank you a lot!

 

So, there is no way that the DIMSTYLE command will be opened in the dialog box and therefore we are forced to use the DDIM command in the lisp, yes?

Message 8 of 11
Kent1Cooper
in reply to: damian.wrobel


@damian.wrobel wrote:

Yes, it works, thank you a lot!

 

So, there is no way that the DIMSTYLE command will be opened in the dialog box and therefore we are forced to use the DDIM command in the lisp, yes?


I tried some other variants in addition to the ones you listed, and I couldn't find a way.  But I wouldn't claim there isn't one....

Kent Cooper, AIA
Message 9 of 11
damian.wrobel
in reply to: Kent1Cooper

Thank you very much.

Message 10 of 11
Kent1Cooper
in reply to: Kent1Cooper


@Kent1Cooper wrote:

@damian.wrobel wrote:

.... 

So, there is no way that the DIMSTYLE command will be opened in the dialog box and therefore we are forced to use the DDIM command in the lisp, yes?


I tried some other variants in addition to the ones you listed, and I couldn't find a way.  But I wouldn't claim there isn't one....


However, as pendean suggested, [I didn't try but] you should try making an alias for it [and the others] in the .pgp file, since all the commands you're defining do nothing other than call up the command, anyway.  I expect that would get you the dialog box, without using an old command name that may not continue to be honored in future versions.

Kent Cooper, AIA
Message 11 of 11
damian.wrobel
in reply to: Kent1Cooper

The problem came back 😞 After you gave me the advice to write "initdia" before command, I did it and lisp (DEFUN C:H () (INITDIA) (COMMAND "_HATCH" )) worked properly. But now I type "H", press Enter, and the command "Hatch" is displayed not in a dialog box, but in the Ribbon. Why it came in the wrong way? What should I do to make it working properly? Please, help me.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost