Match fillet lisp routine - modify

Match fillet lisp routine - modify

Anonymous
Not applicable
1,323 Views
7 Replies
Message 1 of 8

Match fillet lisp routine - modify

Anonymous
Not applicable

I found this lisp routine from Kent Cooper:

I would like to modify it so that it deletes the radius after the program retrieves the value of the radius. This way I can reinsert the radius so that I know that the radius and lines are connected. (typically after another modification took place.)

 

Thank you,

Joe

; Kent Cooper, June 2011

(setq aper (getvar 'aperture))

(while

(not (setq pt (cadr (entsel "Select curve to set Fillet Radius: "))))

(prompt "\nNothing selected -- ")

); end while

(setvar 'aperture (getvar 'pickbox)); ensures Osnap won't "see" wrong thing

(if (osnap pt "cen")

(setvar 'filletrad (distance (osnap pt "nea") (osnap pt "cen"))); then

(progn ; else

(prompt "\nNo radius for that object.")

(setvar 'aperture aper)

(exit)

); end progn

); end if

(setvar 'aperture aper)

(command "_.fillet" "_mUltiple")

(princ)

)

0 Likes
Accepted solutions (1)
1,324 Views
7 Replies
Replies (7)
Message 2 of 8

rkmcswain
Mentor
Mentor

Let's tag him !

@Kent1Cooper  

R.K. McSwain     | CADpanacea | on twitter
0 Likes
Message 3 of 8

Kent1Cooper
Consultant
Consultant

@Anonymous wrote:

....

I would like to modify it so that it deletes the radius after the program retrieves the value of the radius. This way I can reinsert the radius so that I know that the radius and lines are connected. ….


 

That's certainly possible if you are always talking about an Arc object that is the result of Filleting between two separate objects [typically Lines].  The routine will also get a radius from an arc segment of a Polyline, or from a Circle, or even an Ellipse or the dimension arrow of an angular Dimension -- anything from Osnap can find a CENter.  I assume you would want the source deleted only if it's an Arc object.

 

If you can restrict your use of it to that situation, I think [untested] you should be able to just add this line:

 

  (command "_.erase" pt "")

 

just before the  (command "_.fillet" "_mUltiple")  line.

 

It could also be elaborated to determine whether what you picked was an Arc object, and not delete it if it was one of those other kinds of things.  But there's a danger there -- you might sometimes use it with an Arc when you just want to get a radius and not delete, but the source Arc would be deleted.

Kent Cooper, AIA
Message 4 of 8

Anonymous
Not applicable

Kent,

 

Thank you for the help. Added line and routine works.

One other thing; Is there a way to make the routine repeat so that I can pick different radii to reapply?

 

Joe

0 Likes
Message 5 of 8

Kent1Cooper
Consultant
Consultant

@Anonymous wrote:

.... Is there a way to make the routine repeat so that I can pick different radii to reapply?


 

If you would never want to apply the radius from a selected Arc to more than one pair of Lines [i.e. any in addition to the ones it was a result of Filleting before], nor ever select on anything other than an Arc, then the quickie almost-there solution is to remove the "_mUltiple" option from the Fillet command, run it, and just hit Enter/space to run it again, etc.

 

However, the resulting code would then be overkill in several ways [such as dealing with the possibility of an Ellipse], and would have potential problems [e.g. you could still pull the radius from the wrong kind of object].  I'm working on one specifically for this situation, and with real automatic repeating -- more later.

Kent Cooper, AIA
0 Likes
Message 6 of 8

Anonymous
Not applicable

Kent,

 

Thank you very much for your help. I will look for the alternative with the repeating feature.

 

Best regards,

Joe

0 Likes
Message 7 of 8

Kent1Cooper
Consultant
Consultant
Accepted solution

@Kent1Cooper wrote:

.....  I'm working on one specifically for this situation, and with real automatic repeating -- more later.


 

It can be boiled down to just this:

;|ReFillet.lsp [command name: RFSR]
Select Arc from previous Fillet, delete it, start Fillet command at same Radius.
Repeats automatically.  Ends with Enter/Space/Escape, or by picking nothing or
any object other than an Arc. Kent Cooper, 8 October 2019 |; (defun C:RFSR; = Re-Fillet at Same Radius [of existing Arc from previous Fillet] (/ asel arc adata) (while (and (setq asel (entsel "\nSelect Arc to Re-Fillet its Lines at the same Radius: ")) (member '(0 . "ARC") (setq adata (entget (setq arc (car asel))))) ); and (setvar 'filletrad (cdr (assoc 40 adata))) (command "_.erase" arc "") (command-s "_.fillet") ); while (princ) ); defun

It's up to you to pick on the correct Lines in the Fillet command that it leaves you in.  If this would always be done with an Arc that still touches both its Lines, it should be possible to have it find them for you, but I don't imagine that will always be the case.

 

Additional enhancements are possible -- Undo begin-end wrapping, internal one-at-a-time Undo so you can go back on one that went wrong or that you didn't really mean, command-echo suppression for the Erase command [or (entdel) instead of it], *error* handling if some of those are incorporated [no need for it in this simpler version -- nothing to reset or anything like that], saving of current Fillet radius setting when you start and restoring of it afterwards, ask again if you miss or pick the wrong kind of thing, etc.

Kent Cooper, AIA
0 Likes
Message 8 of 8

Anonymous
Not applicable

Kent,

 

Thank you. Routine works great!

I really appreciate your help with this.

 

Best regards,

Joe

0 Likes