AutoCAD Map 3D Developer

Posts: 3
Registered: ‎01-19-2010
Message 1 of 1 (156 Views)

How to center the feature?

156 Views, 0 Replies
04-28-2011 06:43 AM



How I can find the center point of some feature in coordinate system context?

I need to highlight and center some feature.

For this I use the code:

using (Transaction t = _db.TransactionManager.StartTransaction())
    Entity ent = t.GetObject(obj, OpenMode.ForRead) as Entity; //obj - is ObjectId
    if (highlight)
        using (ViewTableRecord acView = _doc.Editor.GetCurrentView())
            double x = (ent.GeometricExtents.MaxPoint.X + ent.GeometricExtents.MinPoint.X) / 2;
            double y = (ent.GeometricExtents.MaxPoint.Y + ent.GeometricExtents.MinPoint.Y) / 2;
            acView.CenterPoint = new Autodesk.AutoCAD.Geometry.Point2d(x, y);

But it throws me in a completely different place. What am I doing wrong?

I use AutoCAD Map3d 2010.

Thanks in advance.

You are not logged in.

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

Welcome to the new Autodesk Community!
If this is your first visit, click here to get started and make the most of the Community. Let us know what you think of the new experience in the Community Feedback Forum.

Need installation help?

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

Ask the Community