<?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: Selecting text at insertion point of other text in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/selecting-text-at-insertion-point-of-other-text/m-p/3721162#M52180</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm not sure what are you trying to find, but this crude code may help:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;private SelectionSet  GetTxtByPosition(Point3d p1, Point3d p2, Point3d txtInsPoint, editor ed)
{
	PromptSelectionResult ws = default(PromptSelectionResult);
	TypedValue[] acTypValAr = new TypedValue[4];
                SelectionSet wss;

	acTypValAr.SetValue(new TypedValue(DxfCode.Start, "TEXT"), 0);
	acTypValAr.SetValue(new TypedValue(DxfCode.XCoordinate, txtInsPoint.X), 1);
	acTypValAr.SetValue(new TypedValue(DxfCode.YCoordinate, txtInsPoint.Y), 2);
	acTypValAr.SetValue(new TypedValue(DxfCode.ZCoordinate, txtInsPoint.Z), 3);

	SelectionFilter acSelFtr = new SelectionFilter(acTypValAr);
	ws = ed.SelectCrossingWindow(p1, p2, acSelFtr);
	if (ws.Status == PromptStatus.OK) {
		wss=ws.Value;
	}
      return wss;
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;It takes 3 points 2 for the crossing window and one for the insertion point of the text , it should return a selection set with the text inserted at that point if any, a null ss if there is no text with that conditions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Gaston Nunez&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 04 Dec 2012 02:35:40 GMT</pubDate>
    <dc:creator>hgasty1001</dc:creator>
    <dc:date>2012-12-04T02:35:40Z</dc:date>
    <item>
      <title>Selecting text at insertion point of other text</title>
      <link>https://forums.autodesk.com/t5/net-forum/selecting-text-at-insertion-point-of-other-text/m-p/3720908#M52179</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to create a little application (Not the firt one in .NET but&amp;nbsp;&lt;SPAN&gt;my first one for Autocad in C# .NET).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;What do I need to do ?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;User select texts on screen. =&amp;gt; Making a SelectionSet of those selected texts. DONE&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Foreach select text is on screen another text (on another layer) with the same coordinates.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Here is my trouble.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Foreach text in the first SelectionSet, I try to create a second SelectionSet (filtered to select text only, named acPSResPCode) but that SelectionSet stay always null.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If I make the SelectionSet without filter I select every lines in the crossingwindows, but no text are selected.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;How do I need to do ?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Here's my code (PS : Code for AcadMp 2010)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;[CommandMethod("SelectionPP")]
        public void SelectionPP()
        {
            //Récupère le document courant, sa base de données, et demarre une transaction
            Document acDoc = Application.DocumentManager.MdiActiveDocument;
            Database acCurDb = acDoc.Database;

            //Récupération de l'éditeur de la base de données courante
            Editor ed = acDoc.Editor;

            //Démarre une nouvelle transaction
            using (Transaction acTrans = acCurDb.TransactionManager.StartTransaction())
            {
                //Création d'un filtre pour récupérer uniquement les textes
                TypedValue[] acFilList = new TypedValue[1] { new TypedValue((int)DxfCode.Start, "TEXT") };
                SelectionFilter acFilter = new SelectionFilter(acFilList);
                PromptSelectionOptions acPSOpts = new PromptSelectionOptions();
                acPSOpts.MessageForAdding = "Cliquez les PP";
                PromptSelectionResult acPSResPP = ed.GetSelection(acPSOpts, acFilter);

                //Si la sélection a réussi
                if (acPSResPP.Status == PromptStatus.OK)
                {
                    SelectionSet acSSetPP = acPSResPP.Value;
                    ObjectId[] acIdsPP = acSSetPP.GetObjectIds();
                    for (int i = 0; i &amp;lt; acIdsPP.Length; i++)
                    {
                        //Récupération de l'objet texte saisi
                        DBText acTextPP = (DBText)acTrans.GetObject(acIdsPP[i], OpenMode.ForRead);
                        //Récupération des coordonnées du Texte saisi
                        Point3d acPoint3DPP = acTextPP.Position;
                        StringBuilder sb = new StringBuilder();
                        //Création d'un point inférieur gauche
                        Point3d acPt1 = new Point3d(acPoint3DPP.X - 0.0001, acPoint3DPP.Y - 0.0001, 0.0);
                        //Création d'un point supérieur droit
                        Point3d acPt2 = new Point3d(acPoint3DPP.X + 0.0001, acPoint3DPP.Y + 0.0001, 0.0);
                        //Sélection de tous les textes dans le rectangle formé par les 2 points
                        PromptSelectionResult acPSResPCode = ed.SelectCrossingWindow(acPt1, acPt2, acFilter);
                         //Si la sélection a réussi
                        if (acPSResPCode.Status == PromptStatus.OK)
                        {
                            SelectionSet acSSetPCodes = acPSResPCode.Value;
                            ObjectId[] acIdsPCodes = acSSetPCodes.GetObjectIds();
                            sb = new StringBuilder();
                            sb.AppendFormat("{0} éléments sélectionnés", acSSetPCodes.Count);
                            Application.ShowAlertDialog(sb.ToString());
                            for (int j = 0; j &amp;lt; acIdsPCodes.Length; j++)
                            {
                                DBText acTextPCode = null;
                                acTextPCode = (DBText)acTrans.GetObject(acIdsPCodes[i], OpenMode.ForRead);
                                sb = new StringBuilder();
                                sb.AppendFormat("{3}{2}Id : {0}{2}Id sélectionné : {1}", acTextPP.ObjectId, acTextPCode.ObjectId, Environment.NewLine,i);
                                Application.ShowAlertDialog(sb.ToString());
                                if (acTextPCode.ObjectId != acTextPP.ObjectId)
                                {
                                    int intPCode = 0;
                                    if (int.TryParse(acTextPCode.TextString, out intPCode))
                                    {
                                        PP newPP = new PP(acTextPP.TextString, intPCode, acPoint3DPP.X, acPoint3DPP.Y, acPoint3DPP.Z);
                                        sb = new StringBuilder();
                                        sb.AppendFormat("PP : {0}   PCode : {1}{5}Coord : {2},{3},{4}{5}", newPP.NoPP, newPP.PCode, newPP.X, newPP.Y, newPP.Z, Environment.NewLine);
                                        Application.ShowAlertDialog(sb.ToString());
                                    }
                                }
                            }
                        }
                        else
                        {
                            sb.AppendFormat("Aucun texte trouvé pour le point {0}{2}PromptStatus = {1}", acTextPP.TextString, acPSResPCode.Status, Environment.NewLine);
                            Application.ShowAlertDialog(sb.ToString());
                        }

                    }
                }
            }
        }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Thanks for your advices,&lt;/P&gt;&lt;P&gt;Jean-Marc&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Dec 2012 21:49:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/selecting-text-at-insertion-point-of-other-text/m-p/3720908#M52179</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-12-03T21:49:34Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting text at insertion point of other text</title>
      <link>https://forums.autodesk.com/t5/net-forum/selecting-text-at-insertion-point-of-other-text/m-p/3721162#M52180</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm not sure what are you trying to find, but this crude code may help:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;private SelectionSet  GetTxtByPosition(Point3d p1, Point3d p2, Point3d txtInsPoint, editor ed)
{
	PromptSelectionResult ws = default(PromptSelectionResult);
	TypedValue[] acTypValAr = new TypedValue[4];
                SelectionSet wss;

	acTypValAr.SetValue(new TypedValue(DxfCode.Start, "TEXT"), 0);
	acTypValAr.SetValue(new TypedValue(DxfCode.XCoordinate, txtInsPoint.X), 1);
	acTypValAr.SetValue(new TypedValue(DxfCode.YCoordinate, txtInsPoint.Y), 2);
	acTypValAr.SetValue(new TypedValue(DxfCode.ZCoordinate, txtInsPoint.Z), 3);

	SelectionFilter acSelFtr = new SelectionFilter(acTypValAr);
	ws = ed.SelectCrossingWindow(p1, p2, acSelFtr);
	if (ws.Status == PromptStatus.OK) {
		wss=ws.Value;
	}
      return wss;
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;It takes 3 points 2 for the crossing window and one for the insertion point of the text , it should return a selection set with the text inserted at that point if any, a null ss if there is no text with that conditions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Gaston Nunez&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Dec 2012 02:35:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/selecting-text-at-insertion-point-of-other-text/m-p/3721162#M52180</guid>
      <dc:creator>hgasty1001</dc:creator>
      <dc:date>2012-12-04T02:35:40Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting text at insertion point of other text</title>
      <link>https://forums.autodesk.com/t5/net-forum/selecting-text-at-insertion-point-of-other-text/m-p/3721842#M52181</link>
      <description>&lt;P&gt;Thanks for your answer&amp;nbsp;&lt;SPAN&gt;&lt;A target="_self" href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/587082"&gt;gasty1001&lt;/A&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What do I try to do ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I made an sample image. You see 2 text and a block (the cross is a block). Horizontaly is the PP number ans with a 30 degree angle is the PCode.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG align="center" src="https://forums.autodesk.com/t5/image/serverpage/image-id/44160i3A1E717DC7C7085E/image-size/original?v=mpbl-1&amp;amp;px=-1" title="PP.jpg" alt="PP.jpg" border="0" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A user select PPs in a SelectionSet (that part works)&lt;/P&gt;&lt;P&gt;For each PP (single line text), I extraxt its insertion point as Point3d.&lt;/P&gt;&lt;P&gt;I need now find all texts a that position.&lt;/P&gt;&lt;P&gt;I already tried to create a filter to select only text at that position by the same way as you.&lt;/P&gt;&lt;P&gt;But I used&amp;nbsp;ed.SelectAll(FILTER);&lt;BR /&gt;&lt;BR /&gt;With my code and with yours, I receive that error :&lt;/P&gt;&lt;DIV&gt;System.NullReferenceException: Object reference not set to an instance of an object.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp;at Autodesk.AutoCAD.DatabaseServices.ResultBuffer.TypedValueToResbuf(TypedValue value)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp;at Autodesk.AutoCAD.DatabaseServices.ResultBuffer.TypedValuesToResbuf(TypedValue[] values)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp;at Autodesk.AutoCAD.DatabaseServices.ResultBuffer..ctor(TypedValue[] values)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp;at Autodesk.AutoCAD.EditorInput.FilterExtractor.{ctor}(FilterExtractor* , SelectionFilter filter)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp;at Autodesk.AutoCAD.EditorInput.Editor.SelectCrossingWindow(Point3d pt1, Point3d pt2, SelectionFilter filter, Boolean forceSubEntitySelection)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp;at Autodesk.AutoCAD.EditorInput.Editor.SelectCrossingWindow(Point3d pt1, Point3d pt2, SelectionFilter filter)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp;at Acad2010SaisiePP.Class1.GetTxtByPosition(Point3d p1, Point3d p2, Point3d txtInsPoint, Editor ed) in D:\Visual Studio 2010\Projects\Acad2010SaisiePP\Acad2010SaisiePP\Class1.cs:line 207&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp;at Acad2010SaisiePP.Class1.SelectionPP() in D:\Visual Studio 2010\Projects\Acad2010SaisiePP\Acad2010SaisiePP\Class1.cs:line 140&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp;at Autodesk.AutoCAD.Runtime.CommandClass.InvokeWorker(MethodInfo mi, Object commandObject, Boolean bLispFunction)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp;at Autodesk.AutoCAD.Runtime.CommandClass.InvokeWorkerWithExceptionFilter(MethodInfo mi, Object commandObject, Boolean bLispFunction)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp;at Autodesk.AutoCAD.Runtime.PerDocumentCommandClass.Invoke(MethodInfo mi, Boolean bLispFunction)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp;at Autodesk.AutoCAD.Runtime.CommandClass.CommandThunk.Invoke()&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;That error provide from setting coordinates in the filter.&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;If I use filter with only selecting TEXT I have no error. Of course if I use&amp;nbsp;&lt;SPAN&gt;ed.SelectAll(FILTER); It select every text in the drawing. But if I use&amp;nbsp;ed.SelectCrossingWindow(p1, p2, FILTER); selectionSet stay null.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I really don't undersant why.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Tue, 04 Dec 2012 14:50:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/selecting-text-at-insertion-point-of-other-text/m-p/3721842#M52181</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-12-04T14:50:24Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting text at insertion point of other text</title>
      <link>https://forums.autodesk.com/t5/net-forum/selecting-text-at-insertion-point-of-other-text/m-p/3721890#M52182</link>
      <description>&lt;P&gt;I forgot to specify line 207 is&amp;nbsp;ws = ed.SelectCrossingWindow(p1, p2, acSelFtr);&lt;/P&gt;&lt;P&gt;and line 140 is&amp;nbsp;SelectionSet acSSetPCodes = GetTxtByPosition(acPt1, acPt2, acPoint3DPP, ed);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;in that code&lt;/P&gt;&lt;PRE&gt;using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;

using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.Geometry;

[assembly: CommandClass(typeof(Acad2010SaisiePP.Class1))]

namespace Acad2010SaisiePP
{
    public class Class1
    {
        [CommandMethod("AdskGreeting")]
        public void AdskGreeting()
        {
            //Récupère le document courant, sa base de données, et demarre une transaction
            Document acDoc = Application.DocumentManager.MdiActiveDocument;
            Database acCurDb = acDoc.Database;

            //Démarre une nouvelle transaction
            using (Transaction acTrans = acCurDb.TransactionManager.StartTransaction())
            {
                //Ouvre le Block table record pour lecture
                BlockTable acBlkTbl;
                acBlkTbl = acTrans.GetObject(acCurDb.BlockTableId, OpenMode.ForRead) as BlockTable;

                //Ouvre le Model pour écriture
                BlockTableRecord acBlkTblRec;
                acBlkTblRec = acTrans.GetObject(acBlkTbl[BlockTableRecord.ModelSpace],OpenMode.ForWrite) as BlockTableRecord;

                //Crée un nouvel objet MText et assigne sa position, sa valeur et son textStyle
                MText objText = new MText();

                //Crée les propriété par défaut de l'objet MText
                objText.SetDatabaseDefaults();
                objText.Contents = "Hello World";
                objText.Location = new Autodesk.AutoCAD.Geometry.Point3d(2,2,0);
                objText.TextStyleId = acCurDb.Textstyle;
                
                //Ajoute l'objet au Model space
                acBlkTblRec.AppendEntity(objText);

                //Ajoute l'objet à la transaction active
                acTrans.AddNewlyCreatedDBObject(objText, true);

                //Sauvegarde les changementes et ferme la transaction
                acTrans.Commit();

            }
        }

        [CommandMethod("SelectionPP")]
        public void SelectionPP()
        {
            //Récupère le document courant, sa base de données, et demarre une transaction
            Document acDoc = Application.DocumentManager.MdiActiveDocument;
            Database acCurDb = acDoc.Database;

            //Récupération de l'éditeur de la base de données courante
            Editor ed = acDoc.Editor;

            //Démarre une nouvelle transaction
            using (Transaction acTrans = acCurDb.TransactionManager.StartTransaction())
            {
                //Création d'un filtre pour récupérer uniquement les textes
                TypedValue[] acFilList = new TypedValue[1] { new TypedValue((int)DxfCode.Start, "TEXT") };
                SelectionFilter acFilter = new SelectionFilter(acFilList);
                PromptSelectionOptions acPSOpts = new PromptSelectionOptions();
                acPSOpts.MessageForAdding = "Cliquez les PP";
                //Sélection des textes
                PromptSelectionResult acPSResPP = ed.GetSelection(acPSOpts, acFilter);

                //Si la sélection a réussi
                if (acPSResPP.Status == PromptStatus.OK)
                {
                    SelectionSet acSSetPP = acPSResPP.Value;
                    ObjectId[] acIdsPP = acSSetPP.GetObjectIds();
                    for (int i = 0; i &amp;lt; acIdsPP.Length; i++)
                    {
                        //Récupération de l'objet texte saisi
                        DBText acTextPP = (DBText)acTrans.GetObject(acIdsPP[i], OpenMode.ForRead);
                        //Récupération des coordonnées du Texte saisi
                        Point3d acPoint3DPP = acTextPP.Position;
                        StringBuilder sb = new StringBuilder();
                        //Création d'un point inférieur gauche
                        Point3d acPt1 = new Point3d(acPoint3DPP.X - 0.0001, acPoint3DPP.Y - 0.0001, 0.0);
                        //Création d'un point supérieur droit
                        Point3d acPt2 = new Point3d(acPoint3DPP.X + 0.0001, acPoint3DPP.Y + 0.0001, 0.0);
                        //Sélection de tous les textes dans le rectangle formé par les 2 points
/*                        //Sélection du PCode
                        //Création d'un filtre pour récupérer les textes à une coord 2d
                        TypedValue[] acFilPCodeList = new TypedValue[4];
                        acFilPCodeList.SetValue(new TypedValue((int)DxfCode.Start, "TEXT"), 0);
                        acFilPCodeList.SetValue(new TypedValue((int)DxfCode.XCoordinate, acPoint3DPP.X), 1);
                        acFilPCodeList.SetValue(new TypedValue((int)DxfCode.YCoordinate, acPoint3DPP.Y), 2);
                        acFilPCodeList.SetValue(new TypedValue((int)DxfCode.ZCoordinate, acPoint3DPP.Z), 3);

                        SelectionFilter acPCodeFilter = new SelectionFilter(acFilPCodeList);
                        PromptSelectionResult acPSResPCode = ed.SelectCrossingWindow(acPt1, acPt2, acPCodeFilter);
                        //Si la sélection a réussi
                        if (acPSResPCode.Status == PromptStatus.OK)
                        {
                            SelectionSet acSSetPCodes = acPSResPCode.Value;
                            ObjectId[] acIdsPCodes = acSSetPCodes.GetObjectIds();
                            sb = new StringBuilder();
                            sb.AppendFormat("{0} éléments sélectionnés", acSSetPCodes.Count);
                            Application.ShowAlertDialog(sb.ToString());
                            for (int j = 0; j &amp;lt; acIdsPCodes.Length; j++)
                            {
                                DBText acTextPCode = null;
                                acTextPCode = (DBText)acTrans.GetObject(acIdsPCodes[i], OpenMode.ForRead);
                                sb = new StringBuilder();
                                sb.AppendFormat("{3}{2}Id : {0}{2}Id sélectionné : {1}", acTextPP.ObjectId, acTextPCode.ObjectId, Environment.NewLine, i);
                                Application.ShowAlertDialog(sb.ToString());
                                if (acTextPCode.ObjectId != acTextPP.ObjectId)
                                {
                                    int intPCode = 0;
                                    if (int.TryParse(acTextPCode.TextString, out intPCode))
                                    {
                                        PP newPP = new PP(acTextPP.TextString, intPCode, acPoint3DPP.X, acPoint3DPP.Y, acPoint3DPP.Z);
                                        sb = new StringBuilder();
                                        sb.AppendFormat("PP : {0}   PCode : {1}{5}Coord : {2},{3},{4}{5}", newPP.NoPP, newPP.PCode, newPP.X, newPP.Y, newPP.Z, Environment.NewLine);
                                        Application.ShowAlertDialog(sb.ToString());
                                    }
                                }
                            }
                        }
                        else
                        {
                            sb.AppendFormat("Aucun texte trouvé pour le point {0}{2}PromptStatus = {1}", acTextPP.TextString, acPSResPCode.Status, Environment.NewLine);
                            Application.ShowAlertDialog(sb.ToString());
                        }
                        */
                        SelectionSet acSSetPCodes = GetTxtByPosition(acPt1, acPt2, acPoint3DPP, ed);
                        if (acSSetPCodes != null)
                        {
                            ObjectId[] acIdsPCodes = acSSetPCodes.GetObjectIds();
                            sb = new StringBuilder();
                            sb.AppendFormat("{0} éléments sélectionnés", acSSetPCodes.Count);
                            Application.ShowAlertDialog(sb.ToString());
                            for (int j = 0; j &amp;lt; acIdsPCodes.Length; j++)
                            {
                                DBText acTextPCode = null;
                                acTextPCode = (DBText)acTrans.GetObject(acIdsPCodes[i], OpenMode.ForRead);
                                sb = new StringBuilder();
                                sb.AppendFormat("{3}{2}Id : {0}{2}Id sélectionné : {1}", acTextPP.ObjectId, acTextPCode.ObjectId, Environment.NewLine, i);
                                Application.ShowAlertDialog(sb.ToString());
                                if (acTextPCode.ObjectId != acTextPP.ObjectId)
                                {
                                    int intPCode = 0;
                                    if (int.TryParse(acTextPCode.TextString, out intPCode))
                                    {
                                        PP newPP = new PP(acTextPP.TextString, intPCode, acPoint3DPP.X, acPoint3DPP.Y, acPoint3DPP.Z);
                                        sb = new StringBuilder();
                                        sb.AppendFormat("PP : {0}   PCode : {1}{5}Coord : {2},{3},{4}{5}", newPP.NoPP, newPP.PCode, newPP.X, newPP.Y, newPP.Z, Environment.NewLine);
                                        Application.ShowAlertDialog(sb.ToString());
                                    }
                                }
                            }
                        }
                        else
                        {
                            sb.AppendFormat("Aucun texte trouvé pour le point {0}", acTextPP.TextString);
                            Application.ShowAlertDialog(sb.ToString());
                        }


                    }
                }
            }
        }

 /*       private SelectionSet GetTxtByPosition(Point3d p1, Point3d p2, Point3d txtInsPoint, Editor ed)
        {
            PromptSelectionResult ws = default(PromptSelectionResult);
            TypedValue[] acTypValAr = new TypedValue[4];

            acTypValAr.SetValue(new TypedValue((int)DxfCode.Start, "TEXT"), 0);
            acTypValAr.SetValue(new TypedValue((int)DxfCode.XCoordinate, txtInsPoint.X), 1);
            acTypValAr.SetValue(new TypedValue((int)DxfCode.YCoordinate, txtInsPoint.Y), 2);
            acTypValAr.SetValue(new TypedValue((int)DxfCode.ZCoordinate, txtInsPoint.Z), 3);

            SelectionFilter acSelFtr = new SelectionFilter(acTypValAr);
            ws = ed.SelectAll(acSelFtr);
            if (ws.Status == PromptStatus.OK)
            {
                return ws.Value;
            }
            return null;
        }*/
        private SelectionSet GetTxtByPosition(Point3d p1, Point3d p2, Point3d txtInsPoint, Editor ed)
        {
            PromptSelectionResult ws = default(PromptSelectionResult);
            TypedValue[] acTypValAr = new TypedValue[4];
            acTypValAr.SetValue(new TypedValue((int)DxfCode.Start, "TEXT"), 0);
            acTypValAr.SetValue(new TypedValue((int)DxfCode.XCoordinate, txtInsPoint.X), 1);
            acTypValAr.SetValue(new TypedValue((int)DxfCode.YCoordinate, txtInsPoint.Y), 2);
            acTypValAr.SetValue(new TypedValue((int)DxfCode.ZCoordinate, txtInsPoint.Z), 3);

            SelectionFilter acSelFtr = new SelectionFilter(acTypValAr);
            ws = ed.SelectCrossingWindow(p1, p2, acSelFtr);
            if (ws.Status == PromptStatus.OK)
            {
                return ws.Value;
            }
            return null;
        }
    }

    public class PP
    {
        public string NoPP { get; set; }
        public int PCode { get; set; }
        public double X { get; set; }
        public double Y { get; set; }
        public double Z { get; set; }
        public PP(string noPP, int pCode, double x, double y, double z)
        {
            NoPP = noPP;
            PCode = pCode;
            X = x;
            Y = y;
            z = Z;
        }
    }
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Dec 2012 15:11:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/selecting-text-at-insertion-point-of-other-text/m-p/3721890#M52182</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-12-04T15:11:10Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting text at insertion point of other text</title>
      <link>https://forums.autodesk.com/t5/net-forum/selecting-text-at-insertion-point-of-other-text/m-p/3731024#M52183</link>
      <description>&lt;P&gt;Hello Jean-Marc,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried your code sample with a few changes and it worked ok.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1) Using ArxDbg snoop tool, we can find that the DXF codes for text entity contains the insertion point as the group code 10. So to provide the insertion point as a filter, I changed the "GetTextByPosition" as :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;        private SelectionSet GetTxtByPosition(Point3d p1, Point3d p2, Point3d txtInsPoint, Editor ed)
        {
            PromptSelectionResult ws = default(PromptSelectionResult);
            TypedValue[] acTypValAr = new TypedValue[2];
            acTypValAr.SetValue(new TypedValue((int)DxfCode.Start, "TEXT"), 0);
            acTypValAr.SetValue(new TypedValue(10, txtInsPoint), 1);
          
            SelectionFilter acSelFtr = new SelectionFilter(acTypValAr);
            //ws = ed.SelectCrossingWindow(p1, p2, acSelFtr);
            ws = ed.SelectAll(acSelFtr);
            if (ws.Status == PromptStatus.OK)
            {
                return ws.Value;
            }
            return null;
        }&lt;/PRE&gt;
&lt;P&gt;"SelectAll" instead of "SelectCrossingWindow" is being used in this case as we have already specified the insertion point of the text as a selection filter.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2) This may be a typo while you copied the code, but just wanted to ensure that is the case.&lt;/P&gt;
&lt;P&gt;In the constructor of class PP, it should be "Z = z" instead of "z = Z"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Dec 2012 00:04:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/selecting-text-at-insertion-point-of-other-text/m-p/3731024#M52183</guid>
      <dc:creator>Balaji_Ram</dc:creator>
      <dc:date>2012-12-11T00:04:20Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting text at insertion point of other text</title>
      <link>https://forums.autodesk.com/t5/net-forum/selecting-text-at-insertion-point-of-other-text/m-p/3731884#M52184</link>
      <description>&lt;P&gt;It works perfectly. Thanks &lt;A target="_self" href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/765444"&gt;&lt;SPAN&gt;Balaji_Ram&lt;/SPAN&gt;&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Dec 2012 15:13:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/selecting-text-at-insertion-point-of-other-text/m-p/3731884#M52184</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-12-11T15:13:12Z</dc:date>
    </item>
  </channel>
</rss>

