See the top rated post in this thread. Click here

Page 1 of 4 1234 LastLast
Results 1 to 10 of 32

Thread: ssget closed polyline

  1. #1
    I could stop if I wanted to
    Join Date
    2004-11
    Location
    Somewhere close to hell
    Posts
    228
    Login to Give a bone
    0

    Default ssget closed polyline

    Does anyone know how to create a selection set of only closed polylines?
    The following specifies all polylines on specific layer, but I only need to grab closed boundaries.

    Code:
    (ssget "x" (list (cons 0 "LWPOLYLINE") (cons 8 "qsection")))
    Thanks,
    Rob

  2. #2
    AUGI Addict fixo's Avatar
    Join Date
    2005-05
    Location
    Pietari, Venäjä
    Posts
    1,269
    Login to Give a bone
    0

    Default Re: ssget closed polyline

    Quote Originally Posted by rad.77676
    Does anyone know how to create a selection set of only closed polylines?
    The following specifies all polylines on specific layer, but I only need to grab closed boundaries.

    Code:
    (ssget "x" (list (cons 0 "LWPOLYLINE") (cons 8 "qsection")))
    Thanks,
    Rob
    Hi Rob

    There is can to select with following expression:

    Code:
    (ssget "_X" (list (cons 0 "LWPOLYLINE")(cons 8 "qsection")(cons 70 1)))
    Select all closed polylines on layer "qsection"

    Thank you

    f.

  3. #3
    I could stop if I wanted to
    Join Date
    2004-11
    Location
    Somewhere close to hell
    Posts
    228
    Login to Give a bone
    1

    Default Re: ssget closed polyline

    Quote Originally Posted by fixo
    Hi Rob

    There is can to select with following expression:

    Code:
    (ssget "_X" (list (cons 0 "LWPOLYLINE")(cons 8 "qsection")(cons 70 1)))
    Select all closed polylines on layer "qsection"

    Thank you

    f.
    Thanx fixo,
    Next question, is there a way to create a selection set of objects that do not have a specific group of object data ("legal" ; field name)
    Rob

  4. #4
    Active Member
    Join Date
    2002-11
    Posts
    50
    Login to Give a bone
    0

    Default Re: ssget closed polyline

    Tear this apart. This is used to find polygons that don't have a object data table called "Disp" so if the object is simply missing the table use this.
    Code:
    ;;; Utility to find polygons that are missing object data.
    ;;; Set the table name to what it is supposed to be
    (defun c:no_od (/ item tables ss sset p1 p2)
      (prompt "\nSelect Objects to test by Window")
      (setq p1 (getpoint "\nFirst Corner: "))
      (setq p2 (getcorner p1 "\nSecond Corner: "))
      (setq sset	; this is the selection set of polygons to test
      (ssget
    	"c"
    	p1
    	p2
    	(list (cons 0 "LWPOLYLINE"))
      )
      )
      (if (= sset nil)   ; if nothing selected
    	(progn	; do this
    	  (princ)
    	  (alert "No polylines selected!")
    	  (exit)
    	)	 ; end of routine to run if no polygons selected
    	(progn	; if polygons have been selected do this
    	  (setq ss (ssadd))   ; make an empty selection set to put naked polygons
    	  (setq ctr 0)   ; set the counter to zero	  
    	  (setq numofpolygons (sslength sset)) ; how many polygons selected
    	  (while (and sset (> (sslength sset) 0))
     (setq item (ssname sset 0)) ; extract the name of first entity in the list.
     (setq tables (ade_odgettables item)) ; get the table names
     (if (= (member "Disp" tables) nil)
    	 ; if particular object data is missing 
       (progn   ;- in this case "Disp"
    	 (ssadd item ss)  ; add the item to the set to highlite
    	 (ssdel item sset)  ; delete the item from selection set being tested
       )
       (ssdel item sset)  ; otherwise delete the item from selection set being tested
     )
     (setq ctr (+ ctr 1))  ; increase the counter
     (princ
       (strcat "\rChecked " (itoa ctr) " of " (itoa numofpolygons))
     )
    	 ; checked ctr of numofpolygons
    	  )	 ; get next item
    	)	 ; end of routine to run if polygons selected
      )	 ; end of if
      (setq sset nil)   ; get rid of this now empty selection set
      (setq nood (sslength ss))  ; how many naked polygons
      (princ
    	(strcat "\n" (itoa nood) " polygons have no object data")
      )
      (sssetfirst ss ss)   ; highlite and grip the ss selection set
      (princ)	; clean exit
    )
    If the field is empty use (ade_odgetfield ename table field recnum)
    Remember the first recnum is 0 not 1
    If nil is returned, there is no data for that field.

  5. #5
    AUGI Addict fixo's Avatar
    Join Date
    2005-05
    Location
    Pietari, Venäjä
    Posts
    1,269
    Login to Give a bone
    0

    Default Re: ssget closed polyline

    Quote Originally Posted by rad.77676
    Thanx fixo,
    Next question, is there a way to create a selection set of objects that do not have a specific group of object data ("legal" ; field name)
    Rob
    Hi Rob
    Try this one

    Thank you

    f.
    Code:
    (ssget
    	'((-4 . "<NOT") (102 . "{ACAD_XDICTIONARY") (-4 . "NOT>"))
          )

  6. #6
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,811
    Login to Give a bone
    0

    Default Re: ssget closed polyline

    Quote Originally Posted by fixo
    Hi Rob
    There is can to select with following expression:
    (ssget "_X" (list (cons 0 "LWPOLYLINE")(cons 8 "qsection")(cons 70 1)))
    Select all closed polylines on layer "qsection"
    Sorry, but that will NOT select closed polylines whose linetype generation flag is set (because group 70 will = 129, not 1)

    Try this instead:

    (ssget "_X"
    (list
    (cons 0 "LWPOLYLINE")
    (cons 8 "qsection")
    (cons -4 "&")
    (cons 70 1)
    )
    )
    R.K. McSwain | CAD Panacea |

  7. #7
    AUGI Addict kennet.sjoberg's Avatar
    Join Date
    2002-05
    Posts
    1,707
    Login to Give a bone
    0

    Default Re: ssget closed polyline

    I think you need a function that select all lwpolylines on layer "qsection"
    and then release the not closed lwpolyline.
    Code:
    (defun SCP (/ SelSet Index ) ;; SelectClosedPolylines on layer "qsection"
      (setq SelSet (ssget "_X" (list (cons 0 "LWPOLYLINE" )(cons 8 "qsection" ))) Index 0 )
      (repeat (sslength SelSet ) ;; step through every and check if closed
        (if (= (logand 1 (cdr (assoc 70 (entget (ssname SelSet Index ))))) 1 )
          (setq Index (1+ Index ) ) ;; if closed step to next item
          (ssdel (ssname SelSet Index ) SelSet ) ;; if not closed release from SelSet
        )
      )
      SelSet ;; Left is only closed lwpolyline in the Selset
    )
    test : (command "._move" (SCP) "" pause pause )

    : ) Happy Computing !

    kennet

  8. #8
    AUGI Addict fixo's Avatar
    Join Date
    2005-05
    Location
    Pietari, Venäjä
    Posts
    1,269
    Login to Give a bone
    0

    Default Re: ssget closed polyline

    Quote Originally Posted by rkmcswain
    Sorry, but that will NOT select closed polylines whose linetype generation flag is set (because group 70 will = 129, not 1)

    Try this instead:

    (ssget "_X"
    (list
    (cons 0 "LWPOLYLINE")
    (cons 8 "qsection")
    (cons -4 "&")
    (cons 70 1)
    )
    )
    Oh sorry I forgot about this flag
    Of course there is big mistake:

    (ssget '((70 . 129)));linetype generation enabled
    (ssget '((70 . 1)));linetype generation disabled

    Thank you for notation

    f.

  9. #9
    AUGI Addict kennet.sjoberg's Avatar
    Join Date
    2002-05
    Posts
    1,707
    Login to Give a bone
    0

    Default Re: ssget closed polyline

    If you did not like my previous (SCP) function with the logand 1 filter, there the bit code allows only closed lwpolylines regardless of plinegen, you can use this simple line :
    Code:
    (ssget "X" '((-4 . "<AND") (0 . "LWPOLYLINE")(8 . "qsection")(-4 . "<OR")(70 . 1)(70 . 129)(-4 . "OR>")(-4 . "AND>")))
    : ) Happy Computing !

    kennet

  10. #10
    AUGI Addict fixo's Avatar
    Join Date
    2005-05
    Location
    Pietari, Venäjä
    Posts
    1,269
    Login to Give a bone
    0

    Default Re: ssget closed polyline

    Quote Originally Posted by kennet.sjoberg
    If you did not like my previous (SCP) function with the logand 1 filter, there the bit code allows only closed lwpolylines regardless of plinegen, you can use this simple line :
    Code:
    (ssget "X" '((-4 . "<AND") (0 . "LWPOLYLINE")(8 . "qsection")(-4 . "<OR")(70 . 1)(70 . 129)(-4 . "OR>")(-4 . "AND>")))
    : ) Happy Computing !

    kennet
    Hi Kennet

    I not sure but I thought maybe in this case better yet to use following filter
    because of splined LWPOLYLINE would be converted to POLYLINE:
    Code:
    (ssget "_X"
    (list
    (cons 0 "*POLYLINE")
    (cons 8 "qsection")
    (cons -4 "&")
    (cons 70 1)
    )
    )
    What you think about?
    Thank you

    f.

Page 1 of 4 1234 LastLast

Similar Threads

  1. Area without a closed polyline
    By Wish List System in forum AutoCAD Wish List
    Replies: 1
    Last Post: 2014-02-11, 03:07 PM
  2. Create a Surface from a Closed Polyline
    By autocad.wishlist1734 in forum AutoCAD Wish List
    Replies: 0
    Last Post: 2007-05-26, 06:42 PM
  3. SSget a Polyline via 1 of 2 intermediate points
    By tany0070 in forum AutoLISP
    Replies: 4
    Last Post: 2007-05-03, 01:40 PM
  4. C# - closed Polyline length
    By RoSiNiNo in forum ARX
    Replies: 1
    Last Post: 2005-03-02, 03:17 PM
  5. Getting the centroid of closed polyline
    By csgohjmj in forum AutoLISP
    Replies: 24
    Last Post: 2004-10-15, 06:01 AM

Posting Permissions

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