Fillet command where two lines meet at the same coordinates

Fillet command where two lines meet at the same coordinates

craig-s-sunderland
Enthusiast Enthusiast
4,895 Views
34 Replies
Message 1 of 35

Fillet command where two lines meet at the same coordinates

craig-s-sunderland
Enthusiast
Enthusiast

Good evening

I have two lines being drawn via lisp and the calculated coordinates that one end of each of the lines meet needs to be filleted.

 

Sadly I haven't got this working yet as when specifying the same coordinates twice in the command (first and second selection) results in an error specifying I am trying to fillet the same entity twice...

 

Could one of the experts shed some light on where I have gone wrong?

 

 

4,896 Views
34 Replies
Replies (34)
Message 2 of 35

dbroad
Mentor
Mentor

Post the code.

Architect, Registered NC, VA, SC, & GA.
0 Likes
Message 3 of 35

Moshe-A
Mentor
Mentor

@craig-s-sunderland hi,

 

we are talking about FILLET command, yes?!

 

you can not pick the 2 lines pointing on the same point. you always will end up with 1 result.

instead use the meeting point to offset back along the lines to their other point.

 

here is a quick sample i made to show you how it should work:

 

enjoy

moshe

 

(defun c:FL (/ ss e1 e2 p1 p2 p3 p4 p_int p_1st p_2nd)
 (if (setq ss (ssget '((0 . "line")))) ; pick 2 lines
  (progn
   (setq e1 (entget (ssname ss 0)) e2 (entget (ssname ss 1)))
   (setq p1 (cdr (assoc '10 e1)) p2 (cdr (assoc '11 e1)))
   (setq p3 (cdr (assoc '10 e2)) p4 (cdr (assoc '11 e2)))

   (if (setq p_int (inters p1 p2 p3 p4 nil)); if lines intersect?
    (progn
; find the point close to intersect point for first line
; and pick the point to be select (if (< (distance p1 p_int) (distance p2 p_int)) (setq p_1st (polar p1 (angle p1 p2) (/ (distance p1 p2) 3))) (setq p_1st (polar p2 (angle p2 p1) (/ (distance p2 p1) 3))) )      ; find the point close to intersect point for second line
     ; and pick the point to be select
(if (< (distance p3 p_int) (distance p4 p_int)) (setq p_2nd (polar p3 (angle p3 p4) (/ (distance p3 p4) 3))) (setq p_2nd (polar p4 (angle p4 p3) (/ (distance p4 p3) 3))) ) (command "._fillet" "_radius" 0 "._fillet" "_none" (osnap p_1st "_nea") "_none" (osnap p_2nd "_nea")) ); progn ); if ); progn ); if (princ) )
0 Likes
Message 4 of 35

Kent1Cooper
Consultant
Consultant

@craig-s-sunderland wrote:

Good evening

I have two lines being drawn via lisp and the calculated coordinates that one end of each of the lines meet needs to be filleted.

 

... when specifying the same coordinates twice in the command (first and second selection) results in an error ....


 

If you know the point at which they meet [I assume you do, if you're picking there twice to Fillet them], can you just draw them to there in the first place, and eliminate the need to Fillet?

 

If not, and if the ends closer to the meeting point are always the ones that need to change, another approach would be to use not Fillet but the CHANGE command, give it the two Lines, and give it the meeting point -- it will put the closer end of each at that point.  If the Lines may not always be orthogonal, make sure ORTHO mode is off  when you do it, because if that's on, they'll be forced to orthogonal orientation in the process [with the farther end staying in place].

Kent Cooper, AIA
0 Likes
Message 5 of 35

craig-s-sunderland
Enthusiast
Enthusiast

Hi, thanks for responding.

 

I am wondering if there is a way to specify which object I want to pull the coordinates from i.e.

"line one - 400,300" "line two - 400,300" in order to pass it along that way?

 

Two lines:

1 (400,100) (400,300)

2 (400,300) (560,300)

 

the command within the lisp routine is the following: (I've replaced the variables with the actual radius and coordinates).

(command "_.fillet" "r" "10" "" "400,300" "" "400,300")
0 Likes
Message 6 of 35

craig-s-sunderland
Enthusiast
Enthusiast

My apologies, from the answers, it seems my explanation of what I am wanting isn't as clear as it could be.

I am wanting to create a radius fillet on these corners regardless of the angle of intersection.

 

I have already created the lisp routine that lands the ends of the lines where I want the intersection to be from pre-defined variables. All I want to do is get that lovely rounded corner 🙂

0 Likes
Message 7 of 35

craig-s-sunderland
Enthusiast
Enthusiast

Hi Moshe, thank you for your offering here, I do however have absolutely no idea whatsoever what your code does...

 

I must admit I am still extremely new to this lisp stuff (less than 48 hours in...) so half of my battle is knowing what question to ask in order tonget the andwer I need 😞

0 Likes
Message 8 of 35

Kent1Cooper
Consultant
Consultant

@craig-s-sunderland wrote:

....

I am wanting to create a radius fillet on these corners regardless of the angle of intersection.

 

I have already created the lisp routine that lands the ends of the lines where I want the intersection to be from pre-defined variables. All I want to do is get that lovely rounded corner 🙂


 

Ah, a non-zero radius....  If you post the code that creates the Lines, someone can surely show you how to calculate points on them that are not  at their common endpoint [for example, the midpoint of each], so that a Fillet command would work, provided you can be confident that there won't be something else there that the routine could "see" instead of the Line you want.  Or likewise if the Lines' entity names are stored in variables, without even seeing the code that draws them.

Kent Cooper, AIA
0 Likes
Message 9 of 35

devitg
Advisor
Advisor

please show your lisp, and sample dwg, with a before and after. 

0 Likes
Message 10 of 35

DannyNL
Advisor
Advisor

Try this.

Example: (FilletLines '(200.0 150.0)  25)

 

(defun FilletLines (FL_SelectPoint FL_Radius / FL_SelectPoint FL_Selection FL_OldVars FL_VarList)
   (if
      (and
         (numberp FL_Radius)
         (listp FL_SelectPoint)
         (not (vl-some 'not (mapcar 'numberp FL_SelectPoint)))
         (or
            (= (length FL_SelectPoint) 2)
            (= (length FL_SelectPoint) 3)
         )
         (setq FL_Selection (ssget "C" FL_SelectPoint FL_SelectPoint '((0 . "LINE"))))
         (= (sslength FL_Selection) 2)
      )
      (progn
         (vla-StartUndoMark (vla-get-ActiveDocument (vlax-get-acad-object)))
         (setq FL_OldVars (mapcar 'getvar (setq FL_VarList '("CMDECHO" "OSMODE" "FILLETRAD"))))
         (mapcar 'setvar FL_VarList (list 0 0 FL_Radius))
         (vl-cmdf "_.FILLET" (ssname FL_Selection 0) (ssname FL_Selection 1))
         (mapcar 'setvar FL_VarList FL_OldVars)
         (vla-EndUndoMark (vla-get-ActiveDocument (vlax-get-acad-object)))
      )
   )
   (princ)
)
0 Likes
Message 11 of 35

craig-s-sunderland
Enthusiast
Enthusiast

Here is the code as per request. I hope it makes sense...

 

(defun C:Rct1Slot( / hr hr1 vr vr1 TL BR slw slw1 slh TL TR BL BR A1 A2 B1 B2 R1)
  (setq
    hr (getdist "\nOutside Horizontal (mm): ")
    hr1 (/ hr 2)
    vr (getdist "\nOutside Vertical (mm): ")
    vr1 (/ vr 2)
    slw (getdist "\nSlot Width (mm): ")
    slw1 (/ slw 2)
    slh (getdist "\nSlot Height (mm): ")
    slp (getdist "\nSlot Center to Right Edge (mm): ")
    TL (list (- 0 hr1) vr1)
    TR (list hr1 vr1)
    BL (list (- 0 hr1) (- 0 vr1))
    BR (list hr1 (- 0 vr1))
    A1 (list (- hr1 (+ slp slw1)) (- 0 vr1))
    A2 (list (- hr1 (+ slp slw1)) (- 0 (- vr1 slh)))
    B1 (list (- hr1 (- slp slw1)) (- 0 vr1))
    B2 (list (- hr1 (- slp slw1)) (- 0 (- vr1 slh)))
    R1 (list (- hr1 slp) (+ (- 0 vr1) slh))
    osm (getvar 'osmode)
  )
  (setvar 'osmode 0)	
  (command "_.Line" "_non" TL TR "")
  (command "_.Line" "_non" TR BR "")
  (command "_.Line" "_non" BR B1 "")
  (command "_.Line" "_non" B1 B2 "")
  (command "_.Line" "_non" A2 A1 "")
  (command "_.Line" "_non" A1 BL "")
  (command "_.Line" "_non" BL TL "")
  (command "_.arc" B2 "_c" R1 A2)
  (setvar 'osmode osm)
  (princ)
)
0 Likes
Message 12 of 35

dbhunia
Advisor
Advisor

There is different way..... But you can try this like.....(I considered that you want to fillet all lines)

 

..........................
  (setvar 'osmode 0)	
  (setq add (ssadd))
  (command "_.Line" "_non" TL TR "")
  (ssadd (entlast) add)
  (command "_.Line" "_non" TR BR "")
  (ssadd (entlast) add)
  (command "_.Line" "_non" BR B1 "")
  (ssadd (entlast) add)
  (command "_.Line" "_non" B1 B2 "")
  (ssadd (entlast) add)
  (command "_.Line" "_non" A2 A1 "")
  (ssadd (entlast) add)
  (command "_.Line" "_non" A1 BL "")
  (ssadd (entlast) add)
  (command "_.Line" "_non" BL TL "")
  (ssadd (entlast) add)
  (command "_.pedit" "_m" add "" "_y" "_j" 0.0 "")
  (command "fillet" "_P" "_R" 30 (entlast));;here 30 is taken as fillet radious take it as user input
  (command "explode" (entlast))
(command "_.arc" B2 "_c" R1 A2) (setvar 'osmode osm) .....................

 


Debashis Bhunia
Co-Founder of Geometrifying Trigonometry(C)
________________________________________________
Walking is the First step of Running, Technique comes Next....
0 Likes
Message 13 of 35

craig-s-sunderland
Enthusiast
Enthusiast

Hi, this works brilliantly on that one type of drawing using only a single radius, thank you for that!

 

Sadly it all goes out of the window when I need to be able to specify 2 radius (internal and external) within the drawing.ybar.jpg

 

As you can see, the majority of the code works as expected and creates lines that intersect with each other as I want them.

 

(However terminating the lines at the ID would be ideal!!)

 

The two lines meeting at points A, D, B, E, F, G, H, I, J, L would be internal rad, and the two remaining points C and K would be external rads.

 

As always, pointers, hits, tips, always appreciated.

0 Likes
Message 14 of 35

dbroad
Mentor
Mentor

Thanks for posting your code. Without it, everyone is just reading into your question what they want and so the discussion can't focus on what you actually need.  I ran your code and it seems to work fine.  All the linework you have is horizontal and vertical so it's hard to understand your requested needs to fillet with lines that meet in any direction in the context of your code.

Where would you integrate the fillet commands you need?

Which corners do you need to fillet?

 

IMO, it's better to code what you need to create the tangent arcs rather than use the fillet command since there are so many dependencies in the fillet command (side you pick on, object snap interferences, other overlapping geometry, etc).  Start by sketching the bounding lines on paper and assess the geometry of the situation. Use trig to help you identify starting and ending points with respect to actual intersections.  Surveying texts are good sources for these kinds of things.

Architect, Registered NC, VA, SC, & GA.
0 Likes
Message 15 of 35

craig-s-sunderland
Enthusiast
Enthusiast

Hi and thank you for your input, as you can see from my previous post, I have marked out which points I would like to see a fillet.

I am interested in your tan arc idea, I am assuming from this that I would use similar calculations in order to produce a tan arc, but I cannot seem to find any reference to this.

0 Likes
Message 16 of 35

devitg
Advisor
Advisor

please show your lisp, and sample dwg, with a before and after. 

 

Sad to say ACAD CAN NOT EDIT IMAGES

 

 

0 Likes
Message 17 of 35

Kent1Cooper
Consultant
Consultant

@craig-s-sunderland wrote:

.... I need to be able to specify 2 radius (internal and external) within the drawing. ....


 

If you can have the things drawn as a Polyline, instead of Lines [or join them into Polylines as in an earlier suggestion], maybe you can steal some stuff from FilletPlineVert.lsp, >here<.  It Fillets a Polyline corner by single selection at the corner.  You could eliminate a lot of it [the User selection, the option to pick away from a corner and have it Fillet the adjacent segments on either side, etc.] if you can build in the locations.

Kent Cooper, AIA
0 Likes
Message 18 of 35

craig-s-sunderland
Enthusiast
Enthusiast

Thank you again for your input, could you please tell me what the difference is between lines and polylines?

0 Likes
Message 19 of 35

devitg
Advisor
Advisor

Lines have only 2 points , star-end , Polylines have a lot of point , and arcs. Also It can be a polyline with 2 points.  

Message 20 of 35

Kent1Cooper
Consultant
Consultant

@craig-s-sunderland wrote:

Thank you again for your input, could you please tell me what the difference is between lines and polylines?


Help is your friend.  Read about the LINE and PLINE commands there.

Kent Cooper, AIA