<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to get Center Point in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/how-to-get-center-point/m-p/1744075#M80691</link>
    <description>Hi Rivilis,&lt;BR /&gt;
Consider that my problme is same as already posted:-&lt;BR /&gt;
&lt;BR /&gt;
http://discussion.autodesk.com/thread.jspa?messageID=5027577&lt;BR /&gt;
&lt;BR /&gt;
Take a look it.</description>
    <pubDate>Sat, 26 Aug 2006 11:37:09 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2006-08-26T11:37:09Z</dc:date>
    <item>
      <title>How to get Center Point</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-get-center-point/m-p/1744058#M80674</link>
      <description>Dear All,&lt;BR /&gt;
I want to zoom a object by using center point. I have got the entity and its GeomExtents. How can i get the center point by using GeomExtents (algorithm).&lt;BR /&gt;
&lt;BR /&gt;
Plz help.</description>
      <pubDate>Wed, 23 Aug 2006 12:39:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-get-center-point/m-p/1744058#M80674</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-08-23T12:39:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to get Center Point</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-get-center-point/m-p/1744059#M80675</link>
      <description>[code]&lt;BR /&gt;
            Extents3d ext = dim.GeometricExtents;&lt;BR /&gt;
            Point3d p_center = new Point3d(&lt;BR /&gt;
                 (ext.MinPoint.X + ext.MaxPoint.X) * 0.5,&lt;BR /&gt;
                 (ext.MinPoint.Y + ext.MaxPoint.Y) * 0.5,&lt;BR /&gt;
                 (ext.MinPoint.Z + ext.MaxPoint.Z) * 0.5&lt;BR /&gt;
            );&lt;BR /&gt;
[/code]</description>
      <pubDate>Wed, 23 Aug 2006 12:54:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-get-center-point/m-p/1744059#M80675</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-08-23T12:54:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to get Center Point</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-get-center-point/m-p/1744060#M80676</link>
      <description>Thanks for reply Rivilis,&lt;BR /&gt;
This code gives the exact center. But now i am facing problem for calculating the magnifier level. Acutally I am using &lt;BR /&gt;
&lt;BR /&gt;
Autodesk.Autocad.Interop.ZoomCenter(centerpoint, double magnifier); &lt;BR /&gt;
method for zooming object. But what value for magnifier should i give so that all the entities will display in constanct size(zoom level like 80%) to screen. &lt;BR /&gt;
Thanks</description>
      <pubDate>Thu, 24 Aug 2006 08:01:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-get-center-point/m-p/1744060#M80676</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-08-24T08:01:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to get Center Point</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-get-center-point/m-p/1744061#M80677</link>
      <description>I think this small VBA-example help you:&lt;BR /&gt;
[code]&lt;BR /&gt;
Sub Example_ZoomCenter()&lt;BR /&gt;
    Dim zcenter As Variant&lt;BR /&gt;
    zcenter = ThisDrawing.GetVariable("VIEWCTR")&lt;BR /&gt;
    Dim magnification As Double&lt;BR /&gt;
    magnification = ThisDrawing.GetVariable("VIEWSIZE") * 0.8&lt;BR /&gt;
    ZoomCenter zcenter, magnification&lt;BR /&gt;
End Sub&lt;BR /&gt;
[/code]</description>
      <pubDate>Thu, 24 Aug 2006 08:31:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-get-center-point/m-p/1744061#M80677</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-08-24T08:31:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to get Center Point</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-get-center-point/m-p/1744062#M80678</link>
      <description>Hi Rivilis,&lt;BR /&gt;
Actually I am using C#.net. In this i tried but could not found whats the equvalent of "ThisDrawing.GetVariable". Where can i find this GetVarible() mehod in C#.net.</description>
      <pubDate>Thu, 24 Aug 2006 08:55:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-get-center-point/m-p/1744062#M80678</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-08-24T08:55:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to get Center Point</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-get-center-point/m-p/1744063#M80679</link>
      <description>AcadDocument.GetVariable()</description>
      <pubDate>Thu, 24 Aug 2006 09:02:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-get-center-point/m-p/1744063#M80679</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-08-24T09:02:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to get Center Point</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-get-center-point/m-p/1744064#M80680</link>
      <description>Hi Rivilis,&lt;BR /&gt;
