.NET

Reply
Active Contributor
Techno Destructo
Posts: 47
Registered: ‎04-05-2006
Message 1 of 14 (1,305 Views)

Zoom Extents on new Database

1305 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
Distinguished Contributor
djonio
Posts: 105
Registered: ‎12-29-2005
Message 2 of 14 (1,305 Views)

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);
Active Contributor
Techno Destructo
Posts: 47
Registered: ‎04-05-2006
Message 3 of 14 (1,305 Views)

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.
Valued Contributor
pavlos.katsonis
Posts: 67
Registered: ‎09-12-2006
Message 4 of 14 (1,305 Views)

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.
Distinguished Contributor
mohnston
Posts: 184
Registered: ‎09-22-2006
Message 5 of 14 (1,305 Views)

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
Distinguished Contributor
eljobe
Posts: 704
Registered: ‎01-24-2003
Message 6 of 14 (1,305 Views)

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.
*Tony Tanzillo
Message 7 of 14 (1,305 Views)

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.
Active Contributor
Techno Destructo
Posts: 47
Registered: ‎04-05-2006
Message 8 of 14 (1,305 Views)

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?
Distinguished Contributor
mohnston
Posts: 184
Registered: ‎09-22-2006
Message 9 of 14 (1,305 Views)

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
Active Contributor
Techno Destructo
Posts: 47
Registered: ‎04-05-2006
Message 10 of 14 (1,305 Views)

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

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community