<?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: how to fillet line and arc? in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/how-to-fillet-line-and-arc/m-p/2725255#M64650</link>
    <description>&lt;P&gt;based on the drawings attached to the other reply...i'm trying to divide and conquer&lt;/P&gt;&lt;P&gt;so since each arc and each line have two intersections i'm trying to find the "close" one&lt;/P&gt;&lt;P&gt;given a pointlist (in this case of two points, but i think this allows any number of points) which point is closest to the arc (either to the startpoint or the end point)&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;i'm working on trying to test this and see if it works. but does the concept even look close?&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Private Function GetClosestIntersectionToOrigArc(ByVal ListOfPoints As Object, ByVal oarc As AcadArc) As Double()&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Dim arcstart As Point3d&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim arcEnd As Point3d&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim Testpoint As Point3d&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim NewPointList() As Double&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim NewStartPoint(0 To 2) As Double&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;arcstart = DirectCast(oarc.StartPoint, Point3d)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcEnd = DirectCast(oarc.EndPoint, Point3d)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;NewPointList = CType(ListOfPoints, Double())&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'because IntersectWith can return multiple intersections we have to find which is closest to original arc&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'it's either closest to arcstart or arcend&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim i As Short&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim colPoints As New Collection&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'if the array isn't multiple of 3 we're hosed&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'collect individual points from the list&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; For i = 0 To UBound(NewPointList) Step 3&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NewStartPoint(0) = NewPointList(i)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NewStartPoint(1) = NewPointList(i + 1)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NewStartPoint(2) = NewPointList(i + 2)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; colPoints.Add(NewStartPoint)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Next&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim dTestDist As Double&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim currentClosePoint As Object = Nothing&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim dCurrentLeastDist As Double&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; For i = 1 To colPoints.Count&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NewStartPoint = colPoints.Item(i)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'convert to point3d so i can use .Distance&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Testpoint = DirectCast(DirectCast(NewStartPoint, Object), Point3d)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If arcstart.DistanceTo(Testpoint) &amp;lt; arcEnd.DistanceTo(Testpoint) Then 'test point is close to start&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dTestDist = arcstart.DistanceTo(Testpoint)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If dTestDist &amp;lt; dCurrentLeastDist Then&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dCurrentLeastDist = dTestDist&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; currentClosePoint = DirectCast(Testpoint, Object)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Else 'end is closer to testpoint&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dTestDist = arcEnd.DistanceTo(Testpoint)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If dTestDist &amp;lt; dCurrentLeastDist Then&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dCurrentLeastDist = dTestDist&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; currentClosePoint = DirectCast(Testpoint, Object)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Next&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'cast object to double array&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Return DirectCast(currentClosePoint, Double())&lt;BR /&gt;&amp;nbsp; End Function&lt;/P&gt;</description>
    <pubDate>Fri, 23 Jul 2010 03:04:44 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2010-07-23T03:04:44Z</dc:date>
    <item>
      <title>how to fillet line and arc?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-fillet-line-and-arc/m-p/2721553#M64634</link>
      <description>&lt;P&gt;is there a way to do that programatically? fillet a line and arc&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jul 2010 04:25:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-fillet-line-and-arc/m-p/2721553#M64634</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-07-20T04:25:23Z</dc:date>
    </item>
    <item>
      <title>Re: how to fillet line and arc?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-fillet-line-and-arc/m-p/2721557#M64635</link>
      <description>&lt;P&gt;Yes, but not directly. You have to find the intersection points and then&lt;/P&gt;&lt;P&gt;calculate the new endpoints, and either replace the existing entities with&lt;/P&gt;&lt;P&gt;new ones, or manipulate the existing ones using the methods of the&lt;/P&gt;&lt;P&gt;Curve class (e.g, Extend(), GetSplitCurves(), and so on).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jul 2010 04:42:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-fillet-line-and-arc/m-p/2721557#M64635</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-07-20T04:42:59Z</dc:date>
    </item>
    <item>
      <title>Re: how to fillet line and arc?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-fillet-line-and-arc/m-p/2721683#M64636</link>
      <description>&lt;P&gt;Try CommandLine class from there:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A rel="nofollow" target="_blank" href="http://www.caddzone.com/CommandLine.cs"&gt;http://www.caddzone.com/CommandLine.cs&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;it's likes me more &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#800000"&gt;~'J'~&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jul 2010 10:54:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-fillet-line-and-arc/m-p/2721683#M64636</guid>
      <dc:creator>Hallex</dc:creator>
      <dc:date>2010-07-20T10:54:46Z</dc:date>
    </item>
    <item>
      <title>Re: how to fillet line and arc?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-fillet-line-and-arc/m-p/2721817#M64637</link>
      <description>&lt;P&gt;l'll try and figure how to use a c# class in a vbnet app.&lt;/P&gt;&lt;P&gt;the manual calcs are making me feel stupid&lt;/P&gt;&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jul 2010 12:58:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-fillet-line-and-arc/m-p/2721817#M64637</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-07-20T12:58:46Z</dc:date>
    </item>
    <item>
      <title>Re: how to fillet line and arc?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-fillet-line-and-arc/m-p/2721829#M64638</link>
      <description>&lt;P&gt;Sorry, I don't knew that you use VB.NET&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try&amp;nbsp;handle this&amp;nbsp;class instead:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A rel="nofollow" target="_blank" href="http://www.caddzone.com/CommandLine.vb"&gt;http://www.caddzone.com/CommandLine.vb&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;~'J'~&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jul 2010 13:03:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-fillet-line-and-arc/m-p/2721829#M64638</guid>
      <dc:creator>Hallex</dc:creator>
      <dc:date>2010-07-20T13:03:50Z</dc:date>
    </item>
    <item>
      <title>Re: how to fillet line and arc?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-fillet-line-and-arc/m-p/2721831#M64639</link>
      <description>&lt;P&gt;hmmm, i'm not seeing it&lt;/P&gt;&lt;P&gt;i imported .Geometry&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dim oCurve As Curve2d&lt;BR /&gt;'cast arc to curve&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; oCurve = CType(oArc3, Curve2d)&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;I don't get an .Extend method on the oCurve object&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;what am i missing?&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;(other than a brain)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;thanks&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;mark&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jul 2010 13:10:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-fillet-line-and-arc/m-p/2721831#M64639</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-07-20T13:10:06Z</dc:date>
    </item>
    <item>
      <title>Re: how to fillet line and arc?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-fillet-line-and-arc/m-p/2721841#M64640</link>
      <description>&lt;P&gt;oh, thanks&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jul 2010 13:17:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-fillet-line-and-arc/m-p/2721841#M64640</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-07-20T13:17:10Z</dc:date>
    </item>
    <item>
      <title>Re: how to fillet line and arc?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-fillet-line-and-arc/m-p/2721859#M64641</link>
      <description>&lt;P&gt;Do you have a sample of it's use?&lt;/P&gt;&lt;P&gt;i'll search this group too.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jul 2010 13:23:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-fillet-line-and-arc/m-p/2721859#M64641</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-07-20T13:23:49Z</dc:date>
    </item>
    <item>
      <title>Re: how to fillet line and arc?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-fillet-line-and-arc/m-p/2721861#M64642</link>
      <description>&lt;P&gt;I have already wrote&amp;nbsp;similar one&amp;nbsp;few moons ago&lt;/P&gt;&lt;P&gt;Still searching in my codes but with no luck yet &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;~'J'~&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jul 2010 13:26:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-fillet-line-and-arc/m-p/2721861#M64642</guid>
      <dc:creator>Hallex</dc:creator>
      <dc:date>2010-07-20T13:26:36Z</dc:date>
    </item>
    <item>
      <title>Re: how to fillet line and arc?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-fillet-line-and-arc/m-p/2721913#M64643</link>
      <description>&lt;P&gt;Huray, have found it in my garbage&lt;/P&gt;&lt;P&gt;Unfortunatelly it's on C# only&lt;/P&gt;&lt;P&gt;I'm pretty sure you could rewrite the code on VB.NET&lt;/P&gt;&lt;P&gt;(change AllowedType to arc and line)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;        /// &amp;lt;summary&amp;gt;
        ///                     * FILLET LINES *
        /// &amp;lt;/summary&amp;gt;
        [CommandMethod("filletlines", CommandFlags.UsePickSet | CommandFlags.Redraw)]
        public static void FL()
        {
            Database db = HostApplicationServices.WorkingDatabase;

            Document doc = acadApp.DocumentManager.MdiActiveDocument;

            Editor ed = doc.Editor;

            Transaction tr = db.TransactionManager.StartTransaction();

            using (tr)
            {
                try
                {
                    // Prompt for the fillet radius

                    PromptDoubleOptions pdo = new PromptDoubleOptions("\nEnter the fillet radius: ");
                    pdo.AllowZero = false;

                    pdo.AllowNegative = false;

                    pdo.AllowNone = false;

                    PromptDoubleResult pdr = ed.GetDouble(pdo);

                    if (pdr.Status != PromptStatus.OK)

                        return;

                    double rad = pdr.Value;

                    // Prompt for the lines to fillet

                    PromptEntityOptions peo = new PromptEntityOptions("\nSelect first line:");
                    peo.SetRejectMessage("\nSelect lines only");

                    peo.AddAllowedClass(typeof(Line), true);

                    PromptEntityResult per = ed.GetEntity(peo);

                    if (per.Status != PromptStatus.OK)

                        return;

                    ObjectId fid = per.ObjectId;

                    peo.Message = "\nSelect second line:";

                    per = ed.GetEntity(peo);

                    if (per.Status != PromptStatus.OK)

                        return;

                    ObjectId sid = per.ObjectId;

                    ObjectId[] ids = new ObjectId[2];

                    ids[0] = fid;

                    ids[1] = sid;

                    DBObject obj1 = tr.GetObject(fid, OpenMode.ForWrite);

                    DBObject obj2 = tr.GetObject(sid, OpenMode.ForWrite);

                    acadApp.SetSystemVariable("FILLETRAD", rad);

                    acadApp.SetSystemVariable("CMDECHO", 0);

                    ResultBuffer buf = new ResultBuffer();

                    buf.Add(new TypedValue(5005, "_FILLET"));

                    buf.Add(new TypedValue(5006, fid));

                    buf.Add(new TypedValue(5006, sid));

                    acedCmd(buf.UnmanagedObject);

                    buf.Dispose();

                    acadApp.SetSystemVariable("CMDECHO", 1);

                    tr.Commit();
                }

                catch (Autodesk.AutoCAD.Runtime.Exception ex)
                {
                    ed.WriteMessage(ex.Message + "\n" + ex.StackTrace);
                }
            }
        }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#800000"&gt;~'J'~&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jul 2010 13:55:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-fillet-line-and-arc/m-p/2721913#M64643</guid>
      <dc:creator>Hallex</dc:creator>
      <dc:date>2010-07-20T13:55:18Z</dc:date>
    </item>
    <item>
      <title>Re: how to fillet line and arc?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-fillet-line-and-arc/m-p/2721915#M64644</link>
      <description>&lt;P&gt;Use this tools to convert the code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A rel="nofollow" target="_blank" href="http://converter.telerik.com/"&gt;http://converter.telerik.com/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I haven't have a time now, so sorry&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;~'J'~&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jul 2010 13:57:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-fillet-line-and-arc/m-p/2721915#M64644</guid>
      <dc:creator>Hallex</dc:creator>
      <dc:date>2010-07-20T13:57:28Z</dc:date>
    </item>
    <item>
      <title>Re: how to fillet line and arc?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-fillet-line-and-arc/m-p/2721961#M64645</link>
      <description>&lt;P&gt;Stupid me, I forgot to add AcedCmd function&lt;/P&gt;&lt;P&gt;Here is one on VB.NET&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Declarations&lt;/P&gt;&lt;PRE&gt;Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.EditorInput
