TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: andrew.. on July 16, 2020, 06:52:34 PM
-
Hi all.
Hope everyone is doing well with this covid nonsense going on.
Its been a while since ive posted and did any code. im a bit rusty at it.
I am looking for code bypass the alert asking me if i want to open a read only dwg or not.
I once had the code and got it from here, but the search is not finding it.
I hoping someone has one to share.
thanks
-
This is the code I usually use for opening readonly files without the alert. I am sure there is a better way.
(defun open_dwg_read_only (ad fna) (if (findfile fna) (vla-activate (vla-open ad fna :VLAX-TRUE)) (alert (strcat fna " DWG file do not exist. Please request DWG file to be processed."))))
(open_dwg_read_only (vla-get-documents (vlax-get-acad-object)) "\\\\Server\\Folder\\Drawing.dwg")
Hope this helps.
-
1. If SDI = 0:
(a) What is the desired behaviour if the specified dwg is already open?
(b) If the dwg is successfully opened should it be made active?
2. If SDI = 1:
(a) What is the desired behaviour if the specified dwg is already open?
(b) If the current dwg has unsaved changes should they be saved or discarded?
etc.
-
thank you
-
(defun tl:Openfilereadonly ( yourfile / )
(vla-open (vla-get-documents (vlax-get-acad-object)) yourfile :vlax-true)
)
-
This is the code I usually use for opening readonly files without the alert. I am sure there is a better way.
(defun open_dwg_read_only (ad fna) (if (findfile fna) (vla-activate (vla-open ad fna :VLAX-TRUE)) (alert (strcat fna " DWG file do not exist. Please request DWG file to be processed."))))
(open_dwg_read_only (vla-get-documents (vlax-get-acad-object)) "\\\\Server\\Folder\\Drawing.dwg")
Hope this helps.
I think this solution is better.