Open original dialog boxes while using LISP

Open original dialog boxes while using LISP

ole-christian.baheim
Observer Observer
3,753 Views
12 Replies
Message 1 of 13

Open original dialog boxes while using LISP

ole-christian.baheim
Observer
Observer

I'm using a LISP within our company, and I can't open dialog boxes for some commands I sometimes use.

 

Since LISP programs suppress opening dialog boxes for some reason, how can I configure AutoCAD to still open them?

 

FILEDIA:

"0. Does not display dialog boxes. You can still request a file dialog box to appear by entering a tilde (~) in response to the Command prompt.

1. Displays dialog boxes. However, if a script is active, an ordinary prompt is displayed.

Prompts are also displayed if an AutoLISP or ObjectARX™ program is active.

Note: Execution of scripts may temporarily hide the file navigation dialog boxes. "

0 Likes
3,754 Views
12 Replies
Replies (12)
Message 2 of 13

Kent1Cooper
Consultant
Consultant

Precede the (command) call with (initdia) [= INITiate the DIAlog box in the immediately-following command].

Kent Cooper, AIA
0 Likes
Message 3 of 13

ole-christian.baheim
Observer
Observer
Thank you for your replay, but I have probably formulated the question incorrectly. I thought that normal commands such as DIMSTY would stop working when a script or LISP was installed on the profile. But it is probably the case that AutoCAD prevents dialog boxes from opening when the script or LISP is used. I have all commands like CMDDIA, FILEDIA, ATTDIA = 1. I still do not get DIMSTY as a dialog box, for example.
image.png
0 Likes
Message 4 of 13

ВeekeeCZ
Consultant
Consultant

@ole-christian.baheim wrote:

Thank you for your replay, but I have probably formulated the question incorrectly. I thought that normal commands such as DIMSTY would stop working when a script or LISP was installed on the profile. But it is probably the case that AutoCAD prevents dialog boxes from opening when the script or LISP is used. I have all commands like CMDDIA, FILEDIA, ATTDIA = 1. I still do not get DIMSTY as a dialog box, for example.


image.png

In that case use (initcommandversion) as the predecessor.

For most (older) commands work (initdia)... if not, try (initcommand...)

 

(defun c:test ()
  (initcommandversion)
  (command-s "dimstyle")
  )

 

0 Likes
Message 5 of 13

ole-christian.baheim
Observer
Observer

The commands used to work normally in 2018 version of AutoCAD. Has something changed in 2021?
I cannot change the script or LISP, so I need to know the solution 100% before i present it to IT.

0 Likes
Message 6 of 13

Kent1Cooper
Consultant
Consultant

@ole-christian.baheim wrote:

 

.... I thought that normal commands such as DIMSTY would stop working when a script or LISP was installed on the profile. . I have all commands like CMDDIA, FILEDIA, ATTDIA .....

Maybe the problem is that CMDDIA, FILEDIA, ATTDIA are not commands.  They are System Variables, which you can sort of use as if they were commands.  [That has not always been the case.  Early on, you had to either use the SETVAR command and tell it at the command line which one you wanted to set, or use the AutoLisp (setvar) function.  Allowing the direct entry of them as if they were commands came later.]

 

Commands that use a dialog box "stop working" [that is, they work at the command line instead of with the dialog box] when they are called in an AutoLisp (command) function.  Only preceding that does the (initdia) function force use of the dialog box.

 

I don't have AutoCAD on this computer, but what happens if you put in (initdia) and then use one of those System Variable names in an AutoLisp (command) function?

Kent Cooper, AIA
0 Likes
Message 7 of 13

ВeekeeCZ
Consultant
Consultant

@ole-christian.baheim wrote:

The commands used to work normally in 2018 version of AutoCAD. Has something changed in 2021? 
...


Just tried (initdia) with the (command "DIMSTYLE") in 2016, it does not work either. So nothing has changed.

It's probably something else that causes your trouble.

0 Likes
Message 8 of 13

Kent1Cooper
Consultant
Consultant

For that particular one, this worked for me, going back to the command name in the days before very many commands had dialog boxes at all, and for those that did, you needed to request the dialog-box version with a different command name:

 

Command: (initdia)
Command: (command "_.ddim")

Kent Cooper, AIA
0 Likes
Message 9 of 13

Sea-Haven
Mentor
Mentor

Tested in Bricscad V20 works.

 

(defun test ( / )
(initdia)
  (command "_.ddim")
  (alert "dims changed")
)
(test)

 

0 Likes
Message 10 of 13

Automohan
Advocate
Advocate

I was trying to Purging orphaned DGN linestyle data by lisp

 

(defun test1 ( / )
(initdia)
  (command-s "purge")
  (command-s "_close")
(command "_.-purge" "_lt" "*" "_no"))

 

But Purge dialog box not closes. 

"Save Energy"
Did you find this reply helpful? If so please use the Accept as Solution
0 Likes
Message 11 of 13

Sea-Haven
Mentor
Mentor

What does type "-purge" reveal there was a box somewhere about orphaned DGN. It was not early Acad. My Bricscad has something about Orphan Data.

0 Likes
Message 12 of 13

Automohan
Advocate
Advocate

Let me explain the issue deeply !

 

(defun c:purgeonlyline ( / )
(repeat 3
  (command "_.-purge" "_lt" "*" "_no")) (princ))

 

 

Results:

Purge_Only_Line.png

It purge only one line type

 

After opening the purge dialog box !

Purge_Dialog.png 

It start Purging orphaned DGN linestyle data . . . . 

Then cancel & close the dialog box then run the lisp it works - why ?

 

Purge_Only_Line_Sucess.png

1166 line types were purged successfully. 

"Save Energy"
Did you find this reply helpful? If so please use the Accept as Solution
0 Likes
Message 13 of 13

Automohan
Advocate
Advocate

Dear Colleagues,

I am using AutoCAD 2017

I have attached a sample drawing for testing, first run the lisp to purge all the line types but it will purge only a few of them, open purge dialog box then It start Purging orphaned DGN linestyle data . . . . 

Now the lisp work . . . how this is?

I have a lots of drawings to purge all the line types by script, first i need a lisp that will do so & so as explained previously . . .

"Save Energy"
Did you find this reply helpful? If so please use the Accept as Solution
0 Likes