Jump to content

Recommended Posts

Posted

There is a program 
Kent Cooper, but unfortunately it doesn't work. I choose a circle (or an arc). It ends with an error...
Please tell me where the error is.

(defun C:FMR (/ aper pt); = Fillet Match Radius [of existing curve]
; to apply the radius of a selected curved object in the Fillet command 
; 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)
)

; Select curve to set Fillet Radius:
; No radius for that object.; error: end/exit abort

Posted

Kent Cooper is active on the Autodesk Forums.

  • Like 1
Posted

The only way the function can produce that error message is if the object chosen has no center point. It won't reach that test until you've selected an object of some kind--not necessarily an arc/circle.

 

Can't diagnose it any better until we know what you're picking. Note that the aperture changes while the function is active.

Posted
10 hours ago, CyberAngel said:

The only way the function can produce that error message is if the object chosen has no center point. It won't reach that test until you've selected an object of some kind--not necessarily an arc/circle.

The program asks me to select a curve to indicate the radius of the fillet, I select a circle, but the program ends...

fillet.png

Posted

A quick example written from Mobile. 

 

(setq obj (car (entsel "\nSelect circle:")))
(setvar 'filletrad (cdr(assoc 40 (entget obj))))  

 

  • Thanks 1
Posted

And if you internationalize the parameters of (osnap)
"cen" -> "_cen"
"near" -> "_near"
This might work!

Otherwise you can try this:

(defun c:set_fillet ( / ent dxf_ent typ_ent mkv vector vlaobj id_rad)
  (while (not (setq ent (entsel "Select curve to set Fillet Radius: "))))
  (setq typ_ent (cdr (assoc 0 (setq dxf_ent (entget (car ent))))))
  (cond
    ((or
      (eq typ_ent "ARC")
      (eq typ_ent "CIRCLE")
      (eq typ_ent "LWPOLYLINE")
      (and
        (eq typ_ent "POLYLINE")
        (zerop (boole 1 120 (cdr (assoc 70 dxf_ent))))
      )
     )
      (if (or (> (fix (car (trans (cadr ent) 1 0))) 1E6) (> (fix (cadr (trans (cadr ent) 1 0))) 1E6))
        (setq mkv T vector (trans (cadr ent) 0 0 T) vlaobj (vlax-ename->vla-object (car ent)))
        (setq mkv nil)
      )
      (if mkv (vla-move vlaobj (vlax-3d-point (trans (cadr ent) 1 0)) (vlax-3d-point '(0.0 0.0 0.0))))
      (setq id_rad
        (distance
          '(0 0)
          (trans
            (vlax-curve-getsecondderiv (car ent)
              (vlax-curve-getparamatpoint (car ent)
                (vlax-curve-getclosestpointto (car ent) (if mkv '(0.0 0.0 0.0) (trans (cadr ent) 1 0)))
              )
            )
            0
            (car ent)
            T
          )
        )
      )
      (if mkv (vla-move vlaobj (vlax-3d-point '(0.0 0.0 0.0)) (vlax-3d-point vector)))
      (setvar "FILLETRAD" (abs id_rad))
    )
    (T (setvar "FILLETRAD" 0.0))
  )
  (command "_.fillet" "_multiple")
  (prin1)
)

 

  • Like 1
Posted (edited)
38 minutes ago, Tsuky said:

And if you internationalize the parameters of (osnap)
"cen" -> "_cen"
"near" -> "_near"
This might work!

; by Kent Cooper
(defun C:FMR (/ aper pt); = Fillet Match Radius [of existing curve]
; to apply the radius of a selected curved object in the Fillet command 
; 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

;(setq obj (car (entsel "\nSelect circle:"))) 
;(setvar 'filletrad (cdr(assoc 40 (entget obj)))) 

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

Now this code is working!

@Tsuky THANK YOU VERY MUCH!
                  "set_fillet" works very well!

 

Edited by Nikon

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