Jump to content

Recommended Posts

Posted

Hello everybody,  I need a selection set for flatten command. but ı have a list what include entity. So ı think to convert list to selection set.

(setq objList '())
(while ....
(if ...
(setq objList (append (list obj) objList))
)
)
(setq selSet (ssadd))
(foreach ent objList
  (ssadd ent selSet)
)

I used to this code but now not working. Where ı make a mistake? Can u help me?

Posted

Hi
Without first knowing what's in 'objlist', it's difficult to know why its entities aren't included in the set.
It's essential to know what the previous 'while' process is.
In principle, if 'objlist' is a list of entity names, the code should work.

Posted

So: make sure 'objlist' is a list of entity names

Posted

 

 

  On 4/4/2025 at 12:36 PM, GLAVCVS said:

Hi
Without first knowing what's in 'objlist', it's difficult to know why its entities aren't included in the set.
It's essential to know what the previous 'while' process is.
In principle, if 'objlist' is a list of entity names, the code should work.

Expand  

image.png.141885d670445ccdafae8be8bc939c1f.png 

here it is. 

Posted

Then it should work.
The only explanation should be in the part of your code that isn't visible from the 'while' loop.

Posted

I solved it now. The problem is that you do not use

(sssetfirst nil ss)

after   

(setq ss (ssget))

. Thank you for your interest @GLAVCVS

Posted
  On 4/7/2025 at 8:16 AM, GLAVCVS said:

👍🏼

Expand  

I saw that it happened but it didn't happen again today and I can't find it. Could you please look again?

(foreach ennt	inBlock
    (setq entType (cdr (assoc 0 (entget ennt))))
    (setq entName (cdr (assoc -1 (entget ennt))))
    (if (member entType '("CIRCLE" "ARC" "ELLIPSE" "REGION"))
	       (progn
	   (ssadd ennt ssel)
	   (ssadd entName ssel)
	   )
      (SetZZero ennt)
	  )
  )

 

Posted

Assuming 'inBlock' is a list of non-VLA objects, it seems like it should work.
The only thing is: 'ennt' and 'entName' are redundant. That is, you're trying to include the same object twice in the set.

Posted (edited)

I wanted to try both versions because I wanted to see the real version but neither one works

Edited by p7q

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...