<?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: get bounding box in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/get-bounding-box/m-p/5777435#M66088</link>
    <description>&lt;P&gt;Hi, -SENL1362-!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for answer and code.&lt;/P&gt;&lt;P&gt;Unfortunately I did not understand anything in it))) I'm still at a very early stage of education.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I understand this code (from AutoCAD ActiveX and VBA Reference):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Sub Example_GetBoundingBox()&lt;BR /&gt;
    ' Этот пример строит в пространстве модели линию и определяет размеры области объекта
    Dim startPoint(0 To 2) As Double
    Dim endPoint(0 To 2) As Double
    Dim lineObj As AcadLine

    ' Создаем линию в пространстве модели (или определяем ее)
    startPoint(0) = 2#: startPoint(1) = 2#: startPoint(2) = 0#
    endPoint(0) = 4#: endPoint(1) = 4#: endPoint(2) = 0#
    Set lineObj = ThisDrawing.ModelSpace.AddLine(startPoint, endPoint)
    ZoomAll
    
    Dim minExt As Variant
    Dim maxExt As Variant
    
    ' Метод возвращает максимальную и минимальную точку области объекта
    lineObj.GetBoundingBox minExt, maxExt
    
    ' Печатаем минимальные и максимальные размеры области
    MsgBox "Текущие размеры объекта:" &amp;amp; vbCrLf _
         &amp;amp; "Min Extent: " &amp;amp; minExt(0) &amp;amp; "," &amp;amp; minExt(1) &amp;amp; "," &amp;amp; minExt(2) _
         &amp;amp; vbCrLf &amp;amp; "Max Extent: " &amp;amp; maxExt(0) &amp;amp; "," &amp;amp; maxExt(1) &amp;amp; "," &amp;amp; maxExt(2), vbInformation, "GetBoundingBox пример"
         
End Sub&lt;/PRE&gt;&lt;P&gt;Very easy: Create object in model space, get his bounding box and print in message box!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I do not understand the concept of AutoCAD NET API and this is sad &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Something like I've done with the help of "&lt;STRONG&gt;Using Autodesk.AutoCAD.Interop&lt;/STRONG&gt;", but I have new problem: I can't show Form with report after it. &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sad, sad and sad!&lt;/P&gt;&lt;P&gt;Where can I find a good explanation of the concept of AutoCAD NET API?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your responsiveness!&lt;/P&gt;</description>
    <pubDate>Wed, 19 Aug 2015 12:13:32 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2015-08-19T12:13:32Z</dc:date>
    <item>
      <title>get bounding box</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-bounding-box/m-p/2661052#M66084</link>
      <description>hi. how do you get the bounding box of a block in the drawing using vb.net? Can someone point me to the right direction? I'm going crazy over here. Thanks... Im using AutoCAD 2008 by the way. thanks

