Author Topic: Fillet without modifying 2nd line  (Read 3007 times)

0 Members and 1 Guest are viewing this topic.

notredave

  • Newt
  • Posts: 140
Fillet without modifying 2nd line
« on: March 03, 2020, 02:40:07 PM »
Good afternoon all,

Does anybody know of a lisp routine that fillets with out modifying 2nd fillet line? I am doing wiring diagrams that need modifications and when I add a new wire and fillet, 2nd line fillets and i have to extend 2nd line that was filleted to original point. I hope I haven't confused anyone.

Thank you,
David

Dlanor

  • Bull Frog
  • Posts: 263
Re: Fillet without modifying 2nd line
« Reply #1 on: March 03, 2020, 07:24:38 PM »
Using the current filletrad or asking for a fillet radius? Are the lines lines or polylines or both?

BIGAL

  • Swamp Rat
  • Posts: 1407
  • 40 + years of using Autocad
Re: Fillet without modifying 2nd line
« Reply #2 on: March 03, 2020, 11:23:02 PM »
This has been answered before somewhere need add add ARC.

This is one I had. Needs an update to trim line.





« Last Edit: March 03, 2020, 11:32:50 PM by BIGAL »
A man who never made a mistake never made anything

notredave

  • Newt
  • Posts: 140
Re: Fillet without modifying 2nd line
« Reply #3 on: March 04, 2020, 06:15:01 AM »
Dlanor,
It's a combination of lines and plines.

BIGAL,
If you ever feel like adding that feature, please let me know, lol.

