[DCL] Button to open a dwg fil
So I designed a Button in DCL and it displays fine. However, I am trying to program it in Autolisp that when I click on the button, it will open a file in my computer. My code is:SVNHRC.dwg
(action_tile "b1"
"command "_.FILEOPEN"D:\\Typical\\SVNHRC.dwg")
I do not know what is the proper way to pull up a command from autocad. Since you have to use quotation, and we have to use another quotation for the command.
Any help guys?
Thanks anyone in advance. You can not use a command call in action_tile so you need to replace it with a function. Here is a quick example for you to play with:
;; Open File Example-Lee Mac;; www.cadtutor.net/forum/showthread.php?97521(defun c:myopen ( / dch dcl des idx lst rtn ) (defun *error* ( msg ) (if (and (= 'int (type dch)) ( Thanks Lee Mac,
I do not know if the last reply went out or not.
But this is a brilliant program.
However, for my program specifically,
I already know what file I wanted to open before I click the button,
since I already sorted the options out from former menus.
Thus, I just need to open a certain dwg file in the certain location.
I tried something like this:
(action_tile "b1"
"(OPFL)")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun OPFL ()
(command "_.FILEOPEN" "D:\\Typical\\Template")
)
Autocad froze every time when I click the button.
Sorry for the long extra question,
Thanks.
Thank you.
As per my example above, you should evaluate the expression to open your file outside of the action_tile statement for your dialog tile, and after the dialog has been dismissed.
Since DCL dialogs are modal, AutoCAD cannot take focus whilst the dialog is displayed and will therefore freeze if attempting to evaluate a command without first dismissing the dialog. I didn't write this but works great.
;;; Opens the Architectural Standard details file.(defun c:OpenMySTD ( / _OpenDwg ) (vl-load-com)(defun _OpenDwg (dwg readOnly / doc) ;; BlackBox... Inspired by RenderMan, CADTutor.net ;; Example: (_OpenDwg "FilePath\\FileName.dwg" T) ;; Return: T, if successful; otherwise nil. (and (not (vl-catch-all-error-p (setq doc (vl-catch-all-apply 'vla-open (list (vla-get-documents (vlax-get-acad-object)) dwg (if readOnly :vlax-true :vlax-false ) ) ) ) ) ) (not (vla-activate doc)) ))(_OpenDwg "F:\\name of folder\\drawing name.DWG" ;;; you need to change this line to where the file is that you want open. T) (princ))
Well said, sir!
Thank you! I have a follow up question, before you define LM:open, you wrote:
(setq rtn (start_dialog))
Does it run the dialog and give an return value?
and does it effect the function LM:open?
Thank you! It's not LM:open, but
LM:open
页:
[1]
2