Page 4 of 4 FirstFirst 1234
Results 31 to 35 of 35

Thread: Open drawing read-only via command line

  1. #31
    The Silent Type RobertB's Avatar
    Join Date
    2000-01
    Location
    Seattle WA USA
    Posts
    5,859
    Login to Give a bone
    0

    Default Re: Open drawing read-only via command line

    Quote Originally Posted by jack.foster View Post
    ... I have gone to developer support and I am told that it could be done with VB but I have never programmed in VB and I should retire in another few years. Thanks for the replies, Jack.
    That's why I mentioned Publish. Visual LISP cannot continue to run in a new active document. It will only run in the context of the original document. However, as long as the newly opened document is not made active, you can use ActiveX from Visual LISP to affect that document. Most of the stuff you can do in VBA you can do in Visual LISP via ActiveX.
    R. Robert Bell
    Design Technology Manager
    Stantec
    Opinions expressed are mine alone and do not reflect the views of Stantec.

  2. #32
    100 Club
    Join Date
    2000-11
    Posts
    140
    Login to Give a bone
    0

    Default Re: Open drawing read-only via command line

    Thanks again Robert but I am not following what you are saying. I searched the VL help and I found 'VLA-ACTIVATE" but when I got to the description for it, that is written in VB which drives me crazy. If I am in VLisp I want VLisp help not VBA help. Here is what the help shows for vla-activate:

    Code:
    Sub Example_ActivateMethod()
        ' This example creates two new drawings and activates each drawing in turn.
        
        Dim NewDrawing1 As AcadDocument
        Dim Newdrawing2 As AcadDocument
        Set NewDrawing1 = ThisDrawing.Application.Documents.Add("")
        Set Newdrawing2 = ThisDrawing.Application.Documents.Add("")
        
        Dim drawing As AcadDocument
        For Each drawing In ThisDrawing.Application.Documents
            drawing.Activate
            MsgBox "Drawing " & drawing.name & " is active."
        Next drawing
    End Sub
    Unforunately the vast majority of my AutoLISP programming was from before VL came into being. I am not good with all of the VL commands and there are hundreds of them and there are no good books with samples to learn from. I recently purchased Jerry Winters book VB.NET Programming for Customizing AutoCAD. This will probably totally fry what few remaining activateable brain cells that I have left but I am going to risk it.
    Last edited by Opie; 2009-01-09 at 02:21 PM. Reason: [code] tags added

  3. #33
    Certifiable AUGI Addict
    Join Date
    2015-11
    Location
    Jo'burg SA
    Posts
    4,512
    Login to Give a bone
    0

    Default Re: Open drawing read-only via command line

    The vla-activate thing does work ... half-way. What I'd suggest is rather use a SCR file which loads your LSP then runs the code. To do this for multiple drawings use ScriptPro from AutoDesk website.

  4. #34
    100 Club
    Join Date
    2000-11
    Posts
    140
    Login to Give a bone
    0

    Default Re: Open drawing read-only via command line

    I will have to download scriptpro and see what it does. In trying to make this work I manually manipulated my script file so that it would open a drawing. After the drawing was opened I had it do a simple line command and draw a line. Even though the open drawing was at the front it drew the line on the empty drawing that has to be open in order to run scripts or whatever. If you have time, could you tell me what the advantage of scriptpro is or what I should be looking for? Thank you very much.

  5. #35
    Certifiable AUGI Addict
    Join Date
    2015-11
    Location
    Jo'burg SA
    Posts
    4,512
    Login to Give a bone
    0

    Default Re: Open drawing read-only via command line

    ScriptPro is basically an external program which opens AutoCAD with a particular DWG, then passes the lines in a SCR file to the command line through ActiveX. It's not a very involved thing - it mostly uses AutoCAD's own functionality. There's a few advantages to ScriptPro:
    • You can perform the same SCR on as many DWG's as you like. It only opens 1 DWG at a time in a single ACAD session.
    • Leave it "overnight" to run on a multitude of DWG's at the end it lists all commands performed and results from the text screen, so you can see if there were any errors.
    • You can save a "Project" containing a specific SCR & set of DWG's so you can simply open that PRJ and run it again without having to reselect all the DWG's.
    • It can run in the background and uses a separate AutoCAD session, so you can still perform other work (even in AutoCAD).
    • Each SCR file is written only for a current DWG. You don't need to program for multiple DWG's (which makes Commands & Lisp much easier).
    One nigly prob I've found is that it sometimes (not often, but it happens) doesn't load all the custom LSP / ARX / etc before starting the commands in the SCR ... so if you use these it shows an Unknown Command error. Way arround this is to include the LISP in the SCR or load it through a call to (load ...) or (arxload ...) in the SCR.

    What you may not like is that it opens a new Session of AC for each DWG then closes after the SCR has finished.

Page 4 of 4 FirstFirst 1234

Similar Threads

  1. Open Read-Only: The ability to open a worksharing enabled file in a read only mode.
    By revit.wishlist1942 in forum Revit Architecture - Wish List
    Replies: 5
    Last Post: 2012-09-05, 07:02 PM
  2. Open Drawing read-only from Explorer
    By rkmcswain in forum AutoCAD Tips & Tricks
    Replies: 17
    Last Post: 2011-03-29, 05:00 PM
  3. Variable to control Save if a drawing is open Read Only
    By autocad.wishlist1734 in forum AutoCAD Wish List
    Replies: 4
    Last Post: 2008-02-27, 07:18 PM
  4. Open XREF Drawing Read Only
    By autocad.wishlist1734 in forum AutoCAD Wish List
    Replies: 0
    Last Post: 2007-10-08, 03:50 PM
  5. Open read only turns into actual live drawing
    By Steve_Bennett in forum AutoCAD General
    Replies: 18
    Last Post: 2007-04-24, 08:34 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •