<?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 : Is SelectionWindow went wrong or something ? Autocad .net C# in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/is-selectionwindow-went-wrong-or-something-autocad-net-c/m-p/6751256#M33485</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Perhaps a User Coordinate System issue?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SelectWindow() (as other Editor methods) works with UCS coordinates.&lt;/P&gt;
&lt;P&gt;We don't know how the GetExtents3dFromInsertPointOfBlockReferenceAn&lt;WBR /&gt;dTwoVectorsWithScale() method works, bu if it returns a WCS defined Extents3d, you have to transform it before use it with SelectWindow().&lt;/P&gt;</description>
    <pubDate>Thu, 15 Dec 2016 11:51:44 GMT</pubDate>
    <dc:creator>_gile</dc:creator>
    <dc:date>2016-12-15T11:51:44Z</dc:date>
    <item>
      <title>Is SelectionWindow went wrong or something ? Autocad .net C#</title>
      <link>https://forums.autodesk.com/t5/net-forum/is-selectionwindow-went-wrong-or-something-autocad-net-c/m-p/6751210#M33484</link>
      <description>&lt;PRE&gt;&lt;SPAN&gt;I iterate over BlockTableRecord Layout to get extents3d collection, and then get mtext and dbtext inside extents3d by function SelectWindow. &lt;BR /&gt;But I dont get text collection approximately (Ex: I have 3 extents have 3 text "a", "b", "c", but the results i get only two texts randomly.) &lt;BR /&gt;I catch error by drawing line (pt1, pt2), pt1 and pt2 are bounds of extents, then it draws correct line is diagonal line of extents. &lt;BR /&gt;But text got was still incorrect. Was this is SelectionWindow's Error? Help me, please.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;//Here the code of main class

Extents3d acTxtExt3d = acSC.GetExtents3dFromInsertPointOfBlockReferenceAndTwoVectorsWithScale(acBlkRef1, acTxtVec3dOrgArr, acScl3dOrg);  
//Get extents3d area have text

Line acLine = new Line(acTxtExt3d.MinPoint, acTxtExt3d.MaxPoint); acLine.SetDatabaseDefaults();  //Draw a line to catch error
                                                        acBlkTblRecSpc.UpgradeOpen(); 
acBlkTblRecSpc.AppendEntity(acLine); 
acTrans.AddNewlyCreatedDBObject(acLine, true);                                                    acBlkTblRecSpc.DowngradeOpen();  //Append line to CurrentSpace

// Get Mtext or Text from function of subclass (SelectWindow) 
DBObject acDbObj = acSC.GetTextInsideExtents3d(acDoc1, acTrans, acTxtExt3d); string txt = "";   // -&amp;gt; Get error here
if (acDbObj is DBText)
{                                                                    Application.ShowAlertDialog(((DBText)acDbObj).TextString);
txt = ((DBText)acDbObj).TextString;
}

if (acDbObj is MText)
{                                                     Application.ShowAlertDialog(((MText)acDbObj).Contents);
txt = ((MText)acDbObj).Contents;
}

// Here is the code of sub class to get Text or Mtext inside a SelectWindow
// Only one text in SelectWindow is valid.
public DBObject GetTextInsideExtents3d( Document acDoc,Transaction acTrans,  Extents3d acExt3d)
{
    Editor acDocEd = acDoc.Editor;
    TypedValue[] acTypValAr = new TypedValue[4];
    acTypValAr.SetValue(new TypedValue((int)DxfCode.Operator, "&amp;lt;OR"), 0);
    acTypValAr.SetValue(new TypedValue((int)DxfCode.Start, "TEXT"), 1);
    acTypValAr.SetValue(new TypedValue((int)DxfCode.Start, "MTEXT"), 2);
    acTypValAr.SetValue(new TypedValue((int)DxfCode.Operator, "OR&amp;gt;"), 3);

    SelectionFilter acSFil = new SelectionFilter(acTypValAr);
    SelectionSet acSSet;
    Point3d acPt1 = new Point3d(acExt3d.MinPoint.X , acExt3d.MinPoint.Y , 0);
    Point3d acPt2 = new Point3d(acExt3d.MaxPoint.X, acExt3d.MaxPoint.Y, 0);
    PromptSelectionResult acPSRes = acDocEd.SelectWindow(acPt1, acPt2, acSFil);
    if (acPSRes.Status == PromptStatus.OK)
    {
        acSSet = acPSRes.Value;
        if (acSSet.Count == 1)
        {
            DBObject acDbObj = null;
            foreach (ObjectId item in acSSet.GetObjectIds())
            {
                acDbObj = acTrans.GetObject(item, OpenMode.ForRead);
            }
            return acDbObj;
        }
        else return null;
    }
    else return null;
}&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Dec 2016 11:24:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/is-selectionwindow-went-wrong-or-something-autocad-net-c/m-p/6751210#M33484</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-12-15T11:24:13Z</dc:date>
    </item>
    <item>
      <title>Re : Is SelectionWindow went wrong or something ? Autocad .net C#</title>
      <link>https://forums.autodesk.com/t5/net-forum/is-selectionwindow-went-wrong-or-something-autocad-net-c/m-p/6751256#M33485</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Perhaps a User Coordinate System issue?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SelectWindow() (as other Editor methods) works with UCS coordinates.&lt;/P&gt;
