Community
Can I do this?
It is for entities of Autocad, but alignments are entitites of Autocad?
Public Shared Sub ZoomToEntity( _ ByVal entityId As ObjectId) Dim db As Database = Application. _ DocumentManager.MdiActiveDocument.Database ' start transaction Using trans As Transaction = db. _ TransactionManager.StartTransaction() ' get the entity' extends Dim ent As Entity = trans.GetObject( _ entityId, OpenMode.ForRead) Dim extends As Extents3d = ent.GeometricExtents ' configure the new current view ZoomToWindow(New Point2d( _ extends.MinPoint.X, _ extends.MinPoint.Y), _ New Point2d( _ extends.MaxPoint.X, _ extends.MaxPoint.Y)) trans.Commit() End Using End Sub ' the command for database extension <CommandMethod("zextends")> _ Public Shared Sub ZoomExtends() Dim db As Database = Application. _ DocumentManager.MdiActiveDocument.Database 'get the database extension's points ZoomToWindow(New Point2d( _ db.Extmin.X, db.Extmin.Y), _ New Point2d( _ db.Extmax.X, db.Extmax.Y)) End Sub
http://adndevblog.typepad.com/autocad/2012/07/implementing-zoom-commands-with-net.html
Other way could be this:
public static void ZoomObjectoSeleccionado(Autodesk.AutoCAD.DatabaseServices.ObjectId[] matriz) { Autodesk.AutoCAD.Internal.Utils.SelectObjects(matriz); Autodesk.AutoCAD.Internal.Utils.ZoomObjects(false); System.Windows.Forms.Application.UseWaitCursor = false; }
But with zoom I don´t want to select alignment.
Solved! Go to Solution.
Solved by Partha.Sarkar. Go to Solution.
Yes, the code snippet in the AutoCAD DevBlog should work fine for Civil 3D entity as well.
Thanks,
Partha