Select all objects with specific hyperlink

Select all objects with specific hyperlink

S_v_d_Markt
Contributor Contributor
991 Views
7 Replies
Message 1 of 8

Select all objects with specific hyperlink

S_v_d_Markt
Contributor
Contributor

Hey guys, I'm trying to create a selection set with all objects with a specific hyperlink.

Through commands I can do it through qselect but i figured that won't work in a lisp.

I've looked online but I can't seem to find anything. Can someone please help me?

0 Likes
Accepted solutions (1)
992 Views
7 Replies
Replies (7)
Message 2 of 8

hosneyalaa
Advisor
Advisor

Can you attached example drawing

0 Likes
Message 3 of 8

ronjonp
Mentor
Mentor
Accepted solution

@S_v_d_Markt AFAIK you can't directly filter further than the registered app name. This will select all items ( not nested ) that have a hyperlink and will check if it matches the supplied URL and will create a selection set.

 

(defun c:foo (/ hl s)
  ;; RJP » 2024-06-24
  (cond	((setq s (ssget "_X" '((-3 ("PE_URL")))))
	 ;; Put in your URL here
	 (setq hl (strcase "http://www.google.com"))
	 (foreach e (mapcar 'cadr (ssnamex s))
	   (or (wcmatch hl (strcase (cdadr (cadr (assoc -3 (entget e '("PE_URL"))))))) (ssdel e s))
	 )
	 (sssetfirst nil s)
	)
  )
  (princ)
)

 

 

0 Likes
Message 4 of 8

paullimapa
Mentor
Mentor

try attached HplFnd.lsp

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 5 of 8

S_v_d_Markt
Contributor
Contributor

Thank you so much! this is exactly what i was looking for! Only thing is that this selects across different layouts, is it possible to change this to only search in the current layout?

0 Likes
Message 6 of 8

S_v_d_Markt
Contributor
Contributor
Thank you for the reply, This almost does what i want, i'd like to specify the hyper link in the lisp.
0 Likes
Message 7 of 8

ronjonp
Mentor
Mentor

@S_v_d_Markt wrote:

Thank you so much! this is exactly what i was looking for! Only thing is that this selects across different layouts, is it possible to change this to only search in the current layout?


@S_v_d_Markt Give this a try:

 

 

(defun c:foo (/ hl s)
  ;; RJP » 2024-06-25
  (cond	((setq s (ssget "_X" (list (cons 410 (getvar 'ctab)) '(-3 ("PE_URL")))))
	 ;; Put in your URL here
	 (setq hl (strcase "http://www.google.com"))
	 (foreach e (mapcar 'cadr (ssnamex s))
	   (or (wcmatch hl (strcase (cdadr (cadr (assoc -3 (entget e '("PE_URL"))))))) (ssdel e s))
	 )
	 (sssetfirst nil s)
	)
  )
  (princ)
)

 

 

0 Likes
Message 8 of 8

paullimapa
Mentor
Mentor

attached is updated code

change the URL in the code here:

paullimapa_0-1719326509577.png

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes