Jump to content

select duplicate attribute and create link with lines.


jr.roberto.santos

Recommended Posts

@ronjonp Hi,

 

I would like to select multiple attributes in one area (example ssget :L) and automatically select all duplicate tags based on the selected attributes.

can you give me some help?

 

 

 

Reference: https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/selecting-a-block-by-its-attribute-value/td-p/2195298

 

(defun c:ssatt (/ att elst tag val ss1 ss2 n ent)
(and
(setq att (car (nentsel "\nSelect source attribute: ")))
(setq elst (entget att))
(setq tag (cdr (assoc 2 elst))
val (cdr (assoc 1 elst))
ss2 (ssadd)
)
(setq ss1 (ssget "_X"
(list '(0 . "INSERT")
(assoc 2 (entget (cdr (assoc 330 elst))))
)
)
)
(repeat (setq n (sslength ss1))
(setq ent (ssname ss1 (setq n (1- n)))
att (entnext ent)
)
(while (= (cdr (assoc 0 (setq elst (entget att)))) "ATTRIB")
(if (and (= (cdr (assoc 2 elst)) tag)
(= (cdr (assoc 1 elst)) val)
)
(ssadd ent ss2)
)
(setq att (entnext att))
)
)
(sssetfirst nil ss2)
)
(princ)
)

 

 

 

;; Expected outcome. Select more than one attribute.

image.png.5fdb959b974978b4a4e28b4370c03d68.png

 

;;Compare selected and duplicate attributes.

image.png.d320eee53d33eadefec7c75fcb76e462.png

Link to comment
Share on other sites

  • Replies 20
  • Created
  • Last Reply

Top Posters In This Topic

  • jr.roberto.santos

    11

  • ronjonp

    7

  • SLW210

    2

  • mhupp

    1

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