Jump to content

Recommended Posts

Posted

Very nice! I often copy the radius from existing geometry so I changed the getreal to getdist. Works perfect, thank you very much.

 

One question, is there a "vla-" function that can make it to finish the routine with the right-click instead of canceling it with "Esc"?

 

Thanks again.

Posted

Thanks. I wrote that too fast and wasn't thinking about using getdist (updated). VLA doesn't have any kind of fillet command and will all that comes with it, it would be too convoluted to attempt to replicate it. Hell, it has too many wonderful options. I tried to figure out a better way to have it fillet multiple times, but what I posted is the best thing I could come up with. Escape is a small price to pay for being able to continuously fillet and being able to fillet EVERYTHING that normal fillet can. Hell, you would be forced to use escape with core Fillet.

 

Here's my Fillet with radius routine. I decided to do a little update before posting it. I'd been meaning to have to extract the radius from LWPolyline segments, circles and ellipses, in addition to arcs, but just hadn't gotten around to it. This discussion make me get off my butt and do it.

 

 

MAIN:

(defun c:FR (/ rad ent eLst)
 ;; Fillet with entered radius or radius of selected arc (option to delete selected arc)
 ;; Required Subroutines: AT:GetSel
 ;; Alan J. Thompson, 09.03.09 / 07.01.10
 (initget 4 "Select")
 (setq rad (cond ((getdist (strcat "\nSpecify fillet radius or select arc [select] <"
                                   (rtos (getvar 'filletrad) 2 2)
                                   ">: "
                           )
                  )
                 )
                 ((getvar 'filletrad))
           )
 )

 (cond
   ((eq rad "Select")
    (if (setq ent (AT:GetSel
                    entsel
                    "\nSelect arc segment to extract radius: "
                    (lambda (x / c)
                      (if (setq c (osnap (cadr x) "_cen"))
                        (princ (strcat "\nFillet Radius: "
                                       (vl-princ-to-string
                                         (setvar 'filletrad
                                                 (distance (osnap (cadr ent) "_near") c)
                                         )
                                       )
                               )
                        )
                      )
                    )
                  )
        )
      (progn
        (if
          (and
            (eq "ARC" (cdr (assoc 0 (setq eLst (entget (car ent))))))
            (/= 4 (logand 4 (cdr (assoc 70 (entget (tblobjname "LAYER" (cdr (assoc 8 eLst))))))))
            (not (initget 0 "Yes No Delete"))
            (vl-position (getkword "\nDelete selected arc? [Yes/No] <No>: ") '("Yes" "Delete"))
          )
           (entdel (car ent))
        )
        (vl-cmdf "_.fillet")
      )
    )
   )
   ((numberp rad) (setvar 'filletrad rad) (vl-cmdf "_.fillet"))
 )
 (princ)
)

 

You'll need this subroutine:

(defun AT:GetSel (meth msg fnc / ent good)
 ;; meth - selection method (entsel, nentsel, nentselp)
 ;; msg - message to display (nil for default)
 ;; fnc - optional function to apply to selected object
 ;; Ex: (AT:GetSel entsel "\nSelect arc: " (lambda (x) (eq (cdr (assoc 0 (entget (car x)))) "ARC")))
 ;; Alan J. Thompson, 05.25.10
 (setvar 'errno 0)
 (while (not good)
   (setq ent (meth (cond (msg)
                         ("\nSelect object: ")
                   )
             )
   )
   (cond
     ((vl-consp ent)
      (setq good (if (or (not fnc) (fnc ent))
                   ent
                   (prompt "\nInvalid object!")
                 )
      )
     )
     ((eq (type ent) 'STR) (setq good ent))
     ((setq good (eq 52 (getvar 'errno))) nil)
     ((eq 7 (getvar 'errno)) (setq good (prompt "\nMissed, try again.")))
   )
 )
)

Posted

Hello

 

Any idea why the shift method for a 0 radius doesn't work for me?

It will fillet with the previous fillet radius as if the shift key wasn't pressed.

acad 2005.

 

Thanks

P

Posted
Thanks again Alan. Very nice!

You're welcome and thanks. :) I actually use the option to delete the selected arc more than I though I would when I originally coded it.

 

Hello

 

Any idea why the shift method for a 0 radius doesn't work for me?

It will fillet with the previous fillet radius as if the shift key wasn't pressed.

acad 2005.

 

Thanks

P

 

That option wasn't introduced until a later release.

Posted

ah that would be why then :)

so I need to figure out a lisp which stores the existing radius to a variable sets the radius to 0, then restores the variable at the end.

I should be able to manage that.

 

cheers

Posted
ah that would be why then :)

so I need to figure out a lisp which stores the existing radius to a variable sets the radius to 0, then restores the variable at the end.

I should be able to manage that.

 

cheers

Be sure you read my above posts about the limitations with feeding entsel selections to the fillet command.
Posted

mmm

I was hoping to simply use the filletrad variable.

enquire what it is and storing it to a new temporary variable

then set it to 0

run fillet command as normal

then restore the previous filletrad variable.

 

but looks like it's not as easy as that...

 

Command: (setvar "FILLETRAD" 0)

0

Command: !filletrad

nil

Command: (setvar "FILLETRAD" 1)

1

Command: !filletrad

nil

 

no time today, must get back to work. Cheers

Posted

filletrad is a system variable, not a user defined variable.

 

Ugly and clunky example of what could work...

 

(defun c:F0 (/ f)
 (setq f (getvar 'filletrad))
 (setvar 'filletrad 0.)
 (command "_.fillet" PAUSE PAUSE)
 (setvar 'filletrad f)
 (princ)
)

Posted

does the job, perfect! Cheers Alan

Posted
does the job, perfect! Cheers Alan
Well, then Merry Christmas! :xmas:
Posted
Please follow the steps below to get the fruits.

 

1- open the CUI in Autocad.

2- create a new command .

3- in the cell of macro within the command that created type the code

like this c^c^_fillet;r;0;

4-Bring the command which you created to one of the menu bars of Autocad

5- Press Apply then Ok

6- Go to the menu that the command inserted to then invoke the command

7- Enjoy the command

 

Tharwat

 

 

:( same thing. starts the command, i enter a radius I want (or pick a distance) and the command ends... why are the simplest things always so difficult for me.

 

I seriously suck at this...

Posted
:( same thing. starts the command, i enter a radius I want (or pick a distance) and the command ends... why are the simplest things always so difficult for me.

I seriously suck at this...

 

hello.

all memers participations are correct and do work perfectly, and you have to know waht you want to do before you are going to chose your needed command.

 

If you implement the first thread that I wrote earleir that will be the easiest for you, And you might not have known how to invoke the command (Lisp).

 

All threads that are written for your thread are correct.

 

 

Check once again ..... and keep on trying

 

Good luck

Tharwat

Posted

Thanks Alan,

 

your lisp works but is there no way to keep the command alive so i can fillet 10 lines all at a radius of 1 for example.

 

like lets say i have 40 driveways that all need a 20' radius connecting to the street, i just type FR, then enter 20 as a radius, and I can continue in the same command for all 80 lines instead of having to keep hitting the space bar or reentering the command?

 

I had it on LDD 2005, so I know its possible... I just know know how to make it work.

 

Man I really wish I could get your guys help on creating some good construction notes too!!

Posted

maybe you need to add the pause pause to your macro.

 

why not use lisp?

 

(defun c:F20 (/ f)

(setq f (getvar 'filletrad))

(setvar 'filletrad 20.)

(command "_.fillet" PAUSE PAUSE)

(setvar 'filletrad f)

(princ)

)

Posted
Thanks Alan,

 

your lisp works but is there no way to keep the command alive so i can fillet 10 lines all at a radius of 1 for example.

 

like lets say i have 40 driveways that all need a 20' radius connecting to the street, i just type FR, then enter 20 as a radius, and I can continue in the same command for all 80 lines instead of having to keep hitting the space bar or reentering the command?

 

I had it on LDD 2005, so I know its possible... I just know know how to make it work.

 

Man I really wish I could get your guys help on creating some good construction notes too!!

Repeating itself is a little more complicated. If you are not concerned with additional abilities (filleted polyline segments, etc.), then you can just use entsel.

I posted an acceptable example of specifying a radius and the fillet command staying active: http://www.cadtutor.net/forum/showpost.php?p=338840&postcount=20

It's not perfect or pretty, but it works.

Posted

Give this a whirl, but know that you are bound by the limitations I spoke of earlier (issues with polylines, etc.)...

 

(defun C:FC (/ *error* _sel fr e1 e2)
 ;; Alan J. Thompson, 07.01.10
 (defun *error* (msg)
   (and fr (setvar 'filletrad fr))
   (and msg
        (not (wcmatch (strcase msg) "*BREAK*,*CANCEL*,*QUIT*"))
        (princ (strcat "\nError: " msg))
   )
 )

 (defun _sel (/ e)
   (setvar 'errno 0)
   (while (and (/= 52 (getvar 'errno)) (not e))
     (setq e (entsel "\nSelect object to fillet: "))
   )
 )

 (initget 4)
 (setvar
   'filletrad
   (cond
     ((getdist (strcat "\nSpecify fillet radius <" (rtos (setq fr (getvar 'filletrad))) ">: ")))
     (fr)
   )
 )

 (while (and (setq e1 (_sel)) (setq e2 (_sel))) (command "_.fillet" e1 e2))

 (*error* nil)
 (princ)
)

Posted

Actually, this probably makes more sense. It will store the last entered radius.

 

(defun C:FC (/ *error* _sel fr e1 e2)
 ;; Alan J. Thompson, 07.01.10
 (defun *error* (msg)
   (and fr (setvar 'filletrad fr))
   (and msg
        (not (wcmatch (strcase msg) "*BREAK*,*CANCEL*,*QUIT*"))
        (princ (strcat "\nError: " msg))
   )
 )

 (defun _sel (/ e)
   (setvar 'errno 0)
   (while (and (/= 52 (getvar 'errno)) (not e))
     (setq e (entsel "\nSelect object to fillet: "))
   )
 )

 (initget 4)
 (setq *FC:Rad*
        (setvar
          'filletrad
          (cond
            ((getdist (strcat "\nSpecify fillet radius <"
                              (rtos (setq *FC:Rad* (cond (*FC:Rad*)
                                                         ((setq fr (getvar 'filletrad)))
                                                   )
                                    )
                              )
                              ">: "
                      )
             )
            )
            (*FC:Rad*)
          )
        )
 )

 (while (and (setq e1 (_sel)) (setq e2 (_sel))) (command "_.fillet" e1 e2))

 (*error* nil)
 (princ)
)

  • 1 month later...
Posted
Actually, this probably makes more sense. It will store the last entered radius.

)[/code]

 

Thanks for the lisp above, it was really helpful, especially now that I'm doing a master plan (road corners). It's great that you've thought of radius option.

If you have time, I hope you can help me with modifying the lisp below. It's for adding fillet to polylines. However, I wish to ammend it with "enter radius" just like what you've posted above. I downloaded it before though I can't remember the source anymore. Thanks!

 

(defun c:Fp1 ()

(setq sel (ssget (list (cons 0 "lwpolyline,polyline"))))

(setq c 0)

(setq len (sslength sel))

(repeat len

(setq sna (ssname sel c)

sge (entget sna)

)

(COMMAND "FILLET" "p" sna "")

(setq c (+ c 1))

)

)

Posted
(defun c:FP (/ ss)
 ;; Alan J. Thompson, 08.31.10
 (initget 4)
 (setvar 'filletrad
         (cond
           ((getdist (strcat "\nSpecify fillet radius <" (rtos (getvar 'filletrad)) ">: ")))
           ((getvar 'filletrad))
         )
 )
 (if (setq ss (ssget "_:L" '((0 . "LWPOLYLINE"))))
   ((lambda (i / e)
      (while (setq e (ssname ss (setq i (1+ i))))
        (command "_.fillet" "_polyline" e)
      )
    )
     -1
   )
 )
 (princ)
)

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