I am doing this (it gives exception). What should i do?&lt;BR /&gt;
Autodesk.AutoCAD.Interop.AcadDocument doc = (Autodesk.AutoCAD.Interop.AcadDocument)Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication;</description>
      <pubDate>Thu, 24 Aug 2006 09:14:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-get-center-point/m-p/1744064#M80680</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-08-24T09:14:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to get Center Point</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-get-center-point/m-p/1744065#M80681</link>
      <description>Sorry ,&lt;BR /&gt;
I was to hurry. Actually Exception is coming on other lines. My whole code:-&lt;BR /&gt;
&lt;BR /&gt;
Autodesk.AutoCAD.Interop.AcadDocument doc = Autodesk.AutoCAD.Interop.AcadDocument)Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.AcadDocument;&lt;BR /&gt;
Point3D  p_center =   (Point3D)doc.GetVariable("VIEWCTR");&lt;BR /&gt;
                                        zoomFactor = (double)doc.GetVariable("VIEWSIZE");&lt;BR /&gt;
 double  zoomFactor = zoomFactor * .8;&lt;BR /&gt;
&lt;BR /&gt;
 app.ZoomCenter(p_center.ToArray(), zoomFactor);&lt;BR /&gt;
The Problem is in Casting at Point3D?Help Plz</description>
      <pubDate>Thu, 24 Aug 2006 09:23:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-get-center-point/m-p/1744065#M80681</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-08-24T09:23:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to get Center Point</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-get-center-point/m-p/1744066#M80682</link>
      <description>Ok ,&lt;BR /&gt;
Now i am getting currect Center point. But zoomfactor is getting rise constantly. "VIEWSIZE" variable gives the current zoom level and every time it gives less number like 14.5643, 11.8765, 9.6544 and i am multiplying it with .8. But the zoom is not constant , it is incresing. Whats wrong?</description>
      <pubDate>Thu, 24 Aug 2006 09:33:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-get-center-point/m-p/1744066#M80682</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-08-24T09:33:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to get Center Point</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-get-center-point/m-p/1744067#M80683</link>
      <description>VIEWSIZE give height (difference between max and min Y coordinat) of visible part of current viewport, not Zoom factor.&lt;BR /&gt;
That is why if you apply ZoomCenter many times you change VIEWSIZE. &lt;BR /&gt;
Sorry, I do not understand what do you want to do.&lt;BR /&gt;
&lt;BR /&gt;
Message was edited by: Alexander Rivilis</description>
      <pubDate>Thu, 24 Aug 2006 11:03:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-get-center-point/m-p/1744067#M80683</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-08-24T11:03:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to get Center Point</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-get-center-point/m-p/1744068#M80684</link>
      <description>Hi Rivilis,&lt;BR /&gt;
Let me explain what i need:-&lt;BR /&gt;
1. I am programatically selecting entities in the drawing on cliking on "Next" button created by me on a form.&lt;BR /&gt;
2. When "Next" select an entity,  I need to zoom that entity to user in a good way.&lt;BR /&gt;
3. If i use ZoomObjects() method, the entity get zoomed to entire screen. I want every entity, may be that is small or big in size, will be zoomed at constant level at 30% of the screen size or something like that.&lt;BR /&gt;
&lt;BR /&gt;
Now have you got my point?</description>
      <pubDate>Thu, 24 Aug 2006 11:16:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-get-center-point/m-p/1744068#M80684</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-08-24T11:16:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to get Center Point</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-get-center-point/m-p/1744069#M80685</link>
      <description>Hi, aslam!&lt;BR /&gt;
