Jump to content

Repeat Fillet command with new radius each time


Dahzee

Recommended Posts

I found this line of a fillet command routine, which allows you to run the fillet command, press enter or spacebar and it runs again, giving you the option to use the previous radius or change to a new one.

 

(Defun C:FCR ( ) (Command ".FILLET" "RADIUS" PAUSE ".FILLET"))

Is there a way this can be adjusted (or a completely different method) so it automatically starts again with the radius prompt so I can do multiple fillets one after the other and change or keep the previous radius on the fly, without restarting the fillet command from the beginning?

 

Many thanks in advance,

 

Dahzee

Link to comment
Share on other sites

(defun c:Test ()
 (while T
   (command "_.fillet" "_radius" pause "_.fillet")
   (while (/= (logand (getvar 'cmdactive) 3) 0) (command pause))
 )
 (princ)
)

Link to comment
Share on other sites

This is maybe what your after you can enter the fillet command and any radius as 1 word F100 ie fillet with radius 100 decimals F10-5 is radius 10.5 need to use - for decimal. It also has some extras such as Offset, Circle and open a project directory. I have it autoloaded and use it every day. It can be expanded and more commands added.

 

; Enter the filet radius as part of a command line entry f100 offset O234 circle c123-45 
; note - is used for decimal point
; original code and methology by Alan H
; assistance and code that worked by Lee-Mac
; OCT 2015

(   (lambda nil
       (vl-load-com)
       (foreach obj (cdar (vlr-reactors :vlr-command-reactor))
           (if (= "fillet-reactor" (vlr-data obj))
               (vlr-remove obj)
           )
       )
       (vlr-command-reactor "fillet-reactor" '((:vlr-unknowncommand . fillet-reactor-callback)))
   )
)

(defun filletrad ( / rad)
(setq rad (distof (substr com 2) 2))
           (if (<= 0.0 rad)
             (progn        
             (setvar 'filletrad rad)
             (vla-sendcommand fillet-reactor-acdoc "_.fillet ")
             )
             ) 
)
(defun makecirc ( / rad radd)
(setq rad (distof (substr com 2) 2))
           (if (<= 0.0 rad)
           (progn 
           (setvar 'circlerad rad)
           (setq pt (getpoint "Pick centre pt"))       
           (vla-sendcommand fillet-reactor-acdoc "_.Circle !pt  ")       
           )
           )
)
(defun offdist ( / dist)
(setq dist (distof (substr com 2) 2))
           (if (<= 0.0 dist)
           (progn        
           (setvar 'offsetdist dist)
           (vla-sendcommand fillet-reactor-acdoc "_.Offset  ")
           )
           )
)

(defun pipeoff ( / dist)
(setq dist (distof (substr com 2) 2))
           (if (<= 0.0 dist)
           (progn
           (setq poff (strcat "P" (rtos dist 2 0)))
           (if (not poff)(load "Pipe offsets"))
           (vla-sendcommand fillet-reactor-acdoc poff)
           )
           )
)

(defun projopen ( / Proj year)
(setq year (atoi (substr com 2 4)))
(if (< year 2014) 
 (setq projno (strcat "EXPLORER P:\\DESIGN\\DATA\\" (substr com 2 4) " Projects\\" (substr com 2) "\\Design\\"))
 (setq projno (strcat "EXPLORER P:\\" (rtos year 2 0) " Projects\\" (substr com 2) "\\Design\\"))           
)
(vla-sendcommand fillet-reactor-acdoc (STARTAPP projno))                   
)


(defun fillet-reactor-callback ( obj com )
(setq com (vl-string-translate "-" "." (strcase (car com))))
   (cond   
       (   (and
           (wcmatch com "~*[~F.0-9]*")
           (wcmatch com "F*")
           (wcmatch com "~F*F*")
           (wcmatch com "~*.*.*")
           ) ; and
           (filletrad) 
        ) 

        (  (and
           (wcmatch com "~*[~C.0-9]*")
           (wcmatch com "C*")
           (wcmatch com "~C*C*")
           (wcmatch com "~*.*.*")
           ) ;and
           (makecirc) 
        )

        (  (and
           (wcmatch com "~*[~O.0-9]*")
           (wcmatch com "O*")
           (wcmatch com "~O*O*")
           (wcmatch com "~*.*.*")
           ) ; and
           (offdist) 
        )

        (  (and
           (wcmatch com "~*[~D.0-9]*")
           (wcmatch com "D*")
           (wcmatch com "~D*D*")
           (wcmatch com "~*.*.*")
           ) ; and
           (projopen) 
        )

        (  (and
           (wcmatch com "~*[~P.0-9]*")
           (wcmatch com "P*")
           (wcmatch com "~P*P*")
           (wcmatch com "~*.*.*")
           ) ; and
           (pipeoff) 
        )

   ) ; master cond
) ; defun

Link to comment
Share on other sites

Seperate to my other post you can do a hard code radius increment this takes the 1st radius and adds or subtracts for the next known amount of lines usefull for parallel lines.

Link to comment
Share on other sites

Roy,

Thanks for the routine it works perfectly.

 

Bigal,

Thank you also for your routine; unfortunately after loading your routine, I'm not smart enough to know what to type and when to run the program!

 

Cheers,

Dahzee

Link to comment
Share on other sites

F100 will run the fillet command with a radius of 100 f20 radius 20, for radius 10.5 F10-5, same with the offset o1 offset is 1 o10 offset is ten. Same again for circle c25 pick center pt and a circle with radius of 25 is drawn.

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...