Author Topic: Selection Set Inside a Polyline  (Read 9039 times)

0 Members and 1 Guest are viewing this topic.

Scott

  • Bull Frog
  • Posts: 244
Selection Set Inside a Polyline
« on: August 28, 2004, 09:49:58 PM »
Hello all,

Does anyone have and if so would be willing to share a lisp or some other method of selecting a polyline and having all the entities inside the polyline be selected so they can be moved to a different layer or deleted?  What I have is a survey of a pond.  I want to be able to draw a polyline around the top of the pond and be able to move or delete all the survey points inside that line.  This way we can import the new survey points from a second survey and not have to worry about the first survey points being used when my software draws tins and contours.  I'm using Map 5.  Is this possible?  

Thanks in advance,

Scott

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Selection Set Inside a Polyline
« Reply #1 on: August 28, 2004, 10:10:28 PM »
Scott have you tried using Select and the WPolygon option.
Quote

AutoCAD requires that objects be selected in order to be processed. The Select Objects prompt occurs after many commands, including the SELECT command itself.

You can select objects individually with the pointing device, by drawing a selection window around them, by entering coordinates, or by using one of the selection methods listed below. These methods can be used to select objects regardless of the command that initiated the Select Objects prompt. To view all options, enter ? on the command line.

Expects a point or

Window/Last/Crossing/BOX/ALL/Fence/WPolygon/CPolygon/Group/Add/Remove/Multiple/Previous/Undo/AUto/SIngle

Select objects:  Specify a point or enter an option

WPolygon
Selects objects completely inside a polygon defined by points. The polygon can be any shape but cannot cross or touch itself. AutoCAD draws the last segment of the polygon so that it is closed at all times. WPolygon is not affected by the PICKADD system variable.

First polygon point:  Specify a point

Specify endpoint of line or [Undo]:  Specify a point or enter u to undo the last point

 
 
CPolygon
Selects objects within and crossing a polygon defined by specifying points. The polygon can be any shape but cannot cross or touch itself. AutoCAD draws the last segment of the polygon so that it is closed at all times. CPolygon is not affected by the PICKADD system variable.


First polygon point:  Specify a point

Specify endpoint of line or [Undo]:  Specify a point or enter u to undo the last point

 
TheSwamp.org  (serving the CAD community since 2003)

Scott

  • Bull Frog
  • Posts: 244
Selection Set Inside a Polyline
« Reply #2 on: August 29, 2004, 09:14:08 PM »
Mark

I looked into that.  I couldn't get it to work the way I need.  using that method will select all the objects within the Wpolygon, but I can't move them to another layer.  I must be doing something wrong.  I usually have to draw a polyline around the top of my borrow pit, so being able to select that line and have all the entities within the polyline be selected would work a lot better for me.  Thanks for the advice though.

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Selection Set Inside a Polyline
« Reply #3 on: August 30, 2004, 08:40:00 AM »
this is messy and quick but it should give you an idea.
Code: [Select]

(defun c:pts-inside (/ ent pl_obj cc pt_lst_cnt pt_lst cntr ss)
  (if (setq ent (car (entsel "\nSelect PLINE: ")))
(progn
 (setq pl_obj (vlax-ename->vla-object ent)
cc   (vla-get-Coordinates pl_obj)
)

 (setq pt_lst_cnt
(/ (length
 (vlax-safearray->list
(vlax-variant-value cc)
)
 )
2
)
)

 (setq cntr 0)
 (repeat pt_lst_cnt
(setq pt_lst
(cons
  (vlax-safearray->list
(vlax-variant-value (vla-get-Coordinate pl_obj cntr))
)
  pt_lst
  )
 cntr (1+ cntr)
 )
)
 )
)

  (setq ss (ssget "_WP" pt_lst '((0 . "POINT"))))

  (command "_.erase" ss "")

  )
TheSwamp.org  (serving the CAD community since 2003)

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Selection Set Inside a Polyline
« Reply #4 on: August 30, 2004, 08:42:46 AM »
Quote from: Scott
Mark

I looked into that.  I couldn't get it to work the way I need.  using that method will select all the objects within the Wpolygon, but I can't move them to another layer.  I must be doing something wrong.  I usually have to draw a polyline around the top of my borrow pit, so being able to select that line and have all the entities within the polyline be selected would work a lot better for me.  Thanks for the advice though.


The 'Select' should work.  Could you post a copy of your drwaing?
Sometimes you hane to use the 'Previous' option because the selection set was cleared when the next command is entered.
What command were you using to change them to a new layer? Did you see the objects selected when you used the Select command?
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Scott

  • Bull Frog
  • Posts: 244
Selection Set Inside a Polyline
« Reply #5 on: August 30, 2004, 09:27:32 PM »
Mark,

Thanks for the routine, but I get this when I run it:


Command: pts-inside
Select PLINE: _.erase
Select objects:
Command: PTS-INSIDE Unknown command "PTS-INSIDE".  Press F1 for help.
Command: nil

CAB

I can see the points being selected when I use the select and WP commands, but as soon as I run another command to move them, they are deselected.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Selection Set Inside a Polyline
« Reply #6 on: August 30, 2004, 10:28:37 PM »
Quote from: Scott

I can see the points being selected when I use the select and WP commands, but as soon as I run another command to move them, they are deselected.


What is the next command?
If it is MOVE, then enter:
MOVE
P
[enter]
and you have your selection set ready to move. 8)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Scott

  • Bull Frog
  • Posts: 244
Selection Set Inside a Polyline
« Reply #7 on: August 31, 2004, 09:55:47 AM »
CAB

It doens't give me another option.  I type move and it prompts me to select objects again.

Kate M

  • Guest
Selection Set Inside a Polyline
« Reply #8 on: August 31, 2004, 10:01:31 AM »
Is PICKFIRST set to 1?

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Selection Set Inside a Polyline
« Reply #9 on: August 31, 2004, 10:26:50 AM »
Quote from: Scott
CAB

It doens't give me another option.  I type move and it prompts me to select objects again.

You don see the option but the option is still availabe to you.
Here let me show you how its done:
Code: [Select]
Command: select

Select objects: wp

First polygon point:
Specify endpoint of line or [Undo]:
Specify endpoint of line or [Undo]:
Specify endpoint of line or [Undo]:
Specify endpoint of line or [Undo]:
16 found            {here is your selection set}

Select objects:  {enter pressed}

Command: move

Select objects: p   {enter p here}
16 found               {you see the previous selection set}

Select objects:  {enter pressed}
Specify base point or displacement: Specify second point of displacement or
<use first point as displacement>:
Command:
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Scott

  • Bull Frog
  • Posts: 244
Selection Set Inside a Polyline
« Reply #10 on: August 31, 2004, 01:27:18 PM »
Cab,

That does it, thanks for the help
Scott

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Selection Set Inside a Polyline
« Reply #11 on: August 31, 2004, 02:00:06 PM »
Quote from: Scott
Cab,

That does it, thanks for the help
Scott

You're welcome.
Mark has a excelant routine, but you should be aware of your options.

CAB
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.