&lt;P&gt;We don't know how the GetExtents3dFromInsertPointOfBlockReferenceAn&lt;WBR /&gt;dTwoVectorsWithScale() method works, bu if it returns a WCS defined Extents3d, you have to transform it before use it with SelectWindow().&lt;/P&gt;</description>
      <pubDate>Thu, 15 Dec 2016 11:51:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/is-selectionwindow-went-wrong-or-something-autocad-net-c/m-p/6751256#M33485</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2016-12-15T11:51:44Z</dc:date>
    </item>
    <item>
      <title>Re : Is SelectionWindow went wrong or something ? Autocad .net C#</title>
      <link>https://forums.autodesk.com/t5/net-forum/is-selectionwindow-went-wrong-or-something-autocad-net-c/m-p/6751282#M33486</link>
      <description>&lt;P&gt;Hi _Gile, thanks for replying my post.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I draw a Line which is the&amp;nbsp;diagonal line of extents. When I run command, all lines of extents were drawn, but some texts weren't picked.&lt;/P&gt;&lt;P&gt;So I don't think my extents collection was wrong.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Line acLine = new Line(acTxtExt3d.MinPoint, acTxtExt3d.MaxPoint); &lt;BR /&gt;acLine.SetDatabaseDefaults();  &lt;BR /&gt;//Draw a line to catch error

acBlkTblRecSpc.UpgradeOpen(); 
acBlkTblRecSpc.AppendEntity(acLine); 
acTrans.AddNewlyCreatedDBObject(acLine, true);&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Dec 2016 12:03:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/is-selectionwindow-went-wrong-or-something-autocad-net-c/m-p/6751282#M33486</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-12-15T12:03:33Z</dc:date>
    </item>
    <item>
      <title>Re : Is SelectionWindow went wrong or something ? Autocad .net C#</title>
      <link>https://forums.autodesk.com/t5/net-forum/is-selectionwindow-went-wrong-or-something-autocad-net-c/m-p/6751292#M33487</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/109424"&gt;@_gile&lt;/a&gt; wrote:&lt;BR /&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Perhaps a User Coordinate System issue?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SelectWindow() (as other Editor methods) works with UCS coordinates.&lt;/P&gt;&lt;P&gt;We don't know how the GetExtents3dFromInsertPointOfBlockReferenceAndTwoVectorsWithScale() method works, bu if it returns a WCS defined Extents3d, you have to &lt;STRONG&gt;transform it&lt;/STRONG&gt; before use it with SelectWindow().&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;What does "transform" mean? I dont get it, everything in the drawing are in 2D (Z=0). Please help me, thanks.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Dec 2016 12:09:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/is-selectionwindow-went-wrong-or-something-autocad-net-c/m-p/6751292#M33487</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-12-15T12:09:02Z</dc:date>
    </item>
    <item>
      <title>Re : Is SelectionWindow went wrong or something ? Autocad .net C#</title>
      <link>https://forums.autodesk.com/t5/net-forum/is-selectionwindow-went-wrong-or-something-autocad-net-c/m-p/6752254#M33488</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the objects are off screen at the moment of a graphic selection, they may&amp;nbsp;not be select, so may be you need to zoom to the extent of the objects before select them.&lt;/P&gt;
