Page 2 of 2 FirstFirst 12
Results 11 to 17 of 17

Thread: ssget selecting everything on a layer

  1. #11
    The Silent Type RobertB's Avatar
    Join Date
    2000-01
    Location
    Seattle WA USA
    Posts
    5,859
    Login to Give a bone
    0

    Talking Re: ssget selecting everything on a layer

    Quote Originally Posted by jack.foster View Post
    ... If someone knows the VL-commands enough to change the CHPROP section to work faster with VL commands that would be great.
    Code:
    (vl-load-com)
    ;;;changes entities from layer whose color is 251 to specified layer
    (defun c:ElecChngLayByColor	(/ acadobject activedocument LayerTable thelist clc klay_name i aObj)
    ;;;Creates a layer for entities to be moved to
      (command "-layer" "m" "background" "c" "6" "background" "") ;_ end command
      (setq acadobject (vlax-get-Acad-Object))
      (setq activedocument (vla-get-activedocument acadobject))
      (setq LayerTable (vla-get-layers activedocument))
      (vlax-for each LayerTable
        (setq klay_name (vla-get-name each))
        (setq clc (vla-get-color each))
    ;;;above is VL stuff I don't fully understand but it walks through
    ;;;layer table and gets the color assigned to each layer
    ;;;if the color is 251 then the "(cond" section runs
        (if (= clc 251)
          (cond ((setq ss1 (ssget "X" (list (cons 8 klay_name)))) 
                 (repeat (setq i (sslength ss1))
                  (setq aObj (vlax-EName->vla-Object (ssname ss1 (setq i (1- i)))))
                  (vla-Put-Layer aObj "Background")
                  (vla-Put-Color aObj acByLayer))))
        ) ;_ end if
      ) ;_ end of vlax-for
      (princ "That's All Folks!")
      (princ)
    );defun
    Last edited by Opie; 2009-06-17 at 01:04 PM. Reason: fixed quote tag
    R. Robert Bell
    Design Technology Manager
    Stantec
    Opinions expressed are mine alone and do not reflect the views of Stantec.

  2. #12
    100 Club
    Join Date
    2000-11
    Posts
    140
    Login to Give a bone
    0

    Default Re: ssget selecting everything on a layer

    Thank you Robert that is definitely faster. However; with our user's and the drawings we are working with I may stay with CHPROP and here is why. My test drawing has 43,000+ entities in it on 500+ different layers. With the CHPROP running each time a layer is changed you see the color change to the screen so you know the program has not locked up. We are looking at 30 seconds plus for this to run. With past network problems we had unbelieveable lags that would take 30 seconds to draw a line. Everyone is so used to that and all the lockups they will think this is a lockup when it is actually still running. Your post is definitely the better of the two and I may just let the user's decide which they prefer. Much appreciated, Jack.

  3. #13
    The Silent Type RobertB's Avatar
    Join Date
    2000-01
    Location
    Seattle WA USA
    Posts
    5,859
    Login to Give a bone
    0

    Default Re: ssget selecting everything on a layer

    You could add a spinner to let them know it is still working.
    R. Robert Bell
    Design Technology Manager
    Stantec
    Opinions expressed are mine alone and do not reflect the views of Stantec.

  4. #14
    100 Club
    Join Date
    2000-11
    Posts
    140
    Login to Give a bone
    0

    Default Re: ssget selecting everything on a layer

    I thought about adding a spinner but I just did a time comparison and they were nearly the same, about 26 seconds to do everything. The savings isn't enough to justify the spinner and it is kind of cool to watch things all over the screen change their colors to the new bylayer color of the layer they are placed on. Thanks again to everyone for all the help and also hoping somebody can copy and modify to create some other program.

  5. #15
    Certifiable AUGI Addict
    Join Date
    2015-11
    Location
    Jo'burg SA
    Posts
    4,512
    Login to Give a bone
    0

    Default Re: ssget selecting everything on a layer

    Quote Originally Posted by RobertB View Post
    Code:
      (vlax-for each LayerTable
    ;; ........
        (if (= clc 251)
          (cond ((setq ss1 (ssget "X" (list (cons 8 klay_name)))) 
    ;; ........
       ) ;_ end if
      ) ;_ end of vlax-for
    That could get dangerous ... you are only allowed 128 active selection sets. As per Robert & my posts in this thread. You'll need a (setq ss1 nil) and a (gc) just after the end of the repeat loop.

    Otherwise if there's more than 128 layers, you could get an error. The gc should be called to force the release of the selection set from RAM ... otherwise Lisp waits for some idle time to release it (which may only happen once the code completes).

  6. #16
    The Silent Type RobertB's Avatar
    Join Date
    2000-01
    Location
    Seattle WA USA
    Posts
    5,859
    Login to Give a bone
    0

    Default Re: ssget selecting everything on a layer

    Quote Originally Posted by irneb View Post
    That could get dangerous ... you are only allowed 128 active selection sets. As per Robert & my posts in this thread. You'll need a (setq ss1 nil) and a (gc) just after the end of the repeat loop.
    Good point, and an ironic cross posting eh?
    R. Robert Bell
    Design Technology Manager
    Stantec
    Opinions expressed are mine alone and do not reflect the views of Stantec.

  7. #17
    Certifiable AUGI Addict
    Join Date
    2015-11
    Location
    Jo'burg SA
    Posts
    4,512
    Login to Give a bone
    0

    Default Re: ssget selecting everything on a layer

    It never rains, but it pours doesn't it?

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Replies: 4
    Last Post: 2014-03-02, 01:06 AM
  2. Selecting Objects Defpoints Layer
    By Mac Demer in forum AutoCAD General
    Replies: 3
    Last Post: 2007-07-19, 11:26 AM
  3. SSGET returns error - bad SSGET list
    By tany0070 in forum AutoLISP
    Replies: 2
    Last Post: 2007-03-09, 07:26 AM
  4. Selecting Object does not indicate Layer it is on
    By tmorrow91 in forum AutoCAD General
    Replies: 8
    Last Post: 2005-05-24, 10:12 PM
  5. Layer selecting and locking
    By CADMama in forum ACA General
    Replies: 8
    Last Post: 2005-04-14, 07:26 PM

Posting Permissions

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