Results 1 to 3 of 3

Thread: Open drawing in Autocad 2013 with VB.net and set as active

  1. #1
    Member
    Join Date
    2020-04
    Posts
    4
    Login to Give a bone
    0

    Default Open drawing in Autocad 2013 with VB.net and set as active

    I am working on a routine in AuoCAD 2013using VB.net:
    open a template drawing from reference folder > Save to out folder > create entities on the drawing.

    The problem I am facing is that when I open the drawing it does remain activated. I can see the template being opened. but as soon as it opens it hides behind the default drawing "Drawing1.dwg".

    Can some one guide me to solve this issue.

  2. #2
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    6,388
    Login to Give a bone
    0

    Default Re: Open drawing in Autocad 2013 with VB.net and set as active

    Hi, welcome to augi.
    It would be helpful if you psoted your code. Please wrap it in <CODE> tags. To do this, click on Go Advanced at the bottom of the reply window and then click on the <#> button.
    C:> ED WORKING....

  3. #3
    Member
    Join Date
    2009-04
    Posts
    13
    Login to Give a bone
    0

    Default Re: Open drawing in Autocad 2013 with VB.net and set as active

    You should have shown your code, so that others may spot error in the code easier. I'll do my guess here:

    if you open the drawing with Application.DocumentManager.Open([FilePathName],...), the opened drawing may or may not become active drawing in AutoCAD edior, depending on the context the code runs - Document context, or application context. In your case, if you want the newly opened drawing to become active one, the CommandMethod that runs your code should set CommandFlags.Session flag, that is:

    Code:
    [CommandMethod("OpenMyDwg", CommandFlags.Session)]
    public static void OpenDrawing()
    {
        var newDwg=Application.DocumentManager.Open(......);
    }
    Last edited by Ed Jobe; 2020-05-01 at 02:10 PM. Reason: added <CODE> tags

Similar Threads

  1. 2013: Writing and Insulation etc not showing when open drawing in Autocad MEP 2013
    By raymond.mchugh690755 in forum AMEP General
    Replies: 1
    Last Post: 2015-02-01, 01:33 AM
  2. Active Workset is changing to a different Active Workset and objects being modeled on the wrong workset.
    By Baldwin_4-6-0 in forum Revit - Worksharing/Worksets/Revit Server
    Replies: 16
    Last Post: 2012-03-09, 02:51 PM
  3. .NET and Autocad. How to load script from .net app?
    By firavolla_moise in forum Dot Net API
    Replies: 5
    Last Post: 2011-11-01, 09:11 PM
  4. Replies: 0
    Last Post: 2010-11-16, 06:48 PM
  5. Using VB.NET to Pick the Active Viewport
    By PellaCAD in forum Dot Net API
    Replies: 0
    Last Post: 2008-05-14, 08:07 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
  •