How to select polylines at a certain elevation ???

Discussion in 'AutoCAD' started by Dave, Jun 12, 2004.

  1. Dave

    Dave Guest

    Ok Guys,

    I am trying to select a polyline which represents a contour.
    This polyline has all its vertices at the same elevation (like every good
    contour should)

    The code I am using is

    ......
    (setq elevation 60.5)
    (setq S (ssget "X" (list (cons 38 elevation))))
    ......

    This doesnt return anything yet there are several contours at that elevation

    From what I can tell its something a little tricky with the way polyline
    entities are handled

    Any help appreciated.

    Regards
    Dave
     
    Dave, Jun 12, 2004
    #1
  2. Dave

    Dave Guest

    Anyone ????

    I have gone about it differently but I am sure it is not elegant

    Got some clues off the afralisp site

    It works though and that is the main point

    But my question still applies about the selecting polylines at a constant
    elevation using a filter ?

    Is it possible ???

    Anyway this is what I did

    (Defun C:contour_stripper (/)
    (setq start_contour 0.5)
    (setq end_contour 150.5)
    (setq interval 1)
    (setq current_contour start_contour)
    (setq stripped_layer "STRIPPED")
    (command "layer" "m" stripped_layer "")
    (while (> end_contour current_contour)
    (grtext -2 (strcat (itoa (fix (* (/ current_contour end_contour) 100)))"%
    Complete"))
    (setq S (ssget "X" (list (cons 0 "POLYLINE"))))
    (setq sss (ssadd))
    (setq numofentities (sslength s))
    (setq entity_index 0.0)
    (repeat numofentities
    (setq current_entity (entget (ssname s entity_index)))
    (setq e1 (entget (entnext (cdr (car current_entity)))))
    (setq current_entity_elevation (car (cdddr (assoc 10 e1))))
    (if (= current_entity_elevation current_contour)
    (progn
    (ssadd (ssname s entity_index) sss)
    (command "change" sss "" "p" "la" stripped_layer "")
    );end progn
    );end if
    (setq entity_index (+ entity_index 1))
    );end repeat
    (setq current_contour (+ current_contour interval))
    );end while
    );end of defun

    ;this routine rips contours to a separate layer for deletion
     
    Dave, Jun 17, 2004
    #2
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.