Author Topic: Clean Drawing  (Read 1980 times)

0 Members and 1 Guest are viewing this topic.

mailmaverick

  • Bull Frog
  • Posts: 493
Clean Drawing
« on: January 23, 2018, 03:48:55 AM »
Hi

How to clean drawing by deleting :-
1.) 2D Polylines, 3D Polylines, LWPolylines, Lines etc with one vertex ?
2.) Null Texts

gile

  • Gator
  • Posts: 2507
  • Marseille, France
Re: Clean Drawing
« Reply #1 on: January 23, 2018, 04:12:06 AM »
Code: [Select]
(command "_.purge" "_Zero" "_.purge" "_Empty")
Speaking English as a French Frog

gile

  • Gator
  • Posts: 2507
  • Marseille, France
Re: Clean Drawing
« Reply #2 on: January 23, 2018, 04:29:25 AM »
Quick and dirty

Code: [Select]
(vlax-for b (vla-get-Blocks
      (vla-get-ActiveDocument
(vlax-get-acad-object)
      )
    )
  (vlax-for o b
    (if
      (or
(and
  (vlax-property-available-p o 'Textstring)
  (= "" (vl-string-trim " \t\n" (vlax-get o 'Textstring)))
)
(and
  (vlax-property-available-p o 'Length)
  (= 0. (vlax-get o 'Length))
)
      )
       (vla-Delete o)
    )
  )
)
Speaking English as a French Frog

mailmaverick

  • Bull Frog
  • Posts: 493
Re: Clean Drawing
« Reply #3 on: January 23, 2018, 07:12:00 AM »
Thanks.

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1451
  • Marco
Re: Clean Drawing
« Reply #4 on: January 24, 2018, 09:36:00 AM »
Code: [Select]
(command "_.purge" "_Zero" "_.purge" "_Empty")

Is it possible to know if a command of the version in use (AutoCAD/BricsCAD) has some options? Like "_Zero" and "_Empty" not present in old versions.

For example with (and (getcname "_TASKBAR") (command "_TASKBAR" 1)) I can know if the command exists in the version I'm using.