<?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: Convert line to polyline in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/convert-line-to-polyline/m-p/3689408#M52744</link>
    <description>&lt;P&gt;I used your suggestion about using SendStringToExecute in other topic,&lt;/P&gt;&lt;P&gt;seems to me it will work nice, perhaps I mised something oot not sure, i.e.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;        [CommandMethod("tsend")]
        public  void testSendStringToExecute()
        {
            Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
            doc.CommandWillStart += new CommandEventHandler(doc_CommandWillStart);
           // doc.SendStringToExecute("PEDIT M (SSGET \"P\")  J   ",true,false,false);//ok           
           // doc.SendStringToExecute("_CIRCLE PAUSE PAUSE ", true, false, false);//ok
            doc.SendStringToExecute("FILLET R 10 P PAUSE ", true, false, false);//ok
        }
        void doc_CommandWillStart(object sender, CommandEventArgs e)
        {
            ((Document)sender).CommandWillStart -= doc_CommandWillStart;
            ((Document)sender).CommandEnded+=new CommandEventHandler(doc_CommandEnded);
            ((Document)sender).CommandFailed += new CommandEventHandler(doc_CommandEnded);
            ((Document)sender).CommandCancelled += new CommandEventHandler(doc_CommandEnded);
        }
        void doc_CommandEnded(object sender, CommandEventArgs e)
        {
            // if (e.GlobalCommandName.ToUpper()=="PEDIT")
            // if (e.GlobalCommandName.ToUpper()=="CIRCLE")
                if (e.GlobalCommandName.ToUpper()=="FILLET")
            {
                Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage(
                    "\nCommand {0} ended...",e.GlobalCommandName
                    );
               
            }
        }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Regards, friend&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Oleg&lt;/P&gt;</description>
    <pubDate>Tue, 06 Nov 2012 21:49:06 GMT</pubDate>
    <dc:creator>Hallex</dc:creator>
    <dc:date>2012-11-06T21:49:06Z</dc:date>
    <item>
      <title>Convert line to polyline</title>
      <link>https://forums.autodesk.com/t5/net-forum/convert-line-to-polyline/m-p/3676722#M52740</link>
      <description>&lt;P&gt;Hello Forum,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to convert a line (Autodesk.AutoCAD.DatabaseServices.Line) to a polyline (Autodesk.AutoCAD.DatabaseServices.Polyline).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Currently I get all the properties from the line, create a new polyline with it and delete the line. I fear data may get lost this way. What is the best way to convert a line to a polyline?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;// Line properties:
