Results 1 to 3 of 3

Thread: sorting selection sets

  1. #1
    chuck Guest

    sorting selection sets

    Why would this not work?
    It appears that I can only create three of the four selection sets, the
    parent set "ss1" and two out of the three "child" sets. Anyone know what I'm
    doing wrong here?
    Thanks

    __________________________________________________ __________________________
    _____________

    (defun c:dimsort ()
    (setvar "cmdecho" 0)
    (setq ss1 (ssget "X" '((0 . "DIMENSION"))))
    ; This grabs all dims in drawing.


    (setq ssr (ssadd)) ;This creates a new empty selection set.
    (setq ssa (ssadd)) ;This creates a new empty selection set.
    (setq ssd (ssadd)) ;This creates a new empty selection set.

    (setq R (cons 100 "AcDbRadialDimension"))
    (setq A (cons 100 "AcDb2LineAngularDimension"))
    (setq D (cons 100 "AcDbDiametricDimension"))
    ;Establish what you are looking for in the selection sets.

    (setq index 0)
    (repeat (sslength ss1)
    (setq dimobj (ssname ss1 index)) ; This grabs one dim object from the
    selection set.
    (setq dimguts (entget dimobj)) ; This shows the guts of the dim object.
    (if (member R dimguts)
    (progn (setq ssr (ssadd dimobj ssr))
    (setq ss1 (ssdel dimobj ss1))
    )
    ) ;if radial add to ssr remove from ss1
    (if (member A dimguts)
    (progn (setq ssa (ssadd dimobj ssa))
    (setq ss1 (ssdel dimobj ss1))
    )
    ) ;if angularl add to ssa remove from ss1
    (if (member D dimguts)
    (progn (setq ssd (ssadd dimobj ssd))
    (setq ss1 (ssdel dimobj ss1))
    )
    ) ;if diametric add to ssd remove from ss1
    (setq index (1+ index))
    )
    )
    ;should have four selection sets of dimensions
    ;one radial "ssr" one angular "ssa"one diametric "ssd"
    ; and one with all the others "ss1"

  2. #2
    Michael Bulatovich Guest
    I think you're running into trouble because you are deleting items from the
    original selection set
    as you go. When you get to a certain point, your counter incrementally grows
    to beyond
    the number of items left in the selection set and then your call for that
    entity data returns nil.
    Better to just always use the first item in SS1 as SS1 shrinks, or don't
    remove the items from
    SS1 until you are finished.
    --


    MichaelB
    www.michaelbulatovich.com

    "chuck" <chuck@nospam.wo> wrote in message
    news:Anikd.6128$hp3.683394@read2.cgocable.net...
    Why would this not work?
    It appears that I can only create three of the four selection sets, the
    parent set "ss1" and two out of the three "child" sets. Anyone know what
    I'm
    doing wrong here?
    Thanks


    __________________________________________________ __________________________
    _____________

    (defun c:dimsort ()
    (setvar "cmdecho" 0)
    (setq ss1 (ssget "X" '((0 . "DIMENSION"))))
    ; This grabs all dims in drawing.


    (setq ssr (ssadd)) ;This creates a new empty selection set.
    (setq ssa (ssadd)) ;This creates a new empty selection set.
    (setq ssd (ssadd)) ;This creates a new empty selection set.

    (setq R (cons 100 "AcDbRadialDimension"))
    (setq A (cons 100 "AcDb2LineAngularDimension"))
    (setq D (cons 100 "AcDbDiametricDimension"))
    ;Establish what you are looking for in the selection sets.

    (setq index 0)
    (repeat (sslength ss1)
    (setq dimobj (ssname ss1 index)) ; This grabs one dim object from the
    selection set.
    (setq dimguts (entget dimobj)) ; This shows the guts of the dim object.
    (if (member R dimguts)
    (progn (setq ssr (ssadd dimobj ssr))
    (setq ss1 (ssdel dimobj ss1))
    )
    ) ;if radial add to ssr remove from ss1
    (if (member A dimguts)
    (progn (setq ssa (ssadd dimobj ssa))
    (setq ss1 (ssdel dimobj ss1))
    )
    ) ;if angularl add to ssa remove from ss1
    (if (member D dimguts)
    (progn (setq ssd (ssadd dimobj ssd))
    (setq ss1 (ssdel dimobj ss1))
    )
    ) ;if diametric add to ssd remove from ss1
    (setq index (1+ index))
    )
    )
    ;should have four selection sets of dimensions
    ;one radial "ssr" one angular "ssa"one diametric "ssd"
    ; and one with all the others "ss1"

  3. #3
    Jeff Guest
    Compare this code to yours and find the errors of your ways ;-)

    (defun c:dimsort (/ A D DIMGUTS DIMOBJ INDEX R); SS1 SSA SSD SSR)
    (setvar "cmdecho" 0)
    (setq ss1 (ssget "X" '((0 . "DIMENSION"))))
    ; This grabs all dims in drawing.


    (setq ssr (ssadd)) ;This creates a new empty selection set.
    (setq ssa (ssadd)) ;This creates a new empty selection set.
    (setq ssd (ssadd)) ;This creates a new empty selection set.

    (setq R (cons 100 "AcDbRadialDimension"))
    (setq A (cons 100 "AcDb2LineAngularDimension"))
    (setq D (cons 100 "AcDbDiametricDimension"))
    ;Establish what you are looking for in the selection sets.

    (setq index 0)
    (repeat (sslength ss1)
    (setq dimobj (ssname ss1 index)) ; This grabs one dim object from
    theselection set.
    (setq dimguts (entget dimobj)) ; This shows the guts of the dim object.
    (if (member R dimguts)
    (progn (ssadd dimobj ssr)
    (ssdel dimobj ss1)
    (setq index (1- index))
    )
    ) ;if radial add to ssr remove from ss1
    (if (member A dimguts)
    (progn (ssadd dimobj ssa)
    (ssdel dimobj ss1)
    (setq index (1- index))
    )
    ) ;if angularl add to ssa remove from ss1
    (if (member D dimguts)
    (progn (ssadd dimobj ssd)
    (ssdel dimobj ss1)
    (setq index (1- index))
    )
    ) ;if diametric add to ssd remove from ss1
    (setq index (1+ index))
    )
    )
    ;should have four selection sets of dimensions
    ;one radial "ssr" one angular "ssa"one diametric "ssd"
    ; and one with all the others "ss1"



    --
    Jeff
    check out www.cadvault.com
    "chuck" <chuck@nospam.wo> wrote in message
    news:Anikd.6128$hp3.683394@read2.cgocable.net...
    Why would this not work?
    It appears that I can only create three of the four selection sets, the
    parent set "ss1" and two out of the three "child" sets. Anyone know what
    I'm
    doing wrong here?
    Thanks

    __________________________________________________ __________________________
    _____________

    (defun c:dimsort ()
    (setvar "cmdecho" 0)
    (setq ss1 (ssget "X" '((0 . "DIMENSION"))))
    ; This grabs all dims in drawing.


    (setq ssr (ssadd)) ;This creates a new empty selection set.
    (setq ssa (ssadd)) ;This creates a new empty selection set.
    (setq ssd (ssadd)) ;This creates a new empty selection set.

    (setq R (cons 100 "AcDbRadialDimension"))
    (setq A (cons 100 "AcDb2LineAngularDimension"))
    (setq D (cons 100 "AcDbDiametricDimension"))
    ;Establish what you are looking for in the selection sets.

    (setq index 0)
    (repeat (sslength ss1)
    (setq dimobj (ssname ss1 index)) ; This grabs one dim object from the
    selection set.
    (setq dimguts (entget dimobj)) ; This shows the guts of the dim object.
    (if (member R dimguts)
    (progn (setq ssr (ssadd dimobj ssr))
    (setq ss1 (ssdel dimobj ss1))
    )
    ) ;if radial add to ssr remove from ss1
    (if (member A dimguts)
    (progn (setq ssa (ssadd dimobj ssa))
    (setq ss1 (ssdel dimobj ss1))
    )
    ) ;if angularl add to ssa remove from ss1
    (if (member D dimguts)
    (progn (setq ssd (ssadd dimobj ssd))
    (setq ss1 (ssdel dimobj ss1))
    )
    ) ;if diametric add to ssd remove from ss1
    (setq index (1+ index))
    )
    )
    ;should have four selection sets of dimensions
    ;one radial "ssr" one angular "ssa"one diametric "ssd"
    ; and one with all the others "ss1"

Similar Threads

  1. filtering selection sets
    By William Ogle in forum Customization
    Replies: 0
    Last Post: 08-25-2005, 09:10 AM
  2. selection sets...
    By avw_410 in forum Customization
    Replies: 2
    Last Post: 03-11-2005, 11:19 AM
  3. How much maximum number of selection sets
    By Adesu in forum Customization
    Replies: 9
    Last Post: 03-09-2005, 02:19 PM
  4. Selection sets to extract changes made to drawing
    By Paul_66 in forum Customization
    Replies: 4
    Last Post: 02-16-2005, 07:12 PM
  5. Selection sets fine tuning
    By TCEBob in forum Customization
    Replies: 3
    Last Post: 01-30-2005, 08:18 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
  •  
Other forums: Access Forum - Microsoft Office Forum - Exchange Server Forum