Author Topic: How to select all polylines of certain layer and fillet them !!  (Read 2357 times)

0 Members and 1 Guest are viewing this topic.

JohnCamper

  • Mosquito
  • Posts: 10
How to select all polylines of certain layer and fillet them !!
« on: September 21, 2020, 11:53:27 PM »
How to select all polylines of certain layer(Eg: "Walls") and fillet them with (0.25) radius .I am just new at this lisp scene so any help would be appreciated.Below is the separate code that selects all elements of layer and  another code fillets all selected polylines.How can i combine these two to create a single lisp for certain layer("walls") and (0.25) fillet.

Code: [Select]
(defun c:SALL ()
 (setq TargEnt (car (entsel "\nSelect object on layer to select: ")))
 (setq TargLayer (assoc 8 (entget TargEnt)))
 (sssetfirst nil (ssget "_X" (list TargLayer)))
 (princ)
)


(defun C:FMP ; = Fillet Multiple Polylines
  (/ plss n)
  (if (setq plss (ssget "_:L" '((0 . "LWPOLYLINE"))))
    (repeat (setq n (sslength plss))
      (command "_.fillet" "_polyline" (ssname plss (setq n (1- n))))
    ); repeat
  ); if
  (princ)
); defun

HOSNEYALAA

  • Newt
  • Posts: 103
Re: How to select all polylines of certain layer and fillet them !!
« Reply #1 on: September 22, 2020, 03:31:32 AM »
For better understanding, and, maybe, get further help, please upload such sample.dwg
As far as I know, ACAD only can edit DWG.

JohnCamper

  • Mosquito
  • Posts: 10
Re: How to select all polylines of certain layer and fillet them !!
« Reply #2 on: September 22, 2020, 04:11:01 AM »

As in the picture i want all the polylines with layer name "wall" to be filleted with radius 0.25.

Dlanor

  • Bull Frog
  • Posts: 263
Re: How to select all polylines of certain layer and fillet them !!
« Reply #3 on: September 22, 2020, 04:11:38 AM »
Are you trying to automatically fillet ALL lwpolylines on the layer or only the selected ones? What CAD are you using on which platform?

JohnCamper

  • Mosquito
  • Posts: 10
Re: How to select all polylines of certain layer and fillet them !!
« Reply #4 on: September 22, 2020, 04:17:07 AM »
Yes,I want to fillet ALL lwpolylines on the layer named "wall".The 2nd code that i have put will fillet the selected polylines with previous settings.
I use windows and Autocad 2020.

Tharwat

  • Swamp Rat
  • Posts: 707
  • Hypersensitive
Re: How to select all polylines of certain layer and fillet them !!
« Reply #5 on: September 22, 2020, 04:57:38 AM »
Code - Auto/Visual Lisp: [Select]
  1. (defun c:Test ( / int sel ent)
  2.   (and (setq int -1 sel (ssget "_:L" '((0 . "LWPOLYLINE"))))
  3.      (while (setq int (1+ int) ent (ssname sel int))
  4.        (command "_.FILLET" "_Polyline" ent)
  5.        )
  6.      )
  7. )

JohnCamper

  • Mosquito
  • Posts: 10
Re: How to select all polylines of certain layer and fillet them !!
« Reply #6 on: September 22, 2020, 05:13:47 AM »
@Tharwat Thank you for posting but the lisp code that you have posted does the same thing as the lisp code that i have posted above !
I want to Fillet(with radius:0.25) all the polylines under layer "wall .No need to select the lines.Just run the lisp and it does the thing.

Tharwat

  • Swamp Rat
  • Posts: 707
  • Hypersensitive
Re: How to select all polylines of certain layer and fillet them !!
« Reply #7 on: September 22, 2020, 05:24:28 AM »
Alright, here you go.
Code - Auto/Visual Lisp: [Select]
  1. (defun c:Test (/ int sel ent)
  2.   (and
  3.     (or (/= 4
  4.             (logand 4
  5.                     (cdr (assoc 70 (entget (tblobjname "LAYER" "wall"))))
  6.             )
  7.         )
  8.         (alert "Layer name <wall> is locked ! unlock then try again"
  9.         )
  10.     )
  11.     (setq int -1
  12.           sel (ssget "_X"
  13.                      (list '(0 . "LWPOLYLINE")
  14.                            '(8 . "wall")
  15.                            (cons 410 (getvar 'CTAB))
  16.                      )
  17.               )
  18.     )
  19.     (setvar 'FILLETRAD 0.25)
  20.     (while (setq int (1+ int)
  21.                  ent (ssname sel int)
  22.            )
  23.       (command "_.FILLET" "_Polyline" ent)
  24.     )
  25.   )
  26.   (princ)
  27. )

JohnCamper

  • Mosquito
  • Posts: 10
Re: How to select all polylines of certain layer and fillet them !!
« Reply #8 on: September 22, 2020, 05:44:21 AM »
Thank you so much @Tharwat.It worked as expected !!  :-)

Tharwat

  • Swamp Rat
  • Posts: 707
  • Hypersensitive
Re: How to select all polylines of certain layer and fillet them !!
« Reply #9 on: September 22, 2020, 05:46:13 AM »
Thank you so much @Tharwat.It worked as expected !!  :-)
You're welcome anytime.