Zoom alignment

Zoom alignment

joantopo
Mentor Mentor
614 Views
1 Reply
Message 1 of 2

Zoom alignment

joantopo
Mentor
Mentor

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.

Autocad C3D 2019 SP3, 2020 & 2021
Intel I9 9900K with frontal watercooler alphacool eisbaer 360 (original fans mounted in pull)- 3 fans Corsair 120 ML PRO in push.
MOBO Gygabyte Z390 Aorus Master- Corsair RGB Vengeance 64GB RAM (4x16) CL16
Nvidia Quadro RTX 4000
Samsung 970 EVO PLUS 1TB (unit C). Samsung 970 PRO 512GB (for data)
Power Supply: Corsair TX850M PLUS


Descubre mi programa VisorNET para Civil 3D:
https://apps.autodesk.com/CIV3D/es/Detail/Index?id=appstore.exchange.autodesk.com%3avisornet_windows32and64%3aes
0 Likes
Accepted solutions (1)
615 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable
Accepted solution

Yes, the code snippet in the AutoCAD DevBlog should work fine for Civil 3D entity as well.

 

Thanks,

Partha

0 Likes