&lt;P&gt;And would help to know the code of&amp;nbsp;&lt;SPAN&gt;GetExtents3dFromInsertPointOfBlockReferenceAndTwoV&lt;/SPAN&gt;&lt;WBR /&gt;&lt;SPAN&gt;ectorsWithScale.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Gaston Nunez&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Dec 2016 17:32:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/is-selectionwindow-went-wrong-or-something-autocad-net-c/m-p/6752254#M33488</guid>
      <dc:creator>hgasty1001</dc:creator>
      <dc:date>2016-12-15T17:32:03Z</dc:date>
    </item>
    <item>
      <title>Re : Is SelectionWindow went wrong or something ? Autocad .net C#</title>
      <link>https://forums.autodesk.com/t5/net-forum/is-selectionwindow-went-wrong-or-something-autocad-net-c/m-p/6752897#M33489</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the current UCS can be different from WCS, you have to transform the points used to create the line which are WCS defined to UCS before using them with SelectWindow().&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The Editor.CurrentCoordinateSystem property return the current transformation matrix from UCS to WCS. Thr Matrix3d.Inverse() method returns the inverse matrix.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, using the code below insure the selection window will be the one defined by the Extents3d whatever the current UCS.&lt;/P&gt;
&lt;P&gt;But as&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/587082"&gt;@hgasty1001&lt;/a&gt;&amp;nbsp;said, the window area must be vivsible on screen, doing a zoom extents before doing the selection insure this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Matrix3d xform = acDocEd.CurrentCoordinateSystem.Inverse();
Point3d acPt1 = acExt3d.MinPoint.TransformBy(xform);
Point3d acPt2 = acExt3d.MaxPoint.TransformBy(xform);&lt;BR /&gt;dynamic acadApp = Application.AcadApplication;&lt;BR /&gt;acadApp.ZoomExtents();
PromptSelectionResult acPSRes = acDocEd.SelectWindow(acPt1, acPt2, acSFil);&lt;BR /&gt;acadApp.ZoomPrevious();&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Dec 2016 21:36:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/is-selectionwindow-went-wrong-or-something-autocad-net-c/m-p/6752897#M33489</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2016-12-15T21:36:41Z</dc:date>
    </item>
    <item>
      <title>Re : Is SelectionWindow went wrong or something ? Autocad .net C#</title>
      <link>https://forums.autodesk.com/t5/net-forum/is-selectionwindow-went-wrong-or-something-autocad-net-c/m-p/6753148#M33490</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/109424"&gt;@_gile&lt;/a&gt; wrote:&lt;BR /&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If the current UCS can be different from WCS, you have to transform the points used to create the line which are WCS defined to UCS before using them with SelectWindow().&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The Editor.CurrentCoordinateSystem property return the current transformation matrix from UCS to WCS. Thr Matrix3d.Inverse() method returns the inverse matrix.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, using the code below insure the selection window will be the one defined by the Extents3d whatever the current UCS.&lt;/P&gt;&lt;P&gt;But as&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/587082"&gt;@hgasty1001&lt;/a&gt;&amp;nbsp;said, the window area must be vivsible on screen, doing a zoom extents before doing the selection insure this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Matrix3d xform = acDocEd.CurrentCoordinateSystem.Inverse();
Point3d acPt1 = acExt3d.MinPoint.TransformBy(xform);
Point3d acPt2 = acExt3d.MaxPoint.TransformBy(xform);&lt;BR /&gt;dynamic acadApp = Application.AcadApplication;&lt;BR /&gt;acadApp.ZoomExtents();
PromptSelectionResult acPSRes = acDocEd.SelectWindow(acPt1, acPt2, acSFil);&lt;BR /&gt;acadApp.ZoomPrevious();&lt;/PRE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Thank you very much, _gile. That works for me, you make a great save :).&lt;/P&gt;</description>
      <pubDate>Fri, 16 Dec 2016 00:04:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/is-selectionwindow-went-wrong-or-something-autocad-net-c/m-p/6753148#M33490</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-12-16T00:04:53Z</dc:date>
    </item>
  </channel>
</rss>

