Author Topic: Error Solution 101..  (Read 1020 times)

0 Members and 1 Guest are viewing this topic.

ScottMC

  • Newt
  • Posts: 191
Error Solution 101..
« on: May 30, 2021, 05:59:59 PM »
Hope some solution can be found to resolve the selection and option desired for this tool acquired from "Kent Cooper, 8 October 2019" 1. It is helpful but errors on line or *open space* selection and 2. would be nicer to accept current fillet radius. Just started to understanding an *error* trap for this. Any help would be great. Thanks
Code - Auto/Visual Lisp: [Select]
  1. (defun C:RFSR (/ *error* doc asel arc adata)  
  2. Kent Cooper, 8 October 2019
  3.   (defun *error* (errmsg)
  4.     (if (not
  5.           (wcmatch errmsg
  6.                    "Function cancelled,quit / exit abort,console break"
  7.           ) ;_ end of wcmatch
  8.         ) ;_ end of not
  9.       (princ (strcat "\nError: " errmsg))
  10.     )                                             ; if
  11.     (vla-endundomark doc)
  12.     (princ)
  13.   )                                               ; defun - *error*
  14.   ) ;_ end of vla-startundomark
  15.  
  16.   (setvar 'cmdecho 0)
  17.   (princ " < Previous/Current Radius: ")
  18.   (princ (getvar 'filletrad))
  19.   (setq
  20.     asel (entsel
  21.            " >\n Set New Radius by Selecting an Arc/Circle [Poly=0]: "
  22.          ) ;_ end of entsel
  23.   ) ;_ end of setq
  24.   (while
  25.     (and
  26.       (member '(0 . "ARC,CIRCLE")
  27.               (setq adata (entget (setq arc (car asel))))
  28.       ) ;_ end of member
  29.     )                                             ;and
  30.      (setvar "filletrad" (cdr (assoc 40 adata)))
  31.      (princ "\n < Active Fillet Radius: ")
  32.      (princ (getvar 'filletrad))
  33.      (princ " >")
  34.      (command "_.fillet")
  35.   )                                               ;while
  36.  
  37.   (setvar 'cmdecho 1)
  38.   (princ)
  39. )    
  40.  

kdub_nz

  • Mesozoic keyThumper
  • SuperMod
  • Water Moccasin
  • Posts: 2132
  • class keyThumper<T>:ILazy<T>
Re: Error Solution 101..
« Reply #1 on: May 30, 2021, 08:11:53 PM »
Hi Scott,
This may resolve your immediate issues as I understand them.

Design-wise :
It will become a pain having to select the arc radius each time.
Being able to select a poly arc would be nice. There are several ways to test .. have a look at
Code: [Select]
(vlax-property-available-p obj prop [check-modify])
I modified the *error* method so you could do the clean-up a little prettier.

I like your thought about being able to choose the current filletrad value, but that is another issue that would require a redesign of the flow.

Code - Auto/Visual Lisp: [Select]
  1. (defun C:RFSR (/ *error* doc asel adata)
  2.   ;;; Kent Cooper, 8 October 2019
  3.   (defun *error* (errmsg)
  4.     (if
  5.       (and
  6.         errmsg
  7.         (not
  8.           (wcmatch
  9.             errmsg
  10.             "Function cancelled,quit / exit abort,console break"
  11.           )
  12.         )
  13.       )
  14.       (princ (strcat "\nError: " errmsg))
  15.     )
  16.     (vla-endundomark doc)
  17.     (setvar 'cmdecho 1)
  18.     (princ)
  19.   )
  20.   ;;-----------------
  21.   )
  22.   (setvar 'cmdecho 0)
  23.  
  24.   (princ " < Previous/Current Radius: ")
  25.   (princ (getvar 'filletrad))
  26.   ;;-----------------
  27.  
  28.   (while
  29.     (and
  30.       (setq asel (entsel
  31.                    " >\n Set New Radius by Selecting an Arc/Circle [Poly=0]: "
  32.                  )
  33.       )
  34.       (setq adata (entget (car asel)))
  35.       (member (cdr (assoc 0 adata)) (list "ARC" "CIRCLE"))
  36.     )
  37.     (setvar "filletrad" (cdr (assoc 40 adata)))
  38.     (princ "\n < Active Fillet Radius: ")
  39.     (princ (getvar 'filletrad))
  40.     (princ " >")
  41.     (command-s "_.fillet")
  42.   )
  43.  
  44.   (*error* nil)
  45.   (princ)
  46. )
  47.  
« Last Edit: May 30, 2021, 08:16:12 PM by kdub »
Called Kerry in my other life
Retired; but they dragged me back in !

I live at UTC + 13.00

---
some people complain about loading the dishwasher.
Sometimes the question is more important than the answer.

ScottMC

  • Newt
  • Posts: 191
Re: Error Solution 101..
« Reply #2 on: May 31, 2021, 10:54:40 AM »
 :yes:  Excellent Kerry. Simply moved the 'echo' switch and reworded the prompts. Added that poly to the list to ease its option. Now, the last, helpful addition would to jump straight into 'multiple fillet' using the new/picked radius. Thanks much.

   --> moved the Fillet and works better.

Code - Auto/Visual Lisp: [Select]
  1.     (defun C:RFSR (/ *error* doc asel adata)
  2.       ;;; Kent Cooper, 8 October 2019
  3.             (setvar 'cmdecho 0)
  4.       (defun *error* (errmsg)
  5.         (if
  6.           (and
  7.             errmsg
  8.             (not
  9.               (wcmatch
  10.                 errmsg
  11.                 "Function cancelled,quit / exit abort,console break"
  12.               )
  13.             )
  14.           )
  15.           (princ (strcat "\nError: " errmsg))
  16.         )
  17.         (vla-endundomark doc)
  18.        ; (setvar 'cmdecho 1)
  19.         (princ)
  20.       )
  21.       ;;-----------------
  22.       )
  23.  
  24.      
  25.       ;(princ " < Previous/Current Radius: ")
  26.       ;(princ (getvar 'filletrad))
  27.       ;;-----------------
  28.      
  29.       (while
  30.         (and
  31.           (setq asel (entsel
  32.                        "\n Pick an Arc/Circle for Radius: [POLY=0] < Enter to Continue > "
  33.                      )
  34.           )
  35.           (setq adata (entget (car asel)))
  36.           (member (cdr (assoc 0 adata)) (list "ARC" "CIRCLE" "LWPOLYLINE"))
  37.         )
  38.         (setvar "filletrad" (cdr (assoc 40 adata)))      
  39.         (princ "\n              < Active Fillet Radius: ")
  40.         (princ (getvar 'filletrad))
  41.         (princ " >")
  42.                   ;(command "_.fillet") <- moved this outside the while!
  43.        ) ; end of while
  44.       (command "_.fillet") ;;  now it accepts new or previous radius
  45.                                     ;;  with *enter/rightclk *
  46.      (setvar 'cmdecho 1)
  47.       (*error* nil)
  48.       (princ)
  49.     )
  50.      
« Last Edit: June 01, 2021, 08:58:32 PM by ScottMC »