.NET

Reply
Valued Contributor
mpropst
Posts: 62
Registered: ‎06-21-2010
Message 1 of 25 (1,066 Views)

how to fillet line and arc?

1066 Views, 24 Replies
07-19-2010 09:25 PM

is there a way to do that programatically? fillet a line and arc

Valued Mentor
caddzone
Posts: 305
Registered: ‎01-26-2005
Message 2 of 25 (1,066 Views)

Re: how to fillet line and arc?

07-19-2010 09:42 PM in reply to: mpropst

Yes, but not directly. You have to find the intersection points and then

calculate the new endpoints, and either replace the existing entities with

new ones, or manipulate the existing ones using the methods of the

Curve class (e.g, Extend(), GetSplitCurves(), and so on).

 

 



AcadXTabs for AutoCAD
Supporting AutoCAD 2000-2011


*Expert Elite*
Hallex
Posts: 1,569
Registered: ‎10-08-2008
Message 3 of 25 (1,056 Views)

Re: how to fillet line and arc?

07-20-2010 03:54 AM in reply to: mpropst

Try CommandLine class from there:

 

http://www.caddzone.com/CommandLine.cs

 

it's likes me more :smileyhappy:

 

~'J'~

_____________________________________
C6309D9E0751D165D0934D0621DFF27919
Valued Contributor
mpropst
Posts: 62
Registered: ‎06-21-2010
Message 4 of 25 (1,045 Views)

Re: how to fillet line and arc?

07-20-2010 05:58 AM in reply to: Hallex

l'll try and figure how to use a c# class in a vbnet app.

the manual calcs are making me feel stupid

:-)

*Expert Elite*
Hallex
Posts: 1,569
Registered: ‎10-08-2008
Message 5 of 25 (1,044 Views)

Re: how to fillet line and arc?

07-20-2010 06:03 AM in reply to: mpropst

Sorry, I don't knew that you use VB.NET

 

Try handle this class instead:

 

http://www.caddzone.com/CommandLine.vb

 

~'J'~

_____________________________________
C6309D9E0751D165D0934D0621DFF27919
Valued Contributor
mpropst
Posts: 62
Registered: ‎06-21-2010
Message 6 of 25 (1,044 Views)

Re: how to fillet line and arc?

07-20-2010 06:10 AM in reply to: caddzone

hmmm, i'm not seeing it

i imported .Geometry

 

Dim oCurve As Curve2d
'cast arc to curve

    oCurve = CType(oArc3, Curve2d)

I don't get an .Extend method on the oCurve object

what am i missing?

(other than a brain)

:-)

thanks

mark

 

Valued Contributor
mpropst
Posts: 62
Registered: ‎06-21-2010
Message 7 of 25 (1,041 Views)

Re: how to fillet line and arc?

07-20-2010 06:17 AM in reply to: Hallex

oh, thanks

Valued Contributor
mpropst
Posts: 62
Registered: ‎06-21-2010
Message 8 of 25 (1,039 Views)

Re: how to fillet line and arc?

07-20-2010 06:23 AM in reply to: Hallex

Do you have a sample of it's use?

i'll search this group too.

*Expert Elite*
Hallex
Posts: 1,569
Registered: ‎10-08-2008
Message 9 of 25 (1,037 Views)

Re: how to fillet line and arc?

07-20-2010 06:26 AM in reply to: mpropst

I have already wrote similar one few moons ago

Still searching in my codes but with no luck yet :smileysad:

 

~'J'~

 

_____________________________________
C6309D9E0751D165D0934D0621DFF27919
*Expert Elite*
Hallex
Posts: 1,569
Registered: ‎10-08-2008
Message 10 of 25 (1,031 Views)

Re: how to fillet line and arc?

07-20-2010 06:55 AM in reply to: mpropst

Huray, have found it in my garbage

Unfortunatelly it's on C# only

I'm pretty sure you could rewrite the code on VB.NET

(change AllowedType to arc and line)

 

        /// <summary>
        ///                     * FILLET LINES *
        /// </summary>
        [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);
                }
            }
        }

 

~'J'~

_____________________________________
C6309D9E0751D165D0934D0621DFF27919
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.