// Color.
// Layer.
// Linetype.
// Linetype scale.
// Plot style.
// Lineweight.
// Hyperlink.
// Thickness.
// Material.
// Start X.
// Start Y.
// Start Z.
// End X.
// End Y.
// End Z.
// Start point.
// End point.&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Thank you.&lt;/P&gt;</description>
      <pubDate>Sun, 28 Oct 2012 17:51:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/convert-line-to-polyline/m-p/3676722#M52740</guid>
      <dc:creator>Ertqwa</dc:creator>
      <dc:date>2012-10-28T17:51:26Z</dc:date>
    </item>
    <item>
      <title>Re: Convert line to polyline</title>
      <link>https://forums.autodesk.com/t5/net-forum/convert-line-to-polyline/m-p/3686264#M52742</link>
      <description>&lt;P&gt;Here is a sample code&amp;nbsp;that sends a PEDIT command using acedCmd :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;        &amp;lt;DllImport("acad.exe", CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.Cdecl, EntryPoint:="acedCmd")&amp;gt; _
        Private Shared Function acedCmd(ByVal vlist As System.IntPtr) As Integer
        End Function

        &amp;lt;CommandMethod("L2PL")&amp;gt; _
        Public Sub Line2Pline()
            ' get the autocad editor instance
            Dim ed As Autodesk.AutoCAD.EditorInput.Editor = _
            Autodesk.AutoCAD.ApplicationServices. _
            Application.DocumentManager.MdiActiveDocument.Editor
            ' get a select set of entities in the dwg window
            Dim selection As PromptSelectionResult = ed.GetSelection()
            ' if the selection was successful
            If selection.Status = PromptStatus.OK Then
                ' create a new .NET resbuf struct
                Dim rbCommand As New Autodesk.AutoCAD.DatabaseServices.ResultBuffer
                ' create the buildlist
                rbCommand.Add( _
                New Autodesk.AutoCAD.DatabaseServices.TypedValue(5005, "_PEDIT")) ' RTSTR
                Dim id As ObjectId
                For Each id In selection.Value.GetObjectIds()
                    rbCommand.Add( _
                    New Autodesk.AutoCAD.DatabaseServices.TypedValue(5006, id)) ' RTENAME
                Next
                ' exit out of entity selection
                rbCommand.Add( _
                New Autodesk.AutoCAD.DatabaseServices.TypedValue(5005, "Yes")) ' RTSTR

                rbCommand.Add( _
                New Autodesk.AutoCAD.DatabaseServices.TypedValue(5005, "")) ' RTSTR
                ' now call the zoom to objects command
                acedCmd(rbCommand.UnmanagedObject)
            End If
        End Sub&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Nov 2012 05:48:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/convert-line-to-polyline/m-p/3686264#M52742</guid>
      <dc:creator>Balaji_Ram</dc:creator>
      <dc:date>2012-11-05T05:48:10Z</dc:date>
    </item>
    <item>
      <title>Re: Convert line to polyline</title>
      <link>https://forums.autodesk.com/t5/net-forum/convert-line-to-polyline/m-p/3687884#M52743</link>
      <description>&lt;P&gt;You don't really need to do the nitty-gritty work related to P/Invok'ing acedCmd() in releases of AutoCAD later than 2009. You can use the non-public RunCommand method of the Editor ciass via reflection to do it much more easily.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;See this swamp post for the code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;A href="http://www.theswamp.org/index.php?topic=43113.msg483306#msg483306" target="_blank"&gt;http://www.theswamp.org/index.php?topic=43113.msg483306#msg483306&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Nov 2012 03:42:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/convert-line-to-polyline/m-p/3687884#M52743</guid>
      <dc:creator>DiningPhilosopher</dc:creator>
      <dc:date>2012-11-06T03:42:10Z</dc:date>
    </item>
    <item>
      <title>Re: Convert line to polyline</title>
      <link>https://forums.autodesk.com/t5/net-forum/convert-line-to-polyline/m-p/3689408#M52744</link>
      <description>&lt;P&gt;I used your suggestion about using SendStringToExecute in other topic,&lt;/P&gt;&lt;P&gt;seems to me it will work nice, perhaps I mised something oot not sure, i.e.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;        [CommandMethod("tsend")]
        public  void testSendStringToExecute()
        {
            Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
            doc.CommandWillStart += new CommandEventHandler(doc_CommandWillStart);
           // doc.SendStringToExecute("PEDIT M (SSGET \"P\")  J   ",true,false,false);//ok           
           // doc.SendStringToExecute("_CIRCLE PAUSE PAUSE ", true, false, false);//ok
            doc.SendStringToExecute("FILLET R 10 P PAUSE ", true, false, false);//ok
        }
        void doc_CommandWillStart(object sender, CommandEventArgs e)
        {
            ((Document)sender).CommandWillStart -= doc_CommandWillStart;
            ((Document)sender).CommandEnded+=new CommandEventHandler(doc_CommandEnded);
            ((Document)sender).CommandFailed += new CommandEventHandler(doc_CommandEnded);
            ((Document)sender).CommandCancelled += new CommandEventHandler(doc_CommandEnded);
        }
        void doc_CommandEnded(object sender, CommandEventArgs e)
        {
            // if (e.GlobalCommandName.ToUpper()=="PEDIT")
            // if (e.GlobalCommandName.ToUpper()=="CIRCLE")
                if (e.GlobalCommandName.ToUpper()=="FILLET")
            {
                Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage(
                    "\nCommand {0} ended...",e.GlobalCommandName
                    );
               
            }
        }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Regards, friend&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Oleg&lt;/P&gt;</description>
      <pubDate>Tue, 06 Nov 2012 21:49:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/convert-line-to-polyline/m-p/3689408#M52744</guid>
      <dc:creator>Hallex</dc:creator>
      <dc:date>2012-11-06T21:49:06Z</dc:date>
    </item>
    <item>
      <title>Re: Convert line to polyline</title>
      <link>https://forums.autodesk.com/t5/net-forum/convert-line-to-polyline/m-p/3728974#M52745</link>
      <description>&lt;P&gt;Ty for the responses,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;unfortunately PEDIT does not affect lines inside a block.&lt;/P&gt;</description>
      <pubDate>Sun, 09 Dec 2012 07:37:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/convert-line-to-polyline/m-p/3728974#M52745</guid>
      <dc:creator>Ertqwa</dc:creator>
      <dc:date>2012-12-09T07:37:23Z</dc:date>
    </item>
    <item>
      <title>Re: Convert line to polyline</title>
      <link>https://forums.autodesk.com/t5/net-forum/convert-line-to-polyline/m-p/3728976#M52746</link>
      <description>&lt;P&gt;That is a nice tip, ty!&lt;/P&gt;</description>
      <pubDate>Sun, 09 Dec 2012 07:38:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/convert-line-to-polyline/m-p/3728976#M52746</guid>
      <dc:creator>Ertqwa</dc:creator>
      <dc:date>2012-12-09T07:38:04Z</dc:date>
    </item>
  </channel>
</rss>