&lt;BR /&gt;
=========Beginning of the citation==============&lt;BR /&gt;
using System ;&lt;BR /&gt;
using Autodesk.AutoCAD.Runtime ;&lt;BR /&gt;
using Autodesk.AutoCAD.Geometry ;&lt;BR /&gt;
using Autodesk.AutoCAD.ApplicationServices ;&lt;BR /&gt;
using Autodesk.AutoCAD.EditorInput ;&lt;BR /&gt;
using Autodesk.AutoCAD.DatabaseServices ;&lt;BR /&gt;
using Autodesk.AutoCAD.Interop ;&lt;BR /&gt;
using Autodesk.AutoCAD.Interop.Common;&lt;BR /&gt;
&lt;BR /&gt;
[assembly: CommandClass(typeof(ZoomLibrary.Zoom))]&lt;BR /&gt;
&lt;BR /&gt;
namespace ZoomLibrary&lt;BR /&gt;
{&lt;BR /&gt;
  public class Zoom&lt;BR /&gt;
  {&lt;BR /&gt;
    //&lt;BR /&gt;
    //  Function for zooming entity on screen&lt;BR /&gt;
    //&lt;BR /&gt;
    static public void ZoomObject(ObjectId id, double zoomFactor)&lt;BR /&gt;
    {&lt;BR /&gt;
      Database db = HostApplicationServices.WorkingDatabase;&lt;BR /&gt;
      AcadApplication app = (AcadApplication) Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication;&lt;BR /&gt;
      Point3d center;&lt;BR /&gt;
      double zoomHeight = 0.0;&lt;BR /&gt;
      using (Transaction tr = db.TransactionManager.StartTransaction())&lt;BR /&gt;
      {&lt;BR /&gt;
        object oMinpt = new object(), oMaxpt = new object();&lt;BR /&gt;
        double [] dMinpt = new double[3], dMaxpt = new double[3];&lt;BR /&gt;
        Entity en = (Entity) tr.GetObject(id,OpenMode.ForRead);&lt;BR /&gt;
        AcadEntity en_com = en.AcadObject as AcadEntity;&lt;BR /&gt;
        Object minPt = new Object(), maxPt = new Object();&lt;BR /&gt;
        en_com.GetBoundingBox(out oMinpt, out oMaxpt);&lt;BR /&gt;
        dMinpt = (double []) oMinpt; dMaxpt = (double []) oMaxpt;&lt;BR /&gt;
        double heightEnt = dMaxpt[1] - dMinpt[1];&lt;BR /&gt;
        double widthEnt  = dMaxpt[0] - dMinpt[0];&lt;BR /&gt;
        Object objRes = new Object(); objRes = app.ActiveDocument.GetVariable("SCREENSIZE");&lt;BR /&gt;
        Point2d screenRes = new Point2d((double []) objRes);&lt;BR /&gt;
        double aspectScreen = screenRes.Y / screenRes.X;&lt;BR /&gt;
        double aspectEnt    = heightEnt / widthEnt;&lt;BR /&gt;
        if (aspectEnt &amp;lt; aspectScreen)&lt;BR /&gt;
        {&lt;BR /&gt;
          zoomFactor *= (aspectEnt / aspectScreen);&lt;BR /&gt;
        }&lt;BR /&gt;
        center = new Point3d(&lt;BR /&gt;
          (dMinpt[0]+dMaxpt[0]) * 0.5,&lt;BR /&gt;
          (dMinpt[1]+dMaxpt[1]) * 0.5,&lt;BR /&gt;
          (dMinpt[2]+dMaxpt[2]) * 0.5&lt;BR /&gt;
          );&lt;BR /&gt;
        zoomHeight = heightEnt*100/Math.Max(zoomFactor,1e-6);&lt;BR /&gt;
      }&lt;BR /&gt;
      app.ZoomCenter(center.ToArray(),zoomHeight);&lt;BR /&gt;
    }&lt;BR /&gt;
    // Define Command "TestZoom"&lt;BR /&gt;
    [CommandMethod("TestZoom")]&lt;BR /&gt;
    static public void TestZoom()&lt;BR /&gt;
    {&lt;BR /&gt;
      Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;&lt;BR /&gt;
      PromptEntityResult rse = ed.GetEntity("\nSelect Entity: ");&lt;BR /&gt;
      if (rse.Status == PromptStatus.OK)&lt;BR /&gt;
      {&lt;BR /&gt;
        double zoomFactor = 100.0;&lt;BR /&gt;
        PromptDoubleOptions pdo = new PromptDoubleOptions("\nEnter zoom factor in percent (0...100) &amp;lt;100&amp;gt;: ");&lt;BR /&gt;
        pdo.UseDefaultValue = true; pdo.DefaultValue = zoomFactor;&lt;BR /&gt;
        pdo.AllowNegative = false; pdo.AllowZero = false; pdo.AllowNone = false;&lt;BR /&gt;
        PromptDoubleResult rsd = ed.GetDouble(pdo);&lt;BR /&gt;
        if (rsd.Status == PromptStatus.OK) zoomFactor = rsd.Value;&lt;BR /&gt;
        ZoomObject(rse.ObjectId,zoomFactor);&lt;BR /&gt;
      }&lt;BR /&gt;
    }&lt;BR /&gt;
  }&lt;BR /&gt;
}&lt;BR /&gt;
=========The end of the citation================&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Best Regards,&lt;BR /&gt;
Alexander Rivilis.</description>
      <pubDate>Thu, 24 Aug 2006 12:47:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-get-center-point/m-p/1744069#M80685</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-08-24T12:47:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to get Center Point</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-get-center-point/m-p/1744070#M80686</link>
      <description>Thanks a lot Rivilis,&lt;BR /&gt;
