Jump to content

(nentsel)


(car (entsel))

Recommended Posts

Hi,

This thread is not about (nentsel), but for similair functionality.

I try to use this:

(cdr (assoc 0 (entget (ssname (ssget "_+.:E:S:L:N") 0))))

Which should mean: "select single entity, on unlocked layer, nested"

So I select a nested LWPOLYLINE inside of a block, and it returned "INSERT".

How come?

Link to comment
Share on other sites

ssnamex is the answer:

; Alternative of (nentsel)
(defun C:test ( / SS Lst )
(while (not (setq SS (ssget "_+.:E:S:L:N"))) SS)
(setq Lst (vl-remove-if-not '(lambda (x) (= 'ENAME (type x))) (apply 'append (ssnamex SS))))
(mapcar '(lambda (x) (cdr (assoc 0 (entget x)))) Lst)
)

Example:

("LWPOLYLINE" "INSERT") ; prints after selecting nested LWpolyline
("LINE" "INSERT" "INSERT") ; prints after selecting nested line within a nested block

Link to comment
Share on other sites

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...