• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    .NET

    Reply
    Active Contributor
    Posts: 47
    Registered: ‎04-05-2006

    Zoom Extents on new Database

    932 Views, 13 Replies
    09-17-2007 06:23 PM
    I have created a new database:
    Database newDb = new Database(true, true)
    Inserted a block into modelspace
    and now I want to zoom extent before saving.

    Can this be done working on a new database in memory?
    all the examples I have seen on this board use Interop on a open document.

    Does anyone have a point in the right direction
    Please use plain text.
    Distinguished Contributor
    Posts: 103
    Registered: ‎12-29-2005

    Re: Zoom Extents on new Database

    09-18-2007 09:49 AM in reply to: Techno Destructo
    Others have posted lots of good working methodologies ... search on zoomextents

    Maybe these lines will give you a start ....

    AcadApplication app = (AcadApplication)Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication;
    db.TileMode = false;//*PAPER_SPACE
    db.TileMode = true;//*MODEL_SPACE
    app.ZoomExtents();
    ------------------
    LayoutManager layoutMgr = LayoutManager.Current;
    layoutMgr.CurrentLayout = "Model";
    AcadApplication pApp = (Autodesk.AutoCAD.Interop.AcadApplication)Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication;
    pApp.ZoomExtents();
    db.UpdateExt(true);
    Please use plain text.
    Active Contributor
    Posts: 47
    Registered: ‎04-05-2006

    Re: Zoom Extents on new Database

    09-19-2007 02:21 AM in reply to: Techno Destructo
    Thanks for the reply

    It seems Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication
    ONLY apply to the document currently displayed in autocad.

    Maybe I am missing a step but let me try to explain the problem again.
    I have a drawing (drawing1) open.
    I run my command that creates a NEW database in memory.
    I insert a block in the NEW database (in memory) and I want to
    Zoom extents and then save the database (drawing2).
    When I use the examples in this forum including yours it zoom extents alright but in drawing1, not the new database.

    I am still learning so I could be overlooking something
    Any help is appreciated.
    Please use plain text.
    Valued Contributor
    Posts: 67
    Registered: ‎09-12-2006

    Re: Zoom Extents on new Database

    09-19-2007 04:48 AM in reply to: Techno Destructo
    I'm not sure, but I don't think that ActiveX commands can be applied to the in-memory drawing.
    Again, I might be mistaken.
    Please use plain text.
    Distinguished Contributor
    Posts: 181
    Registered: ‎09-22-2006

    Re: Zoom Extents on new Database

    09-19-2007 01:28 PM in reply to: Techno Destructo
    I don't think you can zoom a *database*.
    A *document* is required.
    CAD Programming Solutions
    Please use plain text.
    Distinguished Contributor
    Posts: 701
    Registered: ‎01-24-2003

    Re: Zoom Extents on new Database

    09-19-2007 03:13 PM in reply to: Techno Destructo
    Correct, it has to be the current dwg in the editor to do display changes.
    Please use plain text.
    *Tony Tanzillo

    Re: Zoom Extents on new Database

    09-19-2007 03:54 PM in reply to: Techno Destructo
    Who told you that?

    --
    http://www.caddzone.com

    AcadXTabs: MDI Document Tabs for AutoCAD 2008
    Supporting AutoCAD 2000 through 2008
    http://www.acadxtabs.com

    wrote in message news:5726557@discussion.autodesk.com...
    Correct, it has to be the current dwg in the editor to do display changes.
    Please use plain text.
    Active Contributor
    Posts: 47
    Registered: ‎04-05-2006

    Re: Zoom Extents on new Database

    09-20-2007 12:56 AM in reply to: Techno Destructo
    Thanks everyone

    Maybe I can come at it from a different angle then.
    When I complete the operations to the database save it and then open it as a drawing in AutoCAD, the view has been set for me, not where I would like (the extents of the block inserted)

    How does one control where the initial view is located when creating a database?

    Or is that view default and the need to specify has been overlooked?
    Please use plain text.
    Distinguished Contributor
    Posts: 181
    Registered: ‎09-22-2006

    Re: Zoom Extents on new Database

    09-20-2007 11:43 AM in reply to: Techno Destructo
    Tony,
    Is there a way to "zoom" a database?
    I made my comment based on my attempts at doing just that. I browsed the object model but saw no zoom functionality associated with the databaseservices. I only found zoom used with the application object and that only effected the active document.
    Am I missing something? I know that there are plenty of undocumented or otherwise hidden pieces to the programming puzzle.

    By the way, your CommandLine.cs worked fine for zooming but again that would only work on the currently active drawing.
    CAD Programming Solutions
    Please use plain text.
    Active Contributor
    Posts: 47
    Registered: ‎04-05-2006

    Re: Zoom Extents on new Database

    09-20-2007 01:10 PM in reply to: Techno Destructo
    SO maybe zoom extents is not what I want.

    Is there a way to specify the initial view on a new database.
    The view is set by autocad when you create a new db can we change that default view I guess is the question?

    Anyone know how?
    Is it possible
    Please use plain text.