My zoom related problem has resolved with your great help. I think other people will also get benefited by this.  &lt;BR /&gt;
Dear Rivilis, Now in my project only one thing has left. I want to show selected entity on the screen in some good way so that it should visible differently from other entities. Currently selected entity is beign shown by Four Grip handle. But i want to use other techniques for highlighting entities like brightness, lightning or any other. I have not idea how to do this. Any hint will be useful for me. &lt;BR /&gt;
Thanks...</description>
      <pubDate>Fri, 25 Aug 2006 04:43:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-get-center-point/m-p/1744070#M80686</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-08-25T04:43:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to get Center Point</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-get-center-point/m-p/1744071#M80687</link>
      <description>Hi, aslam!&lt;BR /&gt;
See attached code.&lt;BR /&gt;
&lt;BR /&gt;
Best Regards,&lt;BR /&gt;
Alexander Rivilis.</description>
      <pubDate>Fri, 25 Aug 2006 12:03:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-get-center-point/m-p/1744071#M80687</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-08-25T12:03:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to get Center Point</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-get-center-point/m-p/1744072#M80688</link>
      <description>Hi Rivilis,&lt;BR /&gt;
Your sample is good and it is working too. But Highlight method makes the edges (DASHED) and it is not good visible to user. Edges should be BOLD and Bright , so that it strikes to Eyes.  But By using highlight , it is hardly to recognize small objects. Some Improvement?</description>
      <pubDate>Sat, 26 Aug 2006 04:59:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-get-center-point/m-p/1744072#M80688</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-08-26T04:59:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to get Center Point</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-get-center-point/m-p/1744073#M80689</link>
      <description>Ok! See attachment. You have to  modify it for your's needs. It is only skeleton.</description>
      <pubDate>Sat, 26 Aug 2006 10:20:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-get-center-point/m-p/1744073#M80689</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-08-26T10:20:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to get Center Point</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-get-center-point/m-p/1744074#M80690</link>
      <description>Thats Final Now.&lt;BR /&gt;
Thanks Rivilis. Such persons are rarely fount on Net.&lt;BR /&gt;
If you don't mind i have some more questions which i have posted on mailing list many times but could not get the answer yet. They Are:-&lt;BR /&gt;
1. How to save Thumbnail of the Current Drawing to Disk.&lt;BR /&gt;
2. I am opening 5 files in a loop. I want to execute a single command like "UPLOAD" on each opened file one by one. It does not works. Actually I want to Open 10 Files in Autocad from a Directory and Run a command which do something (Same thing ) on each drawing and then close all files. But I thing there is a problem of ActiveWindow etc.&lt;BR /&gt;
&lt;BR /&gt;
Thanks in Advance...</description>
      <pubDate>Sat, 26 Aug 2006 10:58:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-get-center-point/m-p/1744074#M80690</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-08-26T10:58:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to get Center Point</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-get-center-point/m-p/1744075#M80691</link>
      <description>Hi Rivilis,&lt;BR /&gt;
Consider that my problme is same as already posted:-&lt;BR /&gt;
&lt;BR /&gt;
http://discussion.autodesk.com/thread.jspa?messageID=5027577&lt;BR /&gt;
&lt;BR /&gt;
Take a look it.</description>
      <pubDate>Sat, 26 Aug 2006 11:37:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-get-center-point/m-p/1744075#M80691</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-08-26T11:37:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to get Center Point</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-get-center-point/m-p/1744076#M80692</link>
      <description>Sorry aslam, but I have not enough time. &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;</description>
      <pubDate>Sat, 26 Aug 2006 13:51:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-get-center-point/m-p/1744076#M80692</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-08-26T13:51:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to get Center Point</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-get-center-point/m-p/1744077#M80693</link>
      <description>Damn... I was going to try to get you to write my code too... &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;ALEXANDER rivilis=""&gt; wrote in message news:5308607@discussion.autodesk.com...&lt;BR /&gt;
Sorry aslam, but I have not enough time. &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/ALEXANDER&gt;</description>
      <pubDate>Sat, 26 Aug 2006 14:19:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-get-center-point/m-p/1744077#M80693</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-08-26T14:19:23Z</dc:date>
    </item>
  </channel>
</rss>

