.NET

Reply
Active Contributor
47 Posts
1 Kudo
Registered: ‎04-05-2006
Post 1 of 14

Zoom Extents on new Database

1476 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
105 Posts
1 Kudo
Registered: ‎12-29-2005
Post 2 of 14

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
47 Posts
1 Kudo
Registered: ‎04-05-2006
Post 3 of 14

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
67 Posts
0 Kudos
Registered: ‎09-12-2006
Post 4 of 14

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
184 Posts
5 Kudos
Registered: ‎09-22-2006
Post 5 of 14

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
716 Posts
4 Kudos
Registered: ‎01-24-2003
Post 6 of 14

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
Post 7 of 14

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
47 Posts
1 Kudo
Registered: ‎04-05-2006
Post 8 of 14

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
184 Posts
5 Kudos
Registered: ‎09-22-2006
Post 9 of 14

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
47 Posts
1 Kudo
Registered: ‎04-05-2006
Post 10 of 14

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
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are you interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!