<?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 connected lines in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/get-connected-lines/m-p/4922540#M44720</link>
    <description>Entity.IntersectWith Method, Line is also a class derives from this abstract class</description>
    <pubDate>Mon, 31 Mar 2014 12:04:37 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2014-03-31T12:04:37Z</dc:date>
    <item>
      <title>get connected lines</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-connected-lines/m-p/4922476#M44719</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do &amp;nbsp;I get all lines connected to a selected line. The lines can cross other lines ,they can share same start or end point or they can share common vertices. In all I mean to say that I want all lines connected/touching/intersecting lines to the selected line.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards&lt;/P&gt;&lt;P&gt;Sanjay Pandey&lt;/P&gt;</description>
      <pubDate>Mon, 31 Mar 2014 11:42:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-connected-lines/m-p/4922476#M44719</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-03-31T11:42:19Z</dc:date>
    </item>
    <item>
      <title>Re: get connected lines</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-connected-lines/m-p/4922540#M44720</link>
      <description>Entity.IntersectWith Method, Line is also a class derives from this abstract class</description>
      <pubDate>Mon, 31 Mar 2014 12:04:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-connected-lines/m-p/4922540#M44720</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-03-31T12:04:37Z</dc:date>
    </item>
    <item>
      <title>Re: get connected lines</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-connected-lines/m-p/4923258#M44721</link>
      <description>&lt;P&gt;Change this code to your needs:&lt;/P&gt;
