Jump to content

Recommended Posts

Posted

Try this written like 30 years ago.

 

image.png.9290ef176e46ad7f0743652f1fa42f98.png

; Fillets multi lines in one go
;By Alan H


(defun AH:Fmulti ( / ss fpts num num2 x y)
(alert "pick outside-inside-outside")
(setq fpts '())

(setq fpts (cons (getpoint "Pick outside")fpts))
(setq fpts (cons (getpoint "Pick inside") fpts))
(setq fpts (cons (getpoint "Pick outside") fpts))

(setq ss (ssget "F" fpts (list (cons 0 "LINE"))))
(setq num (sslength ss))
(setq num2 (/ num 2.0))
(if (= (- (fix num2) num2) 0.5)
(progn
(Alert "you have an odd number of lines please check")
(exit)
)
)

(setq x 0)
(setq y (- num 1))
(setvar "filletrad" 0.0)
(repeat (fix num2) ; not a real
(setq obj1 (ssname ss x))
(setq obj2 (ssname ss y))
(command "fillet" obj1 obj2)
(setq x (+ x 1))
(setq y (- y 1))
)

) ; defun
(AH:fmulti)

 

  • Like 1
Posted

i tried this but it is not working

Posted (edited)
42 minutes ago, rpsalvi said:

i tried this but it is not working

Works only with lines. Polylines are not supported.
If the AutoCAD version is localized, then
(command "_fillet" obj1 obj2) and (setq ss (ssget "_F" fpts (list (cons 0 "LINE"))))

; Fillets multi lines in one go
;By Alan H 

(defun AH:Fmulti ( / ss fpts num num2 x y)
(alert "pick outside-inside-outside")
(setq fpts '())

(setq fpts (cons (getpoint "Pick outside")fpts))
(setq fpts (cons (getpoint "Pick inside") fpts))
(setq fpts (cons (getpoint "Pick outside") fpts))

(setq ss (ssget "_F" fpts (list (cons 0 "LINE"))))
(setq num (sslength ss))
(setq num2 (/ num 2.0))
(if (= (- (fix num2) num2) 0.5)
(progn
(Alert "you have an odd number of lines please check")
(exit)
)
)

(setq x 0)
(setq y (- num 1))
(setvar "filletrad" 0.0)
(repeat (fix num2) ; not a real
(setq obj1 (ssname ss x))
(setq obj2 (ssname ss y))
(command "_fillet" obj1 obj2)
(setq x (+ x 1))
(setq y (- y 1))
)

) ; defun
(AH:fmulti1)

 

Edited by Nikon
  • Like 1
Posted (edited)

i also tried it, it is working. You just need to adjust it a little to your needs.

If your autocad language is not english, you need to add an underscore for the ssget "F" so "_F" and for the filet command.
Also you would need to change the ssget filter to use lwpolylines instead of lines and add a pedit command to actually join them after the fillet.

Edit: ok its not working with lwpolyline tough i dont get why

Edited by EnM4st3r
  • Like 1
Posted (edited)
12 hours ago, EnM4st3r said:

i also tried it, it is working. You just need to adjust it a little to your needs.

If your autocad language is not english, you need to add an underscore for the ssget "F" so "_F" and for the filet command.
Also you would need to change the ssget filter to use lwpolylines instead of lines and add a pedit command to actually join them after the fillet.

Edit: ok its not working with lwpolyline tough i dont get why

 

This has been a long time problem in calling the FILLET command within AutoLISP (Google it - there is allot of forum posts out there).

When typing in the FILLET at the command line in AutoCAD, it works with Polylines, but it doesn't work when called inside a (command) statement. As far as I can tell, noone has provided a solution, other than using direct object manipulation (via ENTMOD or with VLA; joining and setting bulges).

 

EDIT: NOTE - it will work for me if the Polylines are 2 separate objects, but if they are already connected into a single object at the corner, it won't work.

Edited by pkenewell
  • Like 1
Posted

I will have another look at it using *LINE will detect plines but did find another problem on a certain pattern of linework. Updated.

 

; Fillets multi lines in one go
;By Alan H


(defun AH:Fmulti ( / ss fpts num num2 x y)
(alert "pick outside-inside-outside")
(setq fpts '())

(setq pt1 (getpoint "Pick outside ")) 
(setq fpts (cons pt1 fpts))
(setq pt1 (getpoint pt1 "Pick inside "))
(setq fpts (cons pt1 fpts))
(setq fpts (cons (getpoint pt1 "Pick outside ") fpts))

(setq ss (ssget "F" fpts (list (cons 0 "*LINE"))))
(princ (sslength ss))
(setq num (sslength ss))
(setq num2 (/ num 2.0))
(if (= (- (fix num2) num2) 0.5)
(progn
(Alert "you have an odd number of lines please check")
(exit)
)
)

(setq x 0)
(setq y (- num 1))
(setvar "filletrad" 0.0)
(repeat (fix num2) ; not a real
(setq obj1 (ssname ss x))
(setq obj2 (ssname ss y))
(command "fillet" obj1 obj2)
(setq x (+ x 1))
(setq y (- y 1))
)

) ; defun
(AH:fmulti)

Will improve a bit more.

  • Like 1

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