Yes, per the documentation for start_dialog:
There is a conditional statement at the end of the function definition for c:myopen which ensures LM:open is only evaluated with the selected filename if rtn=1. Here is a simplified version:
;; Open File Example-Lee Mac;; www.cadtutor.net/forum/showthread.php?97521(defun c:myopen ( / dch dcl des dfn dwg rtn ) (setq dfn "D:\\Typical\\SVNHRC.dwg") ;; File to open (defun *error* ( msg ) (if (and (= 'int (type dch)) ( Can have option to open other predefined (added) drawings within this lisp?
eg. myopen1 open A.dwg
myopen2 open B.dwg
Sure - without DCL the code can be simply:
(defun c:open1 nil (LM:open "C:\\YourDrawing1.dwg") (princ))(defun c:open2 nil (LM:open "C:\\YourDrawing2.dwg") (princ))(defun c:open3 nil (LM:open "C:\\YourDrawing3.dwg") (princ));; Open-Lee Mac;; A wrapper for the 'Open' method of the Shell Object;; target - File, folder or ShellSpecialFolderConstants enum(defun LM:open ( target / rtn shl ) (if (and (or (= 'int (type target)) (setq target (findfile target))) (setq shl (vla-getinterfaceobject (vlax-get-acad-object) "shell.application")) ) (progn (setq rtn (vl-catch-all-apply 'vlax-invoke (list shl 'open target))) (vlax-release-object shl) (if (vl-catch-all-error-p rtn) (prompt (vl-catch-all-error-message rtn)) t ) ) ))(vl-load-com) (princ) Thanks Lee Mac.
Thank you, sir. I am still trying to understand the code, but it works perfectly. Another way to look at it using a DCl with say a list box containing A B C D pick B you want to open "Drawing2" so after running the DCL you just need to set the name for the filename the (LM:OPEN TARGET / rtn shell) the value of Target is set to "Drawing2"
something like this(cond((= picked "A")(LM:open "C:\\YourDrawing1.dwg"))((= picked "B")(LM:open "C:\\YourDrawing2.dwg"))........)
(action_tile "accept" "(setq Project_Manager (get_tile \"name\")") (print Project_Manager) (setq p1 '(604 88.2)) (command "_text" p1 1 0 Project_Manager "")
In this case, why is it still not considered have the command outside of the action_tile?
Thanks Let's first correct a syntax error:
A closing parenthesis is missing here:
(action_tile "accept" "(setq Project_Manager (get_tile \"name\")")It should be:
(action_tile "accept" "(setq Project_Manager (get_tile \"name\"))")
Excellent - you're welcome.
Your expressions to perform operations in AutoCAD will need to be evaluated after the start_dialog expression.
The process is as follows:
[*]load_dialog loads the contents of a DCL file into memory; the contents may define one or more modal dialogs.
[*]new_dialog displays the modal dialog corresponding to the dialog definition of the given name, defined within the loaded DCL file.
[*]set_tile/mode_tile expressions may be used to configure the various DCL tiles.
[*]action_tile statements define a set of expressions that are to be evaluated when the user interacts with the DCL tile with the given key.
[*]done_dialog may be evaluated to dismiss the displayed dialog and will return the position of the dialog when dimissed.
[*]start_dialog allows the user to interact with the displayed dialog after processing all set_tile/mode_tile/action_tile statements to configure the behaviour of the dialog.
This function will return the integer supplied by the done_dialog function.
As such, the dialog won't be displayed and cannot be configured until the new_dialog function is evaluated, but the displayed dialog is not operational until the start_dialog function is evaluated - therefore, if your code were to evaluate the new_dialog expression without a corresponding start_dialog expression, the modal dialog would be displayed but would not be able to be dismissed (AutoCAD must in terminated in this scenario).
页:
1
[2]