&lt;PRE&gt;      //_____________________________________________________________________//
        //ads_queueexpr
        [DllImport("accore.dll", CharSet = CharSet.Unicode,
CallingConvention = CallingConvention.Cdecl,
EntryPoint = "ads_queueexpr")]
        extern static private int ads_queueexpr(byte[] command);


        [CommandMethod("tJL", CommandFlags.Modal | CommandFlags.UsePickSet)]
        public void TestConnectedLines()
        {
            Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;

            Editor ed = doc.Editor;

            Database db = doc.Database;

            PromptEntityOptions pso = new PromptEntityOptions("\nPick a single line to join: ");

            pso.SetRejectMessage("\nObject must be of type Line!");

            pso.AddAllowedClass(typeof(Line), false);

            PromptEntityResult res = ed.GetEntity(pso);

            if (res.Status != PromptStatus.OK) return;
            using (DocumentLock doclock = doc.LockDocument())
            {
                using (Transaction tr = db.TransactionManager.StartTransaction())
                {

                   Autodesk.AutoCAD.ApplicationServices.Application.SetSystemVariable( "PICKFIRST",1); 
               Autodesk.AutoCAD.ApplicationServices.Application.SetSystemVariable( "PEDITACCEPT",0); 
                    BlockTableRecord btr = (BlockTableRecord)tr.GetObject(db.CurrentSpaceId, OpenMode.ForRead) as BlockTableRecord;

                    List&amp;lt;ObjectId&amp;gt; ids = JoinLines(btr, res.ObjectId);

                    ObjectId[] lines = ids.ToArray();
                    
                    ed.SetImpliedSelection(lines);
                 
                    PromptSelectionResult chres = ed.SelectImplied();
              
                    if (chres.Status != PromptStatus.OK)
                    {
                        ed.WriteMessage("\nNothing added in the chain!");

                        return;
                    }
                        else
                        {
                        ed.WriteMessage(chres.Value.Count.ToString());
                        }
                    SelectionSet newset = SelectionSet.FromObjectIds(lines);

                    ed.SetImpliedSelection(newset);
           
                    string handles = "";
                    foreach (SelectedObject selobj in newset)
                    {
                        
                        Entity subent = tr.GetObject(selobj.ObjectId, OpenMode.ForWrite) as Entity;
                        string hdl=string.Format("(handent \"{0}\")",subent.Handle.ToString());
                        handles= handles + hdl + " ";
                  
                    }
                    System.Text.UnicodeEncoding uEncode = new System.Text.UnicodeEncoding();
                 // if PEDITACCEPT is set to 1 enshort the command avoiding "_Y" argument:
                    ads_queueexpr(uEncode.GetBytes("(COMMAND \"_.PEDIT\" \"_M\"" + handles  +  "\"\"" +  "\"_Y\" \"_J\" \"\" \"\")"));

                    tr.Commit();
                }
            }
        }

        private void SelectConnectedLines(BlockTableRecord btr, List&amp;lt;ObjectId&amp;gt; ids, ObjectId id)
        {
            Entity en = id.GetObject(OpenMode.ForRead, false) as Entity;

            Line ln = en as Line;

            if (ln != null)

                foreach (ObjectId idx in btr)
                {
                    Entity ex = idx.GetObject(OpenMode.ForRead, false) as Entity;

                    Line lx = ex as Line;

                    if (((ln.StartPoint == lx.StartPoint) || (ln.StartPoint == lx.EndPoint)) ||

                        ((ln.EndPoint == lx.StartPoint) || (ln.EndPoint == lx.EndPoint)))

                        if (!ids.Contains(idx))
                        {
                            ids.Add(idx);

                            SelectConnectedLines(btr, ids, idx);
                        }
                }
        }

        public List&amp;lt;ObjectId&amp;gt; JoinLines(BlockTableRecord btr, ObjectId id)
        {
            List&amp;lt;ObjectId&amp;gt; ids = new List&amp;lt;ObjectId&amp;gt;();

            SelectConnectedLines(btr, ids, id);

            return ids;
        }

        //_____________________________________________________________________//&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 31 Mar 2014 15:56:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-connected-lines/m-p/4923258#M44721</guid>
      <dc:creator>Hallex</dc:creator>
      <dc:date>2014-03-31T15:56:31Z</dc:date>
    </item>
    <item>
      <title>Re: get connected lines</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-connected-lines/m-p/5596364#M44722</link>
      <description>There is a built in autcad command called "FS" - fast selection or fast selection (can't remember which).&lt;BR /&gt;&lt;BR /&gt;it selects lines which are connected to your main line.&lt;BR /&gt;&lt;BR /&gt;If you switch FSMODE to "ON" you can also have all subsidiary lines selected if they are in any way connected to your main base line.&lt;BR /&gt;&lt;BR /&gt;it's in the autocad 2015 version.</description>
      <pubDate>Fri, 17 Apr 2015 05:45:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-connected-lines/m-p/5596364#M44722</guid>
      <dc:creator>BKSpurgeon</dc:creator>
      <dc:date>2015-04-17T05:45:55Z</dc:date>
    </item>
    <item>
      <title>Re: get connected lines</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-connected-lines/m-p/5599612#M44723</link>
      <description>List&amp;lt;ObjectId&amp;gt; ids = JoinLines(btr, res.ObjectId);&lt;BR /&gt;&lt;BR /&gt;for some reason, I cannot declare the List collection (see above) in Visual studio - intellisense is not coming up with that option.&lt;BR /&gt;&lt;BR /&gt;any ideas?</description>
      <pubDate>Mon, 20 Apr 2015 12:12:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-connected-lines/m-p/5599612#M44723</guid>
      <dc:creator>BKSpurgeon</dc:creator>
      <dc:date>2015-04-20T12:12:46Z</dc:date>
    </item>
    <item>
      <title>Re: get connected lines</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-connected-lines/m-p/5599676#M44724</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try importing: &lt;STRONG&gt;&lt;FONT color="#0000FF"&gt;System.Collections.Generic&lt;/FONT&gt;&lt;/STRONG&gt; Namespace into the class you are coding.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Gaston Nunez&lt;/P&gt;</description>
      <pubDate>Mon, 20 Apr 2015 13:02:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-connected-lines/m-p/5599676#M44724</guid>
      <dc:creator>hgasty1001</dc:creator>
      <dc:date>2015-04-20T13:02:12Z</dc:date>
    </item>
    <item>
      <title>Re: get connected lines</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-connected-lines/m-p/5600488#M44725</link>
      <description>excellent thank you!&lt;BR /&gt;&lt;BR /&gt;for everyone's reference, also found that in addition to that, these two need to be added too:&lt;BR /&gt;&lt;BR /&gt;using System.Collections.Generic;&lt;BR /&gt;using System.Runtime.InteropServices;&lt;BR /&gt;&lt;BR /&gt;rgds&lt;BR /&gt;&lt;BR /&gt;BK</description>
      <pubDate>Mon, 20 Apr 2015 22:01:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-connected-lines/m-p/5600488#M44725</guid>
      <dc:creator>BKSpurgeon</dc:creator>
      <dc:date>2015-04-20T22:01:02Z</dc:date>
    </item>
    <item>
      <title>Re: get connected lines</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-connected-lines/m-p/5600592#M44726</link>
      <description>&lt;PRE&gt;// if PEDITACCEPT is set to 1 enshort the command avoiding "_Y" argument:
                    ads_queueexpr(uEncode.GetBytes("(COMMAND \"_.PEDIT\" \"_M\"" + handles  +  "\"\"" +  "\"_Y\" \"_J\" \"\" \"\")"));&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 purpose of the above here?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I sent to the ojbectarx reference guide to see what ads_queueexpr means i was meant with confusion:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN&gt;ads_queueexpr Function&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;This function queues up the LISP expression &lt;/SPAN&gt;&lt;SPAN class="Element146"&gt;expr&lt;/SPAN&gt;&lt;SPAN&gt; to be executed the next time AutoCAD is quiescent and able to evaluate LISP expressions.&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;This function should only be called from within the &lt;/SPAN&gt;&lt;SPAN class="Element146"&gt;kLoadDwgMsg&lt;/SPAN&gt;&lt;SPAN&gt; case in your &lt;/SPAN&gt;&lt;SPAN class="Element146"&gt;acrxEntryPoint()&lt;/SPAN&gt;&lt;SPAN&gt; function. Queued LISP expressions will be executed after the (s::startup) has been executed.&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;Multiple calls to &lt;/SPAN&gt;&lt;SPAN class="Element146"&gt;ads_queueexpr()&lt;/SPAN&gt;&lt;SPAN&gt; from the &lt;/SPAN&gt;&lt;SPAN class="Element146"&gt;kLoadDwgMsg&lt;/SPAN&gt;&lt;SPAN&gt; callback are perfectly acceptable. They get queued up in the order of the calls.&amp;nbsp;ads_queueexpr Function&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;Do not use &lt;/SPAN&gt;&lt;SPAN class="Element146"&gt;ads_queueexpr()&lt;/SPAN&gt;&lt;SPAN&gt; in any context other then the &lt;/SPAN&gt;&lt;SPAN class="Element146"&gt;kLoadDwgMsg&lt;/SPAN&gt;&lt;SPAN&gt; case of &lt;/SPAN&gt;&lt;SPAN class="Element146"&gt;acrxEntryPoint()&lt;/SPAN&gt;&lt;SPAN&gt;. To do so will have unpredictable results, and may even be damaging, because the queue may not be looked at until active AutoLISP evaluations, MENU items, and/or SCRIPT executions are all finished.&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I do not understand much of the above.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;SPAN&gt;any explanation was to what &lt;/SPAN&gt;ads_queueexpr(uEncode.GetBytes("(COMMAND \"_.PEDIT\" \"_M\"" + handles + "\"\"" + "\"_Y\" \"_J\" \"\" \"\")")); does would be helpful.&lt;/LI&gt;&lt;LI&gt;since pedit is set to 0 the &lt;SPAN&gt;"\"_Y\" is omitted in my code leaving behind this:&amp;nbsp;ads_queueexpr(uEncode.GetBytes("(COMMAND \"_.PEDIT\" \"_M\"" + handles + "\"\"" + " \"_J\" \"\" \"\")"));&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Am i doing this right? Any assistance much appreciated.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Apr 2015 00:37:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-connected-lines/m-p/5600592#M44726</guid>
      <dc:creator>BKSpurgeon</dc:creator>
      <dc:date>2015-04-21T00:37:07Z</dc:date>
    </item>
    <item>
      <title>Re: get connected lines</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-connected-lines/m-p/7264331#M44727</link>
      <description>&lt;P&gt;For anyone reading this perhaps you can make use of the following routine Mr Gilles has kindly provided:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.theswamp.org/index.php?action=post;quote=446965;topic=31865.15;last_msg=565479" target="_blank"&gt;https://www.theswamp.org/index.php?action=post;quote=446965;topic=31865.15;last_msg=565479&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;it seems to work very quickly - incredibly quickly compared to the algorithm posted above. You will also need the GeometryExtensions Library also kindly provided by Mr Gilles.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;good luck.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jul 2017 00:59:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-connected-lines/m-p/7264331#M44727</guid>
      <dc:creator>BKSpurgeon</dc:creator>
      <dc:date>2017-07-31T00:59:53Z</dc:date>
    </item>
    <item>
      <title>Re: get connected lines</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-connected-lines/m-p/7264352#M44728</link>
      <description>&lt;P&gt;Here is a direct link to that post :&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.theswamp.org/index.php?topic=31865.msg446965#msg446965" target="_blank"&gt;https://www.theswamp.org/index.php?topic=31865.msg446965#msg446965&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jul 2017 01:34:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-connected-lines/m-p/7264352#M44728</guid>
      <dc:creator>kerry_w_brown</dc:creator>
      <dc:date>2017-07-31T01:34:26Z</dc:date>
    </item>
  </channel>
</rss>