Imports Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.AutoCAD.GraphicsInterface
Imports AcadRT = Autodesk.AutoCAD.Runtime
Imports AcadED = Autodesk.AutoCAD.EditorInput
Imports AcadDB = Autodesk.AutoCAD.DatabaseServices
Imports System.Runtime.InteropServices&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Remove unused above&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;    &amp;lt;DllImport("acad.exe", BestFitMapping:=True, CallingConvention:=CallingConvention.Cdecl, CharSet:=CharSet.Auto)&amp;gt; _
    Private Shared Function acedCmd(ByVal vlist_in As System.IntPtr) As Integer
    End Function

    &amp;lt;CommandMethod("FL")&amp;gt; _
    Public Shared Sub FL()
        Dim db As Database = HostApplicationServices.WorkingDatabase

        Dim doc As Autodesk.AutoCAD.ApplicationServices.Document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument

        Dim ed As Editor = doc.Editor

        Dim tr As Transaction = db.TransactionManager.StartTransaction()

        Using tr
            Try
                ' Prompt for the fillet radius

                Dim pdo As New PromptDoubleOptions(vbLf &amp;amp; "Enter the fillet radius: ")
                pdo.AllowZero = False

                pdo.AllowNegative = False

                pdo.AllowNone = False

                Dim pdr As PromptDoubleResult = ed.GetDouble(pdo)

                If pdr.Status &amp;lt;&amp;gt; PromptStatus.OK Then

                    Return
                End If

                Dim rad As Double = pdr.Value

                ' Prompt for the lines to fillet

                Dim peo As New PromptEntityOptions(vbLf &amp;amp; "Select first line:")
                peo.SetRejectMessage(vbLf &amp;amp; "Select line only")

                peo.AddAllowedClass(GetType(Line), True)

                Dim per As PromptEntityResult = ed.GetEntity(peo)

                If per.Status &amp;lt;&amp;gt; PromptStatus.OK Then

                    Return
                End If

                Dim fid As ObjectId = per.ObjectId

                peo.SetRejectMessage(vbLf &amp;amp; "Select arc only")

                peo.AddAllowedClass(GetType(Arc), True)

                peo.Message = vbLf &amp;amp; "Select arc:"

                per = ed.GetEntity(peo)

                If per.Status &amp;lt;&amp;gt; PromptStatus.OK Then

                    Return
                End If

                Dim sid As ObjectId = per.ObjectId

                Dim ids As ObjectId() = New ObjectId(1) {}

                ids(0) = fid

                ids(1) = sid

                Dim obj1 As DBObject = tr.GetObject(fid, OpenMode.ForWrite)

                Dim obj2 As DBObject = tr.GetObject(sid, OpenMode.ForWrite)

                Autodesk.AutoCAD.ApplicationServices.Application.SetSystemVariable("FILLETRAD", rad)

                Autodesk.AutoCAD.ApplicationServices.Application.SetSystemVariable("CMDECHO", 0)

                Dim buf As New ResultBuffer()

                buf.Add(New TypedValue(5005, "_FILLET"))

                buf.Add(New TypedValue(5006, fid))

                buf.Add(New TypedValue(5006, sid))

                acedCmd(buf.UnmanagedObject)

                buf.Dispose()

                Autodesk.AutoCAD.ApplicationServices.Application.SetSystemVariable("CMDECHO", 1)

                tr.Commit()

            Catch ex As Autodesk.AutoCAD.Runtime.Exception
                ed.WriteMessage(ex.Message + vbLf + ex.StackTrace)
            End Try
        End Using
    End Sub&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;~'J'~&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jul 2010 14:23:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-fillet-line-and-arc/m-p/2721961#M64645</guid>
      <dc:creator>Hallex</dc:creator>
      <dc:date>2010-07-20T14:23:22Z</dc:date>
    </item>
    <item>
      <title>Re: how to fillet line and arc?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-fillet-line-and-arc/m-p/2721991#M64646</link>
      <description>&lt;P&gt;thanks,&lt;/P&gt;&lt;P&gt;i'll study that and see what i can use&lt;/P&gt;&lt;P&gt;mark&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jul 2010 14:43:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-fillet-line-and-arc/m-p/2721991#M64646</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-07-20T14:43:36Z</dc:date>
    </item>
    <item>
      <title>Re: how to fillet line and arc?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-fillet-line-and-arc/m-p/2725049#M64647</link>
      <description>&lt;P&gt;am i overthinking this?&lt;/P&gt;&lt;P&gt;i have two arcs (concentric)&lt;/P&gt;&lt;P&gt;they happen to be lying horiz&amp;nbsp;(like a smile)&lt;/P&gt;&lt;P&gt;on either end are two lines connecting the endpoints of the concentric arcs&lt;/P&gt;&lt;P&gt;like a big open smile (so we have 2 arcs and 2 lines)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i need&amp;nbsp;to programatically offset the two arcs by distance a and offset the two lines by distance b "away from the center of the smile"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;then i need to rejoin the new arcs and new&amp;nbsp;lines in a bigger smile (enclosing the original "smile")&lt;/P&gt;&lt;P&gt;this is appearing to take a huge amount of calculating "who is closest to who" and if i need to adjust start or end points&lt;/P&gt;&lt;P&gt;even&amp;nbsp;calculating which direction to offset each arc and each line takes several calcs to decide whether it's a positive distance or negative distance in order to go "away from the center of the smile", not "toward the center of the smile"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;is there an easier way to do this?&lt;/P&gt;&lt;P&gt;the pseudo code at this point seems like&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;is line1 closer to arc1 startpoint or endpoint?&lt;/P&gt;&lt;P&gt;is line2 closer to arc1 startpoint or endpoint?&lt;/P&gt;&lt;P&gt;is line1 closer to arc2 startpoint or endpoint?&lt;/P&gt;&lt;P&gt;is line2 closer to arc2 startpoint or endpoint?&lt;/P&gt;&lt;P&gt;since there are two intersections between each arc and each line...&lt;/P&gt;&lt;P&gt;get the two intersections (times 4)&lt;/P&gt;&lt;P&gt;for each pair of intersections&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;is point 1 closer to arc startpoint or endpoint&amp;nbsp;or is point2 closer&lt;/P&gt;&lt;P&gt;&amp;nbsp; whichever is closeest to existing arc is the intersection we want&lt;/P&gt;&lt;P&gt;&amp;nbsp; either arc startangle or arc endangle is adjusted depending on if startpoint or endpoint of arc is closes to new intersection&lt;/P&gt;&lt;P&gt;ditto for each line, which line is closest to which arc&lt;/P&gt;&lt;P&gt;is it startpoint of the line&amp;nbsp;or endpoint of line that is closest to new intersection&lt;/P&gt;&lt;P&gt;&amp;nbsp;etc etc etc&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;has anyone attacked this kind of thing before?&lt;/P&gt;&lt;P&gt;what simple easy method am i not thinking of?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;mark&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>Thu, 22 Jul 2010 20:38:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-fillet-line-and-arc/m-p/2725049#M64647</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-07-22T20:38:16Z</dc:date>
    </item>
    <item>
      <title>Re: how to fillet line and arc?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-fillet-line-and-arc/m-p/2725191#M64648</link>
      <description>&lt;P&gt;I'm not responding to this because you chose the 'thousand words' rather than the picture.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jul 2010 00:08:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-fillet-line-and-arc/m-p/2725191#M64648</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-07-23T00:08:07Z</dc:date>
    </item>
    <item>
      <title>Re: how to fillet line and arc?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-fillet-line-and-arc/m-p/2725223#M64649</link>
      <description>&lt;P&gt;one of my many defects&lt;/P&gt;&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;thankyou for such an eloquent chastisment&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jul 2010 01:34:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-fillet-line-and-arc/m-p/2725223#M64649</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-07-23T01:34:09Z</dc:date>
    </item>
    <item>
      <title>Re: how to fillet line and arc?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-fillet-line-and-arc/m-p/2725255#M64650</link>
      <description>&lt;P&gt;based on the drawings attached to the other reply...i'm trying to divide and conquer&lt;/P&gt;&lt;P&gt;so since each arc and each line have two intersections i'm trying to find the "close" one&lt;/P&gt;&lt;P&gt;given a pointlist (in this case of two points, but i think this allows any number of points) which point is closest to the arc (either to the startpoint or the end point)&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;i'm working on trying to test this and see if it works. but does the concept even look close?&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Private Function GetClosestIntersectionToOrigArc(ByVal ListOfPoints As Object, ByVal oarc As AcadArc) As Double()&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Dim arcstart As Point3d&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim arcEnd As Point3d&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim Testpoint As Point3d&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim NewPointList() As Double&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim NewStartPoint(0 To 2) As Double&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;arcstart = DirectCast(oarc.StartPoint, Point3d)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcEnd = DirectCast(oarc.EndPoint, Point3d)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;NewPointList = CType(ListOfPoints, Double())&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'because IntersectWith can return multiple intersections we have to find which is closest to original arc&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'it's either closest to arcstart or arcend&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim i As Short&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim colPoints As New Collection&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'if the array isn't multiple of 3 we're hosed&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'collect individual points from the list&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; For i = 0 To UBound(NewPointList) Step 3&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NewStartPoint(0) = NewPointList(i)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NewStartPoint(1) = NewPointList(i + 1)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NewStartPoint(2) = NewPointList(i + 2)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; colPoints.Add(NewStartPoint)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Next&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim dTestDist As Double&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim currentClosePoint As Object = Nothing&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim dCurrentLeastDist As Double&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; For i = 1 To colPoints.Count&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NewStartPoint = colPoints.Item(i)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'convert to point3d so i can use .Distance&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Testpoint = DirectCast(DirectCast(NewStartPoint, Object), Point3d)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If arcstart.DistanceTo(Testpoint) &amp;lt; arcEnd.DistanceTo(Testpoint) Then 'test point is close to start&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dTestDist = arcstart.DistanceTo(Testpoint)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If dTestDist &amp;lt; dCurrentLeastDist Then&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dCurrentLeastDist = dTestDist&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; currentClosePoint = DirectCast(Testpoint, Object)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Else 'end is closer to testpoint&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dTestDist = arcEnd.DistanceTo(Testpoint)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If dTestDist &amp;lt; dCurrentLeastDist Then&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dCurrentLeastDist = dTestDist&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; currentClosePoint = DirectCast(Testpoint, Object)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Next&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'cast object to double array&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Return DirectCast(currentClosePoint, Double())&lt;BR /&gt;&amp;nbsp; End Function&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jul 2010 03:04:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-fillet-line-and-arc/m-p/2725255#M64650</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-07-23T03:04:44Z</dc:date>
    </item>
    <item>
      <title>Re: how to fillet line and arc?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-fillet-line-and-arc/m-p/2725389#M64651</link>
      <description>&lt;P&gt;No, I would probably just replace the objects with new ones.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jul 2010 09:38:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-fillet-line-and-arc/m-p/2725389#M64651</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-07-23T09:38:29Z</dc:date>
    </item>
    <item>
      <title>Re: how to fillet line and arc?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-fillet-line-and-arc/m-p/2725545#M64652</link>
      <description>&lt;P&gt;right but to replace or adjust existing i still need&amp;nbsp;the same information (i think???),&lt;/P&gt;&lt;P&gt;i still have to figure out which intersection of the two is the right one for every combination. arc1 line1, arc1 line2, arc2 line1, arc 2 line2, each of which pair have two intersections.(8 points)&lt;/P&gt;&lt;P&gt;i dont' think i&amp;nbsp; can depend on it always being the first one in the returned list of points from IntersectWith.&lt;/P&gt;&lt;P&gt;&amp;nbsp;and i have to find out if the interseciton is start point or end point for the new arc or line&amp;nbsp;(which i think means 8^2 combinations?)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;perhaps you're saying, if i create new arc/line i can disregard direction of origninal arc(which is start and which is endpoint) - which would eliminate on level of testing...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;in my present case that probably wouldn't matter but in some application it might?&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jul 2010 13:21:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-fillet-line-and-arc/m-p/2725545#M64652</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-07-23T13:21:43Z</dc:date>
    </item>
    <item>
      <title>Re: how to fillet line and arc?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-fillet-line-and-arc/m-p/2725551#M64653</link>
      <description>&lt;P&gt;Your problem doesn't entirely make sense, because you are starting with&lt;/P&gt;&lt;P&gt;a very specific set of objects (two concentric arcs and two lines that&lt;/P&gt;&lt;P&gt;pass through the center of the arcs).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If that is the constraint, you don't really need to figure out very much&lt;/P&gt;&lt;P&gt;at all.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your problem is being complicated by the fact that you're using the&lt;/P&gt;&lt;P&gt;API to try to 'edit' existing objects when it is far easier to just replace&lt;/P&gt;&lt;P&gt;them with new objects using the parameters derived from the ones&lt;/P&gt;&lt;P&gt;being replaced.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jul 2010 13:27:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-fillet-line-and-arc/m-p/2725551#M64653</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-07-23T13:27:03Z</dc:date>
    </item>
  </channel>
</rss>

