vieleicht hilft Dir das weiter. Zu finden unter http://www.autodesk.com/cgi-bin/external.pl?url=http://pointa.autodesk.com/gotoPointA.jsp?dest=cc
Opening a read-only DWG with AutoLISP and ActiveX
Applies to: AutoCAD
How do I use AutoLISP to open a read-only drawing ? I've tried various
combinations of (command "OPEN" ..), but the OPEN command locks up when the
Read-Only Warning dialog displays and prompts for user input.
The solution to this depends on the document mode.
In SDI mode, setting the EXPERT system variable to 5.
In MDI mode, the easiest way to open a read-only drawing is to use the ActiveX
The following code demonstrates both approaches:
(defun OpenAReadOnlyDWG ()
(setq MDImode (getvar "SDI"))
(setq aDwgFile (findfile "Junk.Dwg"))
(if (= MDImode 0)
(progn ; Multiple Document Mode
(setq acadApplication (vlax-get-acad-object))
(setq acadDocuments (vla-Get-Documents acadApplication))
(vla-Open acadDocuments aDwgFile :vlax-True)
; in SDI mode it's not possible to use ActiveX
(setq oldexpert (getvar "EXPERT"))
(setvar "EXPERT" 5)
(command "OPEN" aDwgFile)
(if (> (getvar "CMDACTIVE") 0) (command "Y") )
(setvar "EXPERT" oldexpert)
(princ (strcat "\nDrawing File: " aDwgFile " was not found !"))
Note that when SDI = 1, in the first release of AutoCAD 2000, there's a problem
that causes AutoCAD to abort when you try to run either a VBA macro, or an
ActiveX function from Lisp that attempts to open a drawing. The capability to
use the Open Method when SDI = 1, has been disabled in a later release.
Another way to open a readonly file would be by using a script, for instance
this accomplishes the same thing as the lisp code, but in SDI mode:
Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP