Author Topic: Delete line into layouts model  (Read 1386 times)

0 Members and 1 Guest are viewing this topic.

Fabricio28

  • Swamp Rat
  • Posts: 670
Delete line into layouts model
« on: March 08, 2018, 07:14:57 AM »
Hello all,

How are you?

I'm deleting lines in the layouts model manually. But I have several files to do that.

And I'd like to ask for help, maybe a lisp would be nice.

I'm attaching a file to explain better my task.
That simple line that I want to erase is the same position (coordinate) to all files.

Thank in advance


« Last Edit: March 08, 2018, 07:38:56 AM by Fabricio28 »

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Delete line into layouts model
« Reply #1 on: March 08, 2018, 09:56:04 AM »
Code - Auto/Visual Lisp: [Select]
  1. (defun c:foo (/ s)
  2.   (if (setq s (ssget "_x" '((0 . "lwpolyline") (90 . 2) (410 . "~Model"))))
  3.     (foreach a (mapcar 'cadr (ssnamex s))
  4.       (if (vl-some '(lambda (b) (equal '(0.151038 173.516) (cdr b) 1e-3))
  5.                    (vl-remove-if-not '(lambda (c) (= (car c) 10)) (entget a))
  6.           )
  7.         ;; Entdel does not work...
  8.         (vla-delete (vlax-ename->vla-object a))
  9.       )
  10.     )
  11.   )
  12.   (princ)
  13. )

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Fabricio28

  • Swamp Rat
  • Posts: 670
Re: Delete line into layouts model
« Reply #2 on: March 08, 2018, 10:03:52 AM »
Code - Auto/Visual Lisp: [Select]
  1. (defun c:foo (/ s)
  2.   (if (setq s (ssget "_x" '((0 . "lwpolyline") (90 . 2) (410 . "~Model"))))
  3.     (foreach a (mapcar 'cadr (ssnamex s))
  4.       (if (vl-some '(lambda (b) (equal '(0.151038 173.516) (cdr b) 1e-3))
  5.                    (vl-remove-if-not '(lambda (c) (= (car c) 10)) (entget a))
  6.           )
  7.         ;; Entdel does not work...
  8.         (vla-delete (vlax-ename->vla-object a))
  9.       )
  10.     )
  11.   )
  12.   (princ)
  13. )

Hi my friend Ron,

Thank you very much. I'm very happy!!!
Worked like a charm.

You helped me a lot.

Fabrício


ronjonp

  • Needs a day job
  • Posts: 7529
Re: Delete line into layouts model
« Reply #3 on: March 08, 2018, 11:31:04 AM »
Glad to help :)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC