<?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 Editor.GetEntity() and PickPointSelectedSubObject in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/editor-getentity-and-pickpointselectedsubobject/m-p/7292791#M30160</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;a user needs to select an object. I need to know exactly where the object was clicked as I will process the segment the user clicked on.&lt;BR /&gt;Now, so far I'm using editor.GetSelection(). In most cases the user should only select one single object - and I havent figured out how to limit the selection process to exactly one object.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;But there is also Editor.GetEntity() - which seems a better choice for my use case. Now, here is the question:&lt;BR /&gt;with GetSelection I get the point where the user clicked with the following code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;foreach (SelectedObject ssobj in selSet)
{
	// usually AC Object
	if (ssobj.SelectionMethod == SelectionMethod.PickPoint)
	{
		PickPointSelectedObject ppsd = ssobj as PickPointSelectedObject;
	PickPointDescriptor ppd = ppsd.PickPoint;
		p = ppd.PointOnLine;
		UtilCadActive.WriteMessage("\nCAD-&amp;gt;" + ppd.PointOnLine.ToString());
		break;
		
	}
	// usually Map-FDO Object
	if (ssobj.SelectionMethod == SelectionMethod.SubEntity)
	{
		SelectedSubObject[] subOb = ssobj.GetSubentities();
		foreach (SelectedSubObject o in subOb)
		{
			if (o.SelectionMethod == SelectionMethod.PickPoint)
			{
				PickPointSelectedSubObject so = o as PickPointSelectedSubObject;
				PickPointDescriptor ppd = so.PickPoint;
				p = ppd.PointOnLine;
				UtilCadActive.WriteMessage("\nMap-&amp;gt;" + ppd.PointOnLine.ToString());
				break;
			}
		}
		break;
	}&lt;/PRE&gt;
&lt;P&gt;I have to deal with CAD entities and Map objects (FDO features). The way to get the pickpoint is different. Is there something similiar for GetEntity()? I only see PromptEntityResult.PickedPoint - how would I get to the Subentities and their PickPoint?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks, Rob&lt;/P&gt;</description>
    <pubDate>Fri, 11 Aug 2017 06:35:17 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2017-08-11T06:35:17Z</dc:date>
    <item>
      <title>Editor.GetEntity() and PickPointSelectedSubObject</title>
      <link>https://forums.autodesk.com/t5/net-forum/editor-getentity-and-pickpointselectedsubobject/m-p/7292791#M30160</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;a user needs to select an object. I need to know exactly where the object was clicked as I will process the segment the user clicked on.&lt;BR /&gt;Now, so far I'm using editor.GetSelection(). In most cases the user should only select one single object - and I havent figured out how to limit the selection process to exactly one object.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;But there is also Editor.GetEntity() - which seems a better choice for my use case. Now, here is the question:&lt;BR /&gt;with GetSelection I get the point where the user clicked with the following code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;foreach (SelectedObject ssobj in selSet)
{
	// usually AC Object
	if (ssobj.SelectionMethod == SelectionMethod.PickPoint)
	{
		PickPointSelectedObject ppsd = ssobj as PickPointSelectedObject;
	PickPointDescriptor ppd = ppsd.PickPoint;
		p = ppd.PointOnLine;
		UtilCadActive.WriteMessage("\nCAD-&amp;gt;" + ppd.PointOnLine.ToString());
		break;
		
	}
	// usually Map-FDO Object
	if (ssobj.SelectionMethod == SelectionMethod.SubEntity)
	{
		SelectedSubObject[] subOb = ssobj.GetSubentities();
		foreach (SelectedSubObject o in subOb)
		{
			if (o.SelectionMethod == SelectionMethod.PickPoint)
			{
				PickPointSelectedSubObject so = o as PickPointSelectedSubObject;
				PickPointDescriptor ppd = so.PickPoint;
				p = ppd.PointOnLine;
				UtilCadActive.WriteMessage("\nMap-&amp;gt;" + ppd.PointOnLine.ToString());
				break;
			}
		}
		break;
	}&lt;/PRE&gt;
&lt;P&gt;I have to deal with CAD entities and Map objects (FDO features). The way to get the pickpoint is different. Is there something similiar for GetEntity()? I only see PromptEntityResult.PickedPoint - how would I get to the Subentities and their PickPoint?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks, Rob&lt;/P&gt;</description>
      <pubDate>Fri, 11 Aug 2017 06:35:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/editor-getentity-and-pickpointselectedsubobject/m-p/7292791#M30160</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-08-11T06:35:17Z</dc:date>
    </item>
    <item>
      <title>Re: Editor.GetEntity() and PickPointSelectedSubObject</title>
      <link>https://forums.autodesk.com/t5/net-forum/editor-getentity-and-pickpointselectedsubobject/m-p/7293791#M30161</link>
      <description>&lt;P&gt;You can use a prompt selection option to limit your selections to only one object. e.g. see below for an example. hope it helps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt; [CommandMethod("SelectOnlyOne")]
        public static void SelectOnlyOne()
        {
            Document doc = Application.DocumentManager.MdiActiveDocument;
            Editor ed = doc.Editor;
            PromptSelectionOptions pso = new PromptSelectionOptions();

                // selects only a single entity            
            pso.SingleOnly = true;
                // selects only one at a time - but since singleOnly is true it selects only once.
            pso.SinglePickInSpace = true;

            PromptSelectionResult psr = ed.GetSelection(pso);

            if (psr.Status == PromptStatus.OK)
            {
                SelectionSet ss = psr.Value;

                // deal with the selection set as you see fit
            }

        }&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Aug 2017 13:38:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/editor-getentity-and-pickpointselectedsubobject/m-p/7293791#M30161</guid>
      <dc:creator>BKSpurgeon</dc:creator>
      <dc:date>2017-08-11T13:38:54Z</dc:date>
    </item>
    <item>
      <title>Re: Editor.GetEntity() and PickPointSelectedSubObject</title>
      <link>https://forums.autodesk.com/t5/net-forum/editor-getentity-and-pickpointselectedsubobject/m-p/7297772#M30162</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;many thanks for your reply. Yes, I have done that already - problem is: user can still&amp;nbsp;draw window to perform selection. And in that case I don't get a pickpoint back. Thats why I thought GetEntity would be better choice,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Rob&lt;/P&gt;</description>
      <pubDate>Mon, 14 Aug 2017 06:42:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/editor-getentity-and-pickpointselectedsubobject/m-p/7297772#M30162</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-08-14T06:42:49Z</dc:date>
    </item>
    <item>
      <title>Re: Editor.GetEntity() and PickPointSelectedSubObject</title>
      <link>https://forums.autodesk.com/t5/net-forum/editor-getentity-and-pickpointselectedsubobject/m-p/7298101#M30163</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm not certain to understand what you're trying to do, but to mimic GetEntity with GetSelection, the options are:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;SingleOnly = true;&lt;/LI&gt;
&lt;LI&gt;SelectEverythingInAperture = true;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Here's a little example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;            var ed = Application.DocumentManager.MdiActiveDocument.Editor;
            var opts = new PromptSelectionOptions();
            opts.AllowSubSelections = true;
            opts.SingleOnly = true;
            opts.SelectEverythingInAperture = true;
            var psr = ed.GetSelection(opts);
            if (psr.Status == PromptStatus.OK)
            {
                var ssObj = psr.Value[0];
                if (ssObj.SelectionMethod == SelectionMethod.PickPoint)
                {
                    ed.WriteMessage("\nPick point: " + ((PickPointSelectedObject)ssObj).PickPoint.PointOnLine);
                }
                if (ssObj.SelectionMethod == SelectionMethod.SubEntity)
                {
                    foreach (SelectedSubObject subEnt in ssObj.GetSubentities())
                    {
                        if (subEnt.SelectionMethod == SelectionMethod.PickPoint)
                        {
                            ed.WriteMessage("\nSub entity pick point: " + ((PickPointSelectedSubObject)subEnt).PickPoint.PointOnLine);
                        }
                    }
                }
            }&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Aug 2017 09:15:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/editor-getentity-and-pickpointselectedsubobject/m-p/7298101#M30163</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2017-08-14T09:15:53Z</dc:date>
    </item>
    <item>
      <title>Re: Editor.GetEntity() and PickPointSelectedSubObject</title>
      <link>https://forums.autodesk.com/t5/net-forum/editor-getentity-and-pickpointselectedsubobject/m-p/7298161#M30164</link>
      <description>&lt;P&gt;Hi Gile,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;as far as I have figured out GetSelection allows to draw a selection window - even if only one object can be picked.&lt;/P&gt;
&lt;P&gt;I do not want the user to be able to select by window. Thats why I thought "GetEntity" would be better suited for my use-case. But I haven't tested whether you can select by window when using GetEntity - I just assume you cant, but who knows.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Rob&lt;/P&gt;</description>
      <pubDate>Mon, 14 Aug 2017 09:46:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/editor-getentity-and-pickpointselectedsubobject/m-p/7298161#M30164</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-08-14T09:46:42Z</dc:date>
    </item>
    <item>
      <title>Re: Editor.GetEntity() and PickPointSelectedSubObject</title>
      <link>https://forums.autodesk.com/t5/net-forum/editor-getentity-and-pickpointselectedsubobject/m-p/7298212#M30165</link>
      <description>&lt;P&gt;Did you try the code I posted ?&lt;/P&gt;
&lt;P&gt;Using SelectEverythingInAperture = true (:E) and SingleOnly = true (:S) options forces a single pick selection as GetEntity does.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Aug 2017 10:10:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/editor-getentity-and-pickpointselectedsubobject/m-p/7298212#M30165</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2017-08-14T10:10:43Z</dc:date>
    </item>
    <item>
      <title>Re: Editor.GetEntity() and PickPointSelectedSubObject</title>
      <link>https://forums.autodesk.com/t5/net-forum/editor-getentity-and-pickpointselectedsubobject/m-p/7298232#M30166</link>
      <description>&lt;P&gt;Hi Gile,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;many thanks - that's what I was looking for.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Rob&lt;/P&gt;</description>
      <pubDate>Mon, 14 Aug 2017 10:29:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/editor-getentity-and-pickpointselectedsubobject/m-p/7298232#M30166</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-08-14T10:29:34Z</dc:date>
    </item>
    <item>
      <title>Re: Editor.GetEntity() and PickPointSelectedSubObject</title>
      <link>https://forums.autodesk.com/t5/net-forum/editor-getentity-and-pickpointselectedsubobject/m-p/7306593#M30167</link>
      <description>&lt;P&gt;Hi Mr Gilles i have a question:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;            var opts = new PromptSelectionOptions();
            opts.AllowSubSelections = true;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What is the meaning of AllowSubSelections?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The documentation is quite sparse on this point. clarification much appreciated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;rgds&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Aug 2017 00:39:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/editor-getentity-and-pickpointselectedsubobject/m-p/7306593#M30167</guid>
      <dc:creator>BKSpurgeon</dc:creator>
      <dc:date>2017-08-17T00:39:02Z</dc:date>
    </item>
    <item>
      <title>Re: Editor.GetEntity() and PickPointSelectedSubObject</title>
      <link>https://forums.autodesk.com/t5/net-forum/editor-getentity-and-pickpointselectedsubobject/m-p/7306872#M30168</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;AllowSubSelections allows to select sub entities (solid or meshes edges, attribute references, ...) accordingly with the LEGACYCTRLPICK and SUBOBJSELECTMODE sysvar settings.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With default settings (LEGACYCTRLPICK = 2 and SUBOBJSELECTMODE = 0), AllowSubSelections allows sub entities selection using Ctrl+click.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Aug 2017 06:00:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/editor-getentity-and-pickpointselectedsubobject/m-p/7306872#M30168</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2017-08-17T06:00:15Z</dc:date>
    </item>
    <item>
      <title>Re: Editor.GetEntity() and PickPointSelectedSubObject</title>
      <link>https://forums.autodesk.com/t5/net-forum/editor-getentity-and-pickpointselectedsubobject/m-p/11550632#M30169</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/109424"&gt;@_gile&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a problem when using the method pickpoint as your code.&lt;/P&gt;&lt;P&gt;Here I pick a point on the cyan polyline to make a leader, but the coordinate of point does not really intersect with this polyline, it depends on the pickbox size.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help me to get the intersect point when pick this polyline.&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="BIM_VIET_2-1668422989667.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1139405iCE68A61EE7CAE56E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="BIM_VIET_2-1668422989667.png" alt="BIM_VIET_2-1668422989667.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Nov 2022 10:56:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/editor-getentity-and-pickpointselectedsubobject/m-p/11550632#M30169</guid>
      <dc:creator>BIM_VIET</dc:creator>
      <dc:date>2022-11-14T10:56:59Z</dc:date>
    </item>
    <item>
      <title>Re: Editor.GetEntity() and PickPointSelectedSubObject</title>
      <link>https://forums.autodesk.com/t5/net-forum/editor-getentity-and-pickpointselectedsubobject/m-p/11551650#M30170</link>
      <description>&lt;P&gt;the pickedpoint is where the center of the "pickbox". You need to CALCULATE where exactly the point to a selected entity is. In your case, when the selected entity is an entity derived from curve, you can calculate with Curve.GetClosestPoint() method:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;var pointOnPickedPolyline=PickedPolyline.GetClosestPoint(pickedPoint, false);&lt;/P&gt;</description>
      <pubDate>Mon, 14 Nov 2022 18:24:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/editor-getentity-and-pickpointselectedsubobject/m-p/11551650#M30170</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2022-11-14T18:24:09Z</dc:date>
    </item>
    <item>
      <title>Re: Editor.GetEntity() and PickPointSelectedSubObject</title>
      <link>https://forums.autodesk.com/t5/net-forum/editor-getentity-and-pickpointselectedsubobject/m-p/11552505#M30171</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/543921"&gt;@norman.yuan&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Nov 2022 02:36:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/editor-getentity-and-pickpointselectedsubobject/m-p/11552505#M30171</guid>
      <dc:creator>BIM_VIET</dc:creator>
      <dc:date>2022-11-15T02:36:19Z</dc:date>
    </item>
  </channel>
</rss>

