Jump to content

Fillet Parallel Lines


David Bethel

Recommended Posts

Greetings!

 

I need to make a routine that will add an ARC segement to connect 2 parallel lines

based on:

 

  • Pick 2 parallel LINEs - basic error trapping of lines
  • Create an ARC with radius of 1\2 of the prependiclar distance of the lines
  • Center the ARC half way between the LINE endpoints
  • Trim the LINE end points to start / end of the ARC

 

Since ACAD will not fillet 2 parallel lines, this turned out to bit of a challenge to make it act like the _.Fillet command

 

I'm having to add the rotate arc query due to inconsistant results. Finding the start and end angles seemed simple enough, but it's not that easy

 

I showing some consturction / calculations temp lines I've used

 

Green Line - Midpoint = Center Point Of the arc

Yelow And Red - Predpidicular to end points of the line

Blue And Cyan - Arc center to ARC endpoints

 

What I have now is very very musg of a kludge. Any thoughts would be appreciated !


(defun c:fend (/ l1 l2 s1 s2
               p10 p11 p20 p21 e1 e2 p1 p2 em1 em2 la
               sp ep sa ea mp ra pt1 pt2 pp1 pp2 zl pe1 pe2
               )

 (princ "\nSelect 2 Parallel Lines")
 (while (not l1)
        (while (not s1)
               (setq s1 (entsel "\nSelect 1st Line:   ")))
        (setq p1 (nth 1 s1)
              ep (car s1))
        (if (= "LINE" (cdr (assoc 0 (entget ep))))
            (setq l1 ep)))
 (setq pe1 (osnap p1 "end"))
 (redraw l1 3)

 (while (not l2)
        (while (not s2)
               (setq s2 (entsel "\nSelect 2nd Line:   ")))
        (setq p2 (nth 1 s2)
              ep (car s2))
        (if (= "LINE" (cdr (assoc 0 (entget ep))))
            (setq l2 ep)))
 (setq pe2 (osnap p2 "end"))
 (redraw l2 3)

 (setq e1 (entget l1)
       e2 (entget l2)
       p10 (cdr (assoc 10 e1))
       p11 (cdr (assoc 11 e1))
       p20 (cdr (assoc 10 e2))
       p21 (cdr (assoc 11 e2)))

;;;COMPARE LINE ANGLES
 (if (not (or (equal (angle p10 p11) (angle p20 p21) 1e-
              (equal (angle p10 p11) (angle p21 p20) 1e-))
      (progn
        (alert "Lines Are Not Parallel")
        (exit)))

;;;COMPARE LINE ELEVATIONS
 (setq zl (mapcar 'caddr (list p10 p11 p20 p21)))
 (if (apply '/= zl)
     (progn
        (alert "Lines Are Not Equal Elevation")
        (exit)))

;;;COMPARE LINE UCS
 (if (not (equal (cdr (assoc 210 e1)) (cdr (assoc 210 e2)) 1e-)
     (alert "Lines Are Not Same UCS - Be Careful"))

;;;CLOSEST ENDS TO 1ST PICK POINT
 (if (< (distance p10 p1) (distance p11 p1))
     (setq pt1 p10 em1 10 la (angle p11 p10))
     (setq pt1 p11 em1 11 la (angle p10 p11)))
 (if (< (distance p20 pt1) (distance p21 pt1))
     (setq pt2 p20 em2 10)
     (setq pt2 p21 em2 11))
 (grdraw pt1 pt2 3 0)

;;;PERPINDICULAR POINTS
 (setq pp1 (inters p10 p11 pt2 (polar pt2 (+ (angle p10 p11) (* pi 0.5)) 1) nil))
 (setq pp2 (inters p20 p21 pt1 (polar pt1 (+ (angle p10 p11) (* pi 0.5)) 1) nil))
 (grdraw pt1 pp2 1 0)
 (grdraw pt2 pp1 2 0)

 (setq mp (mapcar '(lambda (a b) (* (+ a b) 0.5)) pt1 pt2)
       ra (* (distance pt1 pp2) 0.5)
       sa (angle pt1 pp2)     ;;;!!!Here is the problem child
       ea (+ sa pi)
       sp (polar mp sa ra)
       ep (polar mp ea ra))

 (entmake (list (cons 0 "ARC")
                (assoc 8 e1)
                (cons 10 mp)
                (cons  6 (if (assoc  6 e1) (cdr (assoc  6 e1)) "BYLAYER"))
                (cons 39 (if (assoc 39 e1) (cdr (assoc 39 e1)) 0))
                (cons 62 (if (assoc 62 e1) (cdr (assoc 62 e1)) 256))
                (cons 40 ra)
                (cons 50 sa)
                (cons 51 ea)))

 (grdraw sp mp 4 0)
 (grdraw ep mp 5 0)

;;;TRIM THE LINES
 (entmod (subst (cons em1 ep) (assoc em1 e1) e1))
 (entmod (subst (cons em2 sp) (assoc em2 e2) e2))

;;FIX THEN BUG
 (initget "Yes No")
 (if (= "Yes" (getkword "\nRotate The ARC 180 Degrees? <N>:   "))
     (command "_.ROTATE" (entlast) "" mp 180.0))

 (redraw)

 (prin1))

 

-David

FILETEND.gif

Link to comment
Share on other sites

  • Replies 20
  • Created
  • Last Reply

Top Posters In This Topic

  • David Bethel

    6

  • Jack_O'neill

    5

  • alanjt

    2

  • StevJ

    2

Top Posters In This Topic

Posted Images

I dunno which version you're using David, but 2010 fillets parallel lines...use a radius of zero and it pops it right in

 

edit--checked my 2007 machine, it does it, and so does Bricscad.

 

I draw slots using that method all the time.

Link to comment
Share on other sites

Wow,

 

I didn't think to check newer releases. R12 won't do it. R13+ will do it. I guess that's 1 feature that I would have found valuable. So I'll have to go with what I have ( plain autolisp ) Thanks -David

Link to comment
Share on other sites

Hi David, i've tried to use your rountine, but it always stop in step choose Line 1, so... :(

 

 

It is looking for a simple line, not a polyline. Possibly that is the problem.

Link to comment
Share on other sites

use a radius of zero and it pops it right in

 

Kinda cumbersome to always be changing the fillet radius.

Alternate method is to hold down the SHIFT key after issuing the fillet command to fillet those pesky parallel lines.

 

Steve

Link to comment
Share on other sites

Kinda cumbersome to always be changing the fillet radius.

Alternate method is to hold down the SHIFT key after issuing the fillet command to fillet those pesky parallel lines.

 

Steve

 

Actually, you don't even have to do that. I forgot, but on parallel lines, the radius will temporarily adjust no matter what it's set at. Old habits die hard. I use a lot of fillets when drawing new extrusions, and they are always changing so I don't give a second thought to changing them.

Link to comment
Share on other sites

Wow, AutoCAD release 12? Wasn't that a DOS version? I started with release 11 myself, but that was a long time ago. Release 12 was a good one as I recall though.

Link to comment
Share on other sites

Wow, AutoCAD release 12? Wasn't that a DOS version? I started with release 11 myself, but that was a long time ago. Release 12 was a good one as I recall though.

 

Yea, I still use R12DOS on a Win98SE machine. I have tons of things that are based on R12 plotting and production compatibilities. It is really fast on a 2GHz machine. Just not real stable ( win98 sucked in it's memory management ).

 

1 day I will probably have to go kicking and screaming into a new release. Just not yet. -David

Link to comment
Share on other sites

Actually' date=' you don't even have to do that. I forgot, but on parallel lines, the radius will temporarily adjust no matter what it's set at.[/quote']

 

Thanks for the tip. That's even better!

 

Steve

Link to comment
Share on other sites

Yea, I still use R12DOS on a Win98SE machine. I have tons of things that are based on R12 plotting and production compatibilities. It is really fast on a 2GHz machine. Just not real stable ( win98 sucked in it's memory management ).

 

1 day I will probably have to go kicking and screaming into a new release. Just not yet. -David

 

R14 was a good product. Had to be, after that fiasco with 13. They got it right on that one. 2007 is a very good version, I have a copy of that (well, ADT2007) that still gets used a lot. I also have 2010 and I really think it's my favorite of the bunch. 07 and 10 both just sit there and work, never give me any crap. Both do what I need, both are running on XP machines, and I can't tell you the last time either of them crashed. The 2010 machine will run for days at a time (provided the power stays on) sometimes without ever being rebooted.

Link to comment
Share on other sites

R14 was a good product. Had to be' date=' after that fiasco with 13. They got it right on that one. 2007 is a very good version, I have a copy of that (well, ADT2007) that still gets used a lot. I also have 2010 and I really think it's my favorite of the bunch. 07 and 10 both just sit there and work, never give me any crap. Both do what I need, both are running on XP machines, and I can't tell you the last time either of them crashed. The 2010 machine will run for days at a time (provided the power stays on) sometimes without ever being rebooted.[/quote']

r14 was fantastic. I really liked '06 and love 2011.

Link to comment
Share on other sites

r14 was fantastic. I really liked '06 and love 2011.

I missed 06. Between changing jobs and even getting completely out of if for a couple of years, I jumped from 14 to 2000i (was not impressed), to 2002 and 2004. Then to 2007 (liked it so much I bought my own), then didn't use any of them between there and 2010 except for about 2 weeks of 08 usage. The company I was at then was on 2004 and they negotiated an upgrade from there to 08 (they had lots and lots of seats), then farted around and didn't do it. Couple of my friends that still work there say that they were gradually replacing their 04's with 10's till the business took a little slide. Now they have some 04's, some 10's and a couple of the managers who don't even know how to draw a line have 11.

Link to comment
Share on other sites

I know it sounds kind of crazy, but R13 runs rock steady on Win-7. I just did 3 days of rendering ( 5,000+ frames ) animation frames without a bump. Now when it first came out, R13 vacuumed. Now it's the only old version that will run on Win-7-64. You have to get to beyond at least A2K in order to install anything. Go figure...... -David

Link to comment
Share on other sites

I know it sounds kind of crazy, but R13 runs rock steady on Win-7. I just did 3 days of rendering ( 5,000+ frames ) animation frames without a bump. Now when it first came out, R13 vacuumed. Now it's the only old version that will run on Win-7-64. You have to get to beyond at least A2K in order to install anything. Go figure...... -David

 

After about the 4th or 5th patch, 13 was good to go. My error was buying it as soon as it was available. R13c1 was a complete mess. I got the first patch in the mail before the program discs arrived, so I knew I was in trouble. Dialog boxes would open, you'd do whatever, then hit ok, it would close and open right back up again. You could hit cancel or ok 100 times and it they would just keep popping back up. It would crash about every 15 minutes, whether you were using it or not. Leave the program running while you went to break, it would have crashed by the time you got back. When 14 came out and the dealer called trying to peddle it, I told him "Oh [expletive omitted] no...never again. I just got the last "upgrade" working, and am not about to go through that again!" It took him almost a year to get me to even try it. We even had a couple dealers bring in a few other products and thought seriously about switching, but decided against it because at the time no body out there had a product that would import dwgs correctly and we had about 30,000 legacy drawings. Nearly all of our customers used Autocad too, and it made it easier to work with them,so we stayed with it. Dang near jumped off the SS Autodesk boat though.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...