Jump to content

Deleting Points


toxicsquall
 Share

Recommended Posts

Good afternoon,

I need to delete all points between 0 cm and 15 cm spacing.

If I can use an object as a base or a layer it will be even better.

With OVERKILL command it deletes randomly objects that only are overlapping.

Is there any lisp that can make this?

Link to comment
Share on other sites

Good afternoon,

I need to delete all points between 0 cm and 15 cm spacing.

If I can use an object as a base or a layer it will be even better.

With OVERKILL command it deletes randomly objects that only are overlapping.

Is there any lisp that can make this?

 

Not a simple task if points group has many points within the spacing, which to be deleted?

 

No solution code yet, perhaps wrong algorithm :oops:

The animation illustrates we toggle sorted point group min(X) and min(Y) seems there are many possibilities if max(X) max(Y) etc..?

we keep the highlighting points, then erase the rest say less than 15cm spacing. Though GIF shows in MM, similar concept.

 

HqQBHfj.gif

Edited by hanhphuc
Link to comment
Share on other sites

This is HORRIBLY inefficient, but should work:

 

[b][color=BLACK]([/color][/b]defun c:delpts [b][color=FUCHSIA]([/color][/b]/ x ln ls ss i es en ed bp c cn cd cp[b][color=FUCHSIA])[/color][/b]

 [b][color=FUCHSIA]([/color][/b]initget 7[b][color=FUCHSIA])[/color][/b]
 [b][color=FUCHSIA]([/color][/b]setq x [b][color=NAVY]([/color][/b]getdist [color=#2f4f4f]"\nMinimum Distance:   "[/color][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]

 [b][color=FUCHSIA]([/color][/b]while [b][color=NAVY]([/color][/b]not ln[b][color=NAVY])[/color][/b]
        [b][color=NAVY]([/color][/b]and [b][color=MAROON]([/color][/b]princ [color=#2f4f4f]"\nSelect 1 Entity For LAyer Search..."[/color][b][color=MAROON])[/color][/b]
             [b][color=MAROON]([/color][/b]setq ls [b][color=GREEN]([/color][/b]ssget[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b]
             [b][color=MAROON]([/color][/b]= [b][color=GREEN]([/color][/b]sslength ls[b][color=GREEN])[/color][/b] 1[b][color=MAROON])[/color][/b]
             [b][color=MAROON]([/color][/b]setq ln [b][color=GREEN]([/color][/b]cdr [b][color=BLUE]([/color][/b]assoc 8 [b][color=RED]([/color][/b]entget [b][color=PURPLE]([/color][/b]ssname ls 0[b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]


 [b][color=FUCHSIA]([/color][/b]and [b][color=NAVY]([/color][/b]setq ss [b][color=MAROON]([/color][/b]ssget [color=#2f4f4f]"X"[/color] [b][color=GREEN]([/color][/b]list [b][color=BLUE]([/color][/b]cons 0 [color=#2f4f4f]"POINT"[/color][b][color=BLUE])[/color][/b][b][color=BLUE]([/color][/b]cons 8 ln[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b]
      [b][color=NAVY]([/color][/b]princ [b][color=MAROON]([/color][/b]strcat [color=#2f4f4f]"\nSearching POINTs On LAyer"[/color] ln [color=#2f4f4f]"\n"[/color][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b]
      [b][color=NAVY]([/color][/b]setq i 0
           es [b][color=MAROON]([/color][/b]ssadd[b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b]
      [b][color=NAVY]([/color][/b]while [b][color=MAROON]([/color][/b]setq en [b][color=GREEN]([/color][/b]ssname ss i[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b]
             [b][color=MAROON]([/color][/b]princ [b][color=GREEN]([/color][/b]strcat [color=#2f4f4f]"\r"[/color] [b][color=BLUE]([/color][/b]rtos i 2 0[b][color=BLUE])[/color][/b] [color=#2f4f4f]"        "[/color][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b]
             [b][color=MAROON]([/color][/b]setq ed [b][color=GREEN]([/color][/b]entget en[b][color=GREEN])[/color][/b]
                   bp [b][color=GREEN]([/color][/b]cdr [b][color=BLUE]([/color][/b]assoc 10 ed[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b]
             [b][color=MAROON]([/color][/b]setq c 0[b][color=MAROON])[/color][/b]
             [b][color=MAROON]([/color][/b]while [b][color=GREEN]([/color][/b]setq cn [b][color=BLUE]([/color][/b]ssname ss c[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b]
                    [b][color=GREEN]([/color][/b]setq cd [b][color=BLUE]([/color][/b]entget cn[b][color=BLUE])[/color][/b]
                          cp [b][color=BLUE]([/color][/b]cdr [b][color=RED]([/color][/b]assoc 10 cd[b][color=RED])[/color][/b][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b]
                    [b][color=GREEN]([/color][/b]cond [b][color=BLUE]([/color][/b][b][color=RED]([/color][/b]and [b][color=PURPLE]([/color][/b]not [b][color=TEAL]([/color][/b]eq en cn[b][color=TEAL])[/color][/b][b][color=PURPLE])[/color][/b]
                                [b][color=PURPLE]([/color][/b]< [b][color=TEAL]([/color][/b]distance bp cp[b][color=TEAL])[/color][/b] x[b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b]
                           [b][color=RED]([/color][/b]if [b][color=PURPLE]([/color][/b]not [b][color=TEAL]([/color][/b]ssmemb en es[b][color=TEAL])[/color][/b][b][color=PURPLE])[/color][/b]
                               [b][color=PURPLE]([/color][/b]ssadd en es[b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b]
                           [b][color=RED]([/color][/b]if [b][color=PURPLE]([/color][/b]not [b][color=TEAL]([/color][/b]ssmemb cn es[b][color=TEAL])[/color][/b][b][color=PURPLE])[/color][/b]
                               [b][color=PURPLE]([/color][/b]ssadd cn es[b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b]
                    [b][color=GREEN]([/color][/b]setq c [b][color=BLUE]([/color][/b]1+ c[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b]
             [b][color=MAROON]([/color][/b]setq i [b][color=GREEN]([/color][/b]1+ i[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]

 [b][color=FUCHSIA]([/color][/b]if es
   [b][color=NAVY]([/color][/b]progn
     [b][color=MAROON]([/color][/b]princ [b][color=GREEN]([/color][/b]strcat [color=#2f4f4f]"\nErasing "[/color] [b][color=BLUE]([/color][/b]rtos [b][color=RED]([/color][/b]sslength es[b][color=RED])[/color][/b] 2 0[b][color=BLUE])[/color][/b] [color=#2f4f4f]" POINTs"[/color][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b]
     [b][color=MAROON]([/color][/b]command [color=#2f4f4f]"_.ERASE"[/color] es [color=#2f4f4f]""[/color][b][color=MAROON])[/color][/b]
     [b][color=MAROON]([/color][/b]redraw[b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]

 [b][color=FUCHSIA]([/color][/b]prin1[b][color=FUCHSIA])[/color][/b][b][color=BLACK])[/color][/b]

 

 

-David

Link to comment
Share on other sites

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

 Share

×
×
  • Create New...