Thank you both for replying,
David

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Fillet without modifying 2nd line
« Reply #4 on: March 04, 2020, 08:35:10 AM »
Here is a very basic solution:
Code: [Select]
(defun c:Test ( / doc elst selMain selSub)
  (setq doc (vla-get-activedocument (vlax-get-acad-object)))
  (vla-endundomark doc)
  (while
    (and
      (setq selMain (entsel "\nSelect main (KEEP) curve or Enter: "))
      (setq selSub (entsel "\nSelect sub curve or Enter: "))
    )
    (vla-startundomark doc)
    (setvar 'cmdecho 0)
    (setq elst (entget (car selMain)))
    (command "_.fillet" selMain selSub)
    (entmod elst)
    (setvar 'cmdecho 1)
    (vla-endundomark doc)
  )
  (princ)
)

notredave

  • Newt
  • Posts: 140
Re: Fillet without modifying 2nd line
« Reply #5 on: March 04, 2020, 09:06:11 AM »
roy_043,
Thank you very much for that. It works great! Is there a way you can make it keep first line selected? When I get this message "Select main (KEEP) curve or Enter:" I have to pick main line to continue on to the next fillet.
Thank you very much,
David

ronjonp

  • Needs a day job
  • Posts: 7527
Re: Fillet without modifying 2nd line
« Reply #6 on: March 04, 2020, 10:42:25 AM »
roy_043,
Thank you very much for that. It works great! Is there a way you can make it keep first line selected? When I get this message "Select main (KEEP) curve or Enter:" I have to pick main line to continue on to the next fillet.
Thank you very much,
David
Enclose this line in (OR selmain)
Code - Auto/Visual Lisp: [Select]
  1. (or selmain (setq selmain (entsel "\nSelect main (KEEP) curve or Enter: ")))
« Last Edit: March 04, 2020, 10:46:36 AM by ronjonp »

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

notredave

  • Newt
  • Posts: 140
Re: Fillet without modifying 2nd line
« Reply #7 on: March 04, 2020, 11:13:03 AM »
ronjonp,
I can't thank you enough, it works great!
Thank you roy_043, dlanor and BIGAL.
You're all awesome gents!
Thanks again,
David

Lee Mac

  • Seagull
  • Posts: 12912
  • London, England
Re: Fillet without modifying 2nd line
« Reply #8 on: March 04, 2020, 02:27:20 PM »
Good solution Roy  :-)

ronjonp

  • Needs a day job
  • Posts: 7527
Re: Fillet without modifying 2nd line
« Reply #9 on: March 04, 2020, 03:20:23 PM »
FWIW I can't get this code to work in AutoCAD 2019 for some reason?

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

tombu

  • Bull Frog
  • Posts: 289
  • ByLayer=>Not0
Re: Fillet without modifying 2nd line
« Reply #10 on: March 04, 2020, 04:34:14 PM »
FWIW I can't get this code to work in AutoCAD 2019 for some reason?
Try adding
Code: [Select]
(setvar 'trimmode 1)Works in 2020.

Nice code roy_043! I modified it to pedit join for my preference.
Code: [Select]
;| Fillet to
by: roy_043
http://www.theswamp.org/index.php?topic=55803.msg598594#msg598594
(or C:Fillet2 (load "Fillet2.lsp"));Fillet2
(load "Fillet2.lsp") Fillet2
=======================================================|;
(defun c:Fillet2 ( / doc elst selMain selSub)
  (setq doc (vla-get-activedocument (vlax-get-acad-object)))
  (vla-endundomark doc)
  (while
    (and
      (setq selMain (entsel "\nSelect main (keep unchanged) curve or Enter: "))
      (setq selSub (entsel "\nSelect curve to fillet to main or Enter: "))
    )
    (vla-startundomark doc)
    (setvar 'trimmode 1)
    (setvar 'peditaccept 1)
    (setvar 'cmdecho 0)
    (setq elst (entget (car selMain)))
    (command "_.fillet" selMain selSub)
    (entmod elst)
(setq ss (ssadd)
  ss (ssadd (car selSub) ss)
  ss (ssadd (entlast) ss)
); setq
    (command "_.pedit" "M" ss "" "J" 0.0 "")
    (setvar 'cmdecho 1)
    (vla-endundomark doc)
  )
  (princ)
)
Tom Beauford P.S.M.
Leon County FL Public Works - Windows 7 64 bit AutoCAD Civil 3D

BIGAL

  • Swamp Rat
  • Posts: 1407
  • 40 + years of using Autocad
Re: Fillet without modifying 2nd line
« Reply #11 on: March 04, 2020, 10:43:12 PM »
I am going down a different path drawing the arc then adjust the end of the pline or line to the arc end point, problem is just that 2 ways to adjust the end. Also is it left or right arc, decided by pick points. Hopefully soon.

This is  ver 1 lines only. Pline to follow.

Code: [Select]
; draws an arc between 2 lines but does not erase
; by Alan H Aug 2015
(defun c:arcfill ( / pt1 pt2 pt3 pt4 pt5 obj1 obj2 obj3 obj4 obj5 obj6 rad)
(setq oldsnap (getvar 'osmode))
(setvar 'Osmode 512)
(setq pt1 (getpoint "\npick 1st line for trim near end"))
(setq obj1 (ssname (ssget pt1) 0))
(setq obj5 (vlax-ename->vla-object obj1))
(setq stpt (vlax-curve-getstartpoint obj5 ))
(setq endpt (vlax-curve-getendpoint obj5))
(setq d1 (distance pt1 stpt))
(setq d2 (distance pt1 endpt))

(setq pt2 (getpoint "\npick 2nd line to remain"))
(setq obj2 (ssname (ssget pt2) 0))
(setq obj6 (vlax-ename->vla-object obj2))

(setq rad (getdist "\nEnter radius"))
(setvar 'osmode 0)
(command "offset" rad Obj1 pt2 "")
(setq obj3 (vlax-ename->vla-object (entlast)))

(command "offset" rad Obj2 pt1 "")
(setq obj4 (vlax-ename->vla-object (entlast)))
(setq pt5 (vlax-invoke obj3 'intersectWith obj4 acExtendThisEntity))
(setq pt3 (vlax-curve-getClosestPointto obj6 pt5))
(setq pt4 (vlax-curve-getClosestPointto obj5 pt5))

(vla-delete obj3)
(vla-delete obj4)
; need a check direction

(command "arc" "C" pt5 pt3 pt4)

(if (not AH:Butts)(load "Multi Radio buttons.lsp"))
(if (= but nil)(setq but 1))
(setq ans (ah:butts but "h"  '("Flip arc" "Yes" "No")))
(if (= ans "Yes")
(progn
(command "erase" "last" "")
(command "arc" "C" pt5 pt4 pt3)
)
)


(if (< d1 d2)
(vla-put-startpoint obj5 (vlax-3d-point pt4))
(vla-put-endpoint obj5 (vlax-3d-point pt4))
)

(setvar 'osmode oldsnap)
)
(c:arcfill)
« Last Edit: March 05, 2020, 12:08:05 AM by BIGAL »
A man who never made a mistake never made anything