Edited by: a7v1n on Apr 6, 2010 12:19 AM</description>
      <pubDate>Tue, 06 Apr 2010 00:19:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-bounding-box/m-p/2661052#M66084</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-04-06T00:19:12Z</dc:date>
    </item>
    <item>
      <title>Re: get bounding box</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-bounding-box/m-p/2661053#M66085</link>
      <description>Check out BlockReference.GeometricExtents property and/or BlockReference.GeometricExtentsBestFit() method.</description>
      <pubDate>Tue, 06 Apr 2010 13:49:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-bounding-box/m-p/2661053#M66085</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2010-04-06T13:49:26Z</dc:date>
    </item>
    <item>
      <title>Re: get bounding box</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-bounding-box/m-p/5777077#M66086</link>
      <description>&lt;P&gt;Hi, Norman!&lt;/P&gt;&lt;P&gt;I ask you, please, tell in detail how to do it, because we are new and do not know all the details. To me the answer could not help. I just lose my mind yet deal with that.&lt;/P&gt;&lt;P&gt;I hope you understand me, because I am from Russia and I find it hard to explain my problem, but the issue with GetBoundingBox&amp;nbsp;me too important.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please, if you have a solution to this problem, and describe it in detail. All the people you are only grateful.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Aug 2015 05:20:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-bounding-box/m-p/5777077#M66086</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-08-19T05:20:34Z</dc:date>
    </item>
    <item>
      <title>Re: get bounding box</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-bounding-box/m-p/5777122#M66087</link>
      <description>&lt;PRE&gt;        [CommandMethod("TestGetBlkRefExtents")]
        public void TestGetBlkRefExtents()
        {
            Document doc = null;
            Database db = null;
            Editor ed = null;

            string blkName = "MyBlk";
            Point3d insPnt = new Point3d(10, 20, 0);
            double rotInRad = 30 * (Math.PI / 180);
            double scaleFct = 2;
            try
            {
                doc = AcadApp.DocumentManager.MdiActiveDocument;
                if (doc == null)
                    return;
                db = doc.Database;
                ed = doc.Editor;


                //1. Insert Block in Modelspace
                ObjectId blkRefId = ObjectId.Null;
                using (Transaction tr=db.TransactionManager.StartTransaction())
                {
                    var bt = (BlockTable)tr.GetObject(db.BlockTableId, OpenMode.ForRead);
                    var blkId = bt[blkName];
                    BlockReference blkRef=null;
                    if (bt.Has(blkName))
                    {
                        var ms = (BlockTableRecord)tr.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(db), OpenMode.ForRead);
                        blkRef = new BlockReference(insPnt, blkId);
                        blkRef.SetDatabaseDefaults(db);
                        ms.UpgradeOpen();
                        ms.AppendEntity(blkRef);
                        tr.AddNewlyCreatedDBObject(blkRef, true);

                        if (rotInRad != 0)
                            blkRef.Rotation = rotInRad;

                        if (scaleFct != 1)
                            blkRef.ScaleFactors = new Scale3d(scaleFct);
                        blkRefId = blkRef.ObjectId;
                    }
                    tr.Commit();
                }
                if(blkRefId.IsNull)
                    throw new System.Exception("Failed to insert Block: " + blkName);


                //2. Get Block Extension
                using (Transaction tr = db.TransactionManager.StartTransaction())
                {
                    var blkRef = (BlockReference)tr.GetObject(blkRefId, OpenMode.ForRead);
                    Extents3d blkRefExt=blkRef.GeometricExtents;
                    ed.WriteMessage("\n BlockReference: {0}", blkName);
                    ed.WriteMessage("\n\t Position: {0}", blkRef.Position);
                    ed.WriteMessage("\n\t Rotation: {0}", blkRef.Rotation * (180/Math.PI ));
                    ed.WriteMessage("\n\t Scale: {0},{1},{2}", blkRef.ScaleFactors.X, blkRef.ScaleFactors.Y, blkRef.ScaleFactors.Z);
                    ed.WriteMessage("\n\t Size: {0}..{1}", blkRefExt.MinPoint, blkRefExt.MaxPoint);
                    tr.Commit();
                }


            }
            catch (System.Exception ex)
            {
                if (ed != null)
                    ed.WriteMessage("\n Error: " + ex.Message);
                else
                    MessageBox.Show("Error: " + ex.Message, "TestGetBlkRefExtents", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }&lt;/PRE&gt;</description>
      <pubDate>Wed, 19 Aug 2015 06:55:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-bounding-box/m-p/5777122#M66087</guid>
      <dc:creator>SENL1362</dc:creator>
      <dc:date>2015-08-19T06:55:05Z</dc:date>
    </item>
    <item>
      <title>Re: get bounding box</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-bounding-box/m-p/5777435#M66088</link>
      <description>&lt;P&gt;Hi, -SENL1362-!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for answer and code.&lt;/P&gt;&lt;P&gt;Unfortunately I did not understand anything in it))) I'm still at a very early stage of education.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I understand this code (from AutoCAD ActiveX and VBA Reference):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Sub Example_GetBoundingBox()&lt;BR /&gt;
    ' Этот пример строит в пространстве модели линию и определяет размеры области объекта
    Dim startPoint(0 To 2) As Double
    Dim endPoint(0 To 2) As Double
    Dim lineObj As AcadLine

    ' Создаем линию в пространстве модели (или определяем ее)
    startPoint(0) = 2#: startPoint(1) = 2#: startPoint(2) = 0#
    endPoint(0) = 4#: endPoint(1) = 4#: endPoint(2) = 0#
    Set lineObj = ThisDrawing.ModelSpace.AddLine(startPoint, endPoint)
    ZoomAll
    
    Dim minExt As Variant
    Dim maxExt As Variant
    
    ' Метод возвращает максимальную и минимальную точку области объекта
    lineObj.GetBoundingBox minExt, maxExt
    
    ' Печатаем минимальные и максимальные размеры области
    MsgBox "Текущие размеры объекта:" &amp;amp; vbCrLf _
         &amp;amp; "Min Extent: " &amp;amp; minExt(0) &amp;amp; "," &amp;amp; minExt(1) &amp;amp; "," &amp;amp; minExt(2) _
         &amp;amp; vbCrLf &amp;amp; "Max Extent: " &amp;amp; maxExt(0) &amp;amp; "," &amp;amp; maxExt(1) &amp;amp; "," &amp;amp; maxExt(2), vbInformation, "GetBoundingBox пример"
         
End Sub&lt;/PRE&gt;&lt;P&gt;Very easy: Create object in model space, get his bounding box and print in message box!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I do not understand the concept of AutoCAD NET API and this is sad &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Something like I've done with the help of "&lt;STRONG&gt;Using Autodesk.AutoCAD.Interop&lt;/STRONG&gt;", but I have new problem: I can't show Form with report after it. &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sad, sad and sad!&lt;/P&gt;&lt;P&gt;Where can I find a good explanation of the concept of AutoCAD NET API?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your responsiveness!&lt;/P&gt;</description>
      <pubDate>Wed, 19 Aug 2015 12:13:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-bounding-box/m-p/5777435#M66088</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-08-19T12:13:32Z</dc:date>
    </item>
    <item>
      <title>Re: get bounding box</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-bounding-box/m-p/5777478#M66089</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;AutoCAD .NET Developers Guide, &amp;nbsp;Author: Stephen&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.google.com/document/d/1lwKk1eCci1-7sm8jqou5vLd5fLmml3hbeubnOZJHaWk/edit" target="_blank"&gt;https://docs.google.com/document/d/1lwKk1eCci1-7sm8jqou5vLd5fLmml3hbeubnOZJHaWk/edit&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Aug 2015 12:35:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-bounding-box/m-p/5777478#M66089</guid>
      <dc:creator>SENL1362</dc:creator>
      <dc:date>2015-08-19T12:35:43Z</dc:date>
    </item>
    <item>
      <title>Re: get bounding box</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-bounding-box/m-p/5777934#M66090</link>
      <description>&lt;P&gt;If you start with AutoCAD without knowing the basics of VB.NET&amp;nbsp;you'll basically be lost.&amp;nbsp; Find a good primer for that first.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Aug 2015 15:55:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-bounding-box/m-p/5777934#M66090</guid>
      <dc:creator>dgorsman</dc:creator>
      <dc:date>2015-08-19T15:55:35Z</dc:date>
    </item>
  </channel>
</rss>

