+ Reply to Thread
Results 1 to 9 of 9
  1. #1
    Senior Member Cymro's Avatar
    Using
    AutoCAD 2008
    Join Date
    Jul 2006
    Location
    Gwynedd Wales
    Posts
    165

    Default Selecting objects within a polyline

    Hi
    I hope someone can help me.

    I am trying to change the properties of objects within a closed polyline.

    There are 32000 objects so I can't select them individually and the polyline has 2100 vertices so selection through wp is not practicable.

    Is there a command that selects objects within a polyline that I have overlooked? or does someone have a lisp that does this.

    thanks in advance

    Stephen

  2. #2
    Super Member ASMI's Avatar
    Using
    AutoCAD 2008
    Join Date
    Nov 2005
    Location
    Oceanus Procellarum, Moon
    Posts
    1,427

    Default

    Try this:

    Code:
    (defun c:pls(/ plSet ptLst plSet)
      (princ"\n<<< Select polyline >>> ")
      (and
       (setq plSet
    	  (ssget "_:S" '((0 . "LWPOLYLINE"))))
       (setq ptLst
           (mapcar
    	 '(lambda(x)(trans x 0 1))
    	(mapcar 'cdr
    	  (vl-remove-if-not
    	    '(lambda(x)(= 10(car x)))
    	      (entget
    	        (ssname plSet 0))))))
       (sssetfirst nil
         (setq plSet(ssget "_WP" ptLst)))
       (if plSet
       (princ
         (strcat "\n"(itoa(sslength plSet))
    	     " found :) ")
         ); end princ
         (princ "\nNothing found :( ")
        );end if
       ); end and
      (princ)
      ); end of c:plset
    If you need crossing selection, change "_WP" to "_CP".

    Unfortunately function ssget not always correctly works with a lot of vertexes.

    All your polyline should be visible on the screen!
    Last edited by ASMI; 9th Feb 2007 at 01:13 pm. Reason: Fix error working in UCS. Now Ok.

  3. #3
    Super Member ASMI's Avatar
    Using
    AutoCAD 2008
    Join Date
    Nov 2005
    Location
    Oceanus Procellarum, Moon
    Posts
    1,427

    Default

    Fixed error with working in UCS.

  4. #4
    Senior Member Cymro's Avatar
    Using
    AutoCAD 2008
    Join Date
    Jul 2006
    Location
    Gwynedd Wales
    Posts
    165

    Default

    Thanks ASMI

    you are a star.

    did not work with my original polyline as it was too complex but it does work with simpler ones.

    I wish I could lisp, I did try years ago but did not have the time to do a good job of it.

  5. #5
    Super Member ASMI's Avatar
    Using
    AutoCAD 2008
    Join Date
    Nov 2005
    Location
    Oceanus Procellarum, Moon
    Posts
    1,427

    Default

    Thank you.

    did not work with my original polyline as it was too complex but it does work with simpler ones.
    Yes it's SSGET problem This problem can be solved having applied other algorithm, but I did not have time.

  6. #6
    Forum Newbie
    Using
    AutoCAD 2000
    Join Date
    Feb 2007
    Posts
    2

    Default

    Quote Originally Posted by ASMI View Post
    Thank you.



    Yes it's SSGET problem This problem can be solved having applied other algorithm, but I did not have time.

    Hi I try lisp but it also does not work if polyline contains any arc or other eliptic thing but it works so clearly in rectangle polylines could you help me I realy need this

  7. #7
    Super Member ASMI's Avatar
    Using
    AutoCAD 2008
    Join Date
    Nov 2005
    Location
    Oceanus Procellarum, Moon
    Posts
    1,427

    Default

    This problem can be solved not only for polylines with any quantity of vertexes and arc segments but also for circles of ellipses and splines. But unfortunately at now there is other obligation on a writing of the program for drawing pipes. However if who that another wishes try to realize it, I can prompt algorithm without use SSGET.

    1. Aproximate all not direct segments of curves in points with small step with function vlax-curve-GetPointAtDist.
    2.Get all objects bounding boxes by means of function vla-GetBoundingBox.
    3.To take advantage of algorithm of "tracer ray" for a finding of points inside of a contour of selection. Here its description (I know only Russian description) http://algolist.manual.ru/maths/geom/belong/poly2d.php .
    4. For objects at which points of the Bounding Box are both inside of a contour and behind its limits to lead additional check, aproximate them to points as 1.

    As a result the code will turn out enough big in comparison with it. I wish to notice, that VisualLISP concerns to languages with average speed and in many cases it will work very long. As 1. in general it is impossible to realize on VBA for such objects as spline, and for others it is required a code in tens times more than on lisp, it is better to solve a task on ObjectArx (C++).

  8. #8
    Forum Newbie
    Using
    AutoCAD 2000
    Join Date
    Feb 2007
    Posts
    2

    Default

    hi again thanx for algorithm. I just want to a wuestion too about this lisp. I want to select "solid, line, 3dface,3d polyline, region and spline" within the polyline when ı select the polyline Is this possible with this algrothm thanx for everthing again?

  9. #9
    Super Member ASMI's Avatar
    Using
    AutoCAD 2008
    Join Date
    Nov 2005
    Location
    Oceanus Procellarum, Moon
    Posts
    1,427

    Default

    Registered forum members do not see this ad.

    This algorithm determines an accessory of a point to the closed contour. Certainly for a filtration entities which can be crossed with border of a contour it is necessary to apply method IntersectWith.

Similar Threads

  1. problem selecting objects etc....
    By liam walker in forum AutoCAD Beginners' Area
    Replies: 4
    Last Post: 10th Nov 2006, 11:54 am
  2. Porblems with selecting objects
    By greenbigg in forum AutoCAD Beginners' Area
    Replies: 2
    Last Post: 6th Nov 2006, 09:19 pm
  3. Problem selecting objects.
    By kickin4life in forum AutoCAD Drawing Management & Output
    Replies: 2
    Last Post: 13th Sep 2006, 03:39 pm
  4. selecting/picking objects
    By jsayle in forum AutoCAD Drawing Management & Output
    Replies: 2
    Last Post: 12th Apr 2006, 03:37 pm
  5. selecting objects
    By jrobII in forum AutoCAD Drawing Management & Output
    Replies: 3
    Last Post: 18th Jul 2005, 04:06 pm

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts