Jump to content

Recommended Posts

Posted (edited)

Todays wish list I will rewrite this and Offset was next to add, nearly posted last night it does not work at this stage.

 

A light turned on once over this current problem, what about Line L100 d345 r100 c a rectang appears move&copy same thing. Up Down left Right

 

; 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)
(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 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) 
        )

   ) ; master cond
) ; defun

(princ)

(or fillet-reactor-acdoc
   (setq fillet-reactor-acdoc (vla-get-activedocument (vlax-get-acad-object)))
)
(princ)

Edited by BIGAL
  • Replies 28
  • Created
  • Last Reply

Top Posters In This Topic

  • BIGAL

    10

  • Lee Mac

    10

  • broncos15

    8

  • zaphod

    1

Posted (edited)

Code corrected just moved the translate so simple some times this will do a fillet or a circle f100 C234 you just press enter after pick circle point.

 

Changed code above again now has circle offset and fillet. Check "_.Offset " two spaces required.

 

Watch this space left right down up.

 

Without your help Lee would not have got there, started using it today for fillets and its so easy.

Edited by BIGAL
  • 2 weeks later...
Posted

:Dnice code, I could see it helping a lot of people save time, to spend more time lurking here

Posted

Were starting to use it and its surprising how you get used to using the - for decimal, did something the other day lots of fillets at odd radius.

  • 1 month later...
Posted

So I have been looking at Big Al's and Lee's codes, which are both brilliant by the way to practice my reactor skills. I know that you cannot use commands within a reactor, so I am curious why can you use vla-send command? Is it because vla-send command acts almost like a script that sends something to the command line, or is it for some different reason?

  • 1 year later...
Posted

I was curious if there was a way with my offset reactor to have it launch one of two commands. I ask because I have an offset from xref LISP I use as well as the normal offset command and I'd like the reactor to work with the offset from xref LISP.

Posted

I was playing with the code to do something new and you should be able to do the xref lisp you may need to write a script file with something like (xrefoff 23) in the script. I had it working with a script but removed once I figured out where I was wrong in code. You can run lisp code in a script file.

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