See the top rated post in this thread. Click here

Results 1 to 10 of 10

Thread: Changing objects layers - Selection set limit?

  1. #1
    Active Member tuomo.jarvinen's Avatar
    Join Date
    2015-09
    Location
    Jyväskylä, Finland
    Posts
    53
    Login to Give a bone
    0

    Default Changing objects layers - Selection set limit?

    Hi,

    I have 1 833 184 points on layer "Puu".
    I can easily and fast count them with (setq point_count (sslength (ssget "_X" '((0 . "POINT") (8 . "Puu")))))

    I want to divide them into layers "koivu", "manty" and "kuusi".

    I have used following code:

    Code:
    (defun c:1b1puu (/ sset a Ent)
    (setvar "cmdecho" 0)
    (command "_.undo" "begin")
    
    (command "_.-layer" "m" "koivu" "c" 1 "koivu" "")
    (command "_.-layer" "m" "manty" "c" 2 "manty" "")
    (command "_.-layer" "m" "kuusi" "c" 3 "kuusi" "")
    
    
    (princ "\n Select")
    (setq sset (ssget))
    (setq a 0)
    
    (setq lkm (sslength sset))
    
    (setq lkm (/ (sslength sset) 3))
    
    (repeat lkm
    
    (setq Ent (ssname sset a))
    (command "_change" Ent "" "p" "la" "koivu" "")
    (setq a (1+ a))
    
    (setq Ent (ssname sset a))
    (command "_change" Ent "" "p" "la" "manty" "")
    (setq a (1+ a))
    
    (setq Ent (ssname sset a))
    (command "_change" Ent "" "p" "la" "kuusi" "")
    (setq a (1+ a))
    
    )
    
    (command "_.undo" "end")
    (setvar "cmdecho" 1)
    (princ)
    )
    It works if i select small parts at a time. Slowly, but works.
    I have Object limit for Properties palette (PROPOBJLIMIT) set to 0.
    I have HIGHLIGHT set to 0.

    However, If I try to make it work all the 1 833 184 points at the same time, it doesn't seem to complete.
    The processor runs at full power but the work doesn't get done even over the night.

    Code:
    (defun c:1b1puu (/ sset a Ent)
    (setvar "cmdecho" 0)
    (command "_.undo" "begin")
    
    (command "_.-layer" "m" "koivu" "c" 1 "koivu" "")
    (command "_.-layer" "m" "manty" "c" 2 "manty" "")
    (command "_.-layer" "m" "kuusi" "c" 3 "kuusi" "")
    
    
    ;(princ "\n Select")
    (setq sset (ssget "_X" '((0 . "POINT") (8 . "Puu"))))
    
    (setq a 0)
    
    (setq lkm (sslength sset))
    
    (setq lkm (/ (sslength sset) 3))
    
    (repeat lkm
    
    (setq Ent (ssname sset a))
    (command "_change" Ent "" "p" "la" "koivu" "")
    (setq a (1+ a))
    
    (setq Ent (ssname sset a))
    (command "_change" Ent "" "p" "la" "manty" "")
    (setq a (1+ a))
    
    (setq Ent (ssname sset a))
    (command "_change" Ent "" "p" "la" "kuusi" "")
    (setq a (1+ a))
    
    )
    
    (command "_.undo" "end")
    (setvar "cmdecho" 1)
    (princ)
    )
    ...is there a limit with objects in selection set?
    ...or is there an easier way to do this?

  2. #2
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,725
    Login to Give a bone
    0

    Default Re: Changing objects layers - Selection set limit?

    Consider changing the Layer Property of each Point's vla-object, rather than invoking the CHANGE Command for each ename.
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  3. #3
    Member
    Join Date
    2006-11
    Posts
    5
    Login to Give a bone
    1

    Default Re: Changing objects layers - Selection set limit?

    Bonjour tuomo.jarvinen

    I am not aware of a limit of number of objects selected in a ssget, however the number of ssget is limited, it is 126
    To answer your question, look as blackbox says, on the vla options.

    While waiting for your research I propose you an alternative in autolisp faster than "command".
    It is true that the number of points is high put the time of my routine is counted in minutes not in hours, tested on 1,500,000 points

    Code:
    (setq ss (ssget "_x" (list (cons 0 "POINT"))))
    (setq n -1)
    (repeat (sslength ss)
        (setq ent-liste (entget (ssname ss (setq n (1+ n)))))
        (entmod (subst (cons 8 "calque1") (assoc 8 ent-liste) ent-liste))
        (setq ent-liste (entget (ssname ss (setq n (1+ n)))))
        (entmod (subst (cons 8 "calque2") (assoc 8 ent-liste) ent-liste))
        (setq ent-liste (entget (ssname ss (setq n (1+ n)))))
        (entmod (subst (cons 8 "calque3") (assoc 8 ent-liste) ent-liste))
        )
    Sorry, I couldn’t find a way to format my code on the site.

    Amicalement
    Last edited by Opie; 2024-05-13 at 06:00 PM. Reason: [code] tags added

  4. #4
    Active Member tuomo.jarvinen's Avatar
    Join Date
    2015-09
    Location
    Jyväskylä, Finland
    Posts
    53
    Login to Give a bone
    0

    Default Re: Changing objects layers - Selection set limit?

    Thanks for the tips!
    I haven't done any vba stuff yet.. Good to know that it's the right direction!

    - - - Updated - - -

    - - - Updated - - -

    Quote Originally Posted by did-ave View Post
    Bonjour tuomo.jarvinen

    I am not aware of a limit of number of objects selected in a ssget, however the number of ssget is limited, it is 126
    To answer your question, look as blackbox says, on the vla options.

    While waiting for your research I propose you an alternative in autolisp faster than "command".
    It is true that the number of points is high put the time of my routine is counted in minutes not in hours, tested on 1,500,000 points

    Code:
    (setq ss (ssget "_x" (list (cons 0 "POINT"))))
    (setq n -1)
    (repeat (sslength ss)
        (setq ent-liste (entget (ssname ss (setq n (1+ n)))))
        (entmod (subst (cons 8 "calque1") (assoc 8 ent-liste) ent-liste))
        (setq ent-liste (entget (ssname ss (setq n (1+ n)))))
        (entmod (subst (cons 8 "calque2") (assoc 8 ent-liste) ent-liste))
        (setq ent-liste (entget (ssname ss (setq n (1+ n)))))
        (entmod (subst (cons 8 "calque3") (assoc 8 ent-liste) ent-liste))
        )
    Sorry, I couldn’t find a way to format my code on the site.

    Amicalement
    It might be easier for me to try this first.

  5. #5
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    6,486
    Login to Give a bone
    0

    Default Re: Changing objects layers - Selection set limit?

    Quote Originally Posted by did-ave View Post
    Sorry, I couldn’t find a way to format my code on the site.
    Hello tuomo,
    There are more formatting options in the advanced editor. When you start a reply, click on the Go Advanced button in the lower right or the editor, next to Post Reply. To format for code, select your code, then click on the # button. You can also type in the code tags. PHP uses tags to format text. To see how Opie added the code tags to your post, click on the Edit Post button.
    C:> ED WORKING....


    LinkedIn

  6. #6
    Active Member tuomo.jarvinen's Avatar
    Join Date
    2015-09
    Location
    Jyväskylä, Finland
    Posts
    53
    Login to Give a bone
    0

    Default Re: Changing objects layers - Selection set limit?

    I got this to work! Great! Thanks!!!

    Code:
    (defun c:1b1puu (/ ss n ent-liste)
    (setvar "cmdecho" 0)
    (command "_.undo" "begin")
    
    (command "_.-layer" "m" "koivu" "c" 1 "koivu" "")
    (command "_.-layer" "m" "manty" "c" 2 "manty" "")
    (command "_.-layer" "m" "kuusi" "c" 3 "kuusi" "")
    
    
    ;VALITSEE PUUT
    (setq ss (ssget "_X" '((0 . "POINT") (8 . "Puu"))))
    (setq n -1)
    (repeat (sslength ss)
        (setq ent-liste (entget (ssname ss (setq n (1+ n)))))
        (entmod (subst (cons 8 "koivu") (assoc 8 ent-liste) ent-liste))
        (setq ent-liste (entget (ssname ss (setq n (1+ n)))))
        (entmod (subst (cons 8 "manty") (assoc 8 ent-liste) ent-liste))
        (setq ent-liste (entget (ssname ss (setq n (1+ n)))))
        (entmod (subst (cons 8 "kuusi") (assoc 8 ent-liste) ent-liste))
        )
    
    (command "_.undo" "end")
    (setvar "cmdecho" 1)
    (princ)
    )

  7. #7
    Member
    Join Date
    2006-11
    Posts
    5
    Login to Give a bone
    0

    Default Re: Changing objects layers - Selection set limit?

    Bonjour

    I’m glad I helped you

    other thing : not VBA... vLa functions

    Amicalement

  8. #8
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,725
    Login to Give a bone
    0

    Default Re: Changing objects layers - Selection set limit?

    Just pointing out that this splits Points on "Puu" Layer without any logic or criteria, other than to alternate the Selection Set's iteration to the three target layers.
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  9. #9
    Active Member tuomo.jarvinen's Avatar
    Join Date
    2015-09
    Location
    Jyväskylä, Finland
    Posts
    53
    Login to Give a bone
    0

    Default Re: Changing objects layers - Selection set limit?

    Thanks, I'm aware of that. In the future, I might want to adjust the relationships ("puu" = tree, "koivu" = birch, "manty" = pine and "kuusi" = spruce, aim is to create a mixed forest).

    - - - Updated - - -

    Quote Originally Posted by did-ave View Post
    Bonjour

    I’m glad I helped you

    other thing : not VBA... vLa functions

    Amicalement
    thanks..

  10. #10
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,135
    Login to Give a bone
    0

    Default Re: Changing objects layers - Selection set limit?

    Quote Originally Posted by tuomo.jarvinen View Post
    Thanks, I'm aware of that. In the future, I might want to adjust the relationships ("puu" = tree, "koivu" = birch, "manty" = pine and "kuusi" = spruce, aim is to create a mixed forest)..
    To make it a bit more scattered, you might consider a random number generator to determine which type/layer to assign the point in conjunction with a cond statement instead of the multiple if statements.
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

Similar Threads

  1. limit xref layer states to work on xref layers
    By Wish List System in forum AutoCAD Wish List
    Replies: 0
    Last Post: 2015-06-25, 06:13 PM
  2. Room: Upper Limit and Limit offset
    By nnguyen in forum Revit Architecture - General
    Replies: 5
    Last Post: 2013-01-21, 10:30 AM
  3. Limit Regens to only changed layers
    By autocad.wishlist1734 in forum AutoCAD Wish List
    Replies: 0
    Last Post: 2007-11-28, 12:54 PM
  4. Replies: 0
    Last Post: 2004-09-21, 08:00 PM
  5. Set all objects in a selection set to 0 elvation in the Z axis
    By jagnag in forum AutoCAD 3D (2006 or below)
    Replies: 4
    Last Post: 2004-07-16, 08:18 PM

Tags for this Thread

Posting Permissions

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