Here is a code that create selection set from all hatch objects in a drawing.
Then it loops through this selection set and checks hyperlinks for each of this objects.
If objects URL location is empty it changes color of that hatch to red. It doesn't check if
hatch object is hidden or on a locked layer.
(defun c:hwohyp ( / ss i hatchobj)
;selects hatch object without hyperlink
;and sets their color to red
(vl-load-com)
(setq ss (ssget "X" '((0 . "HATCH"))) i 0)
(if ss
(repeat (sslength ss)
(setq Hyperlinks (vla-get-Hyperlinks (vlax-ename->vla-object (ssname ss i))) hyp "")
(vlax-for hyperlink Hyperlinks (setq hyp (strcat hyp (vla-get-URL hyperlink) "")))
(if (not (wcmatch hyp "*.\*"))(setpropertyvalue (ssname ss i) "color" 1))
(setq i (+ i 1))
)
)
(princ "\n Hatch objects without set hyperlink are now colored red !")
)
You may also modify this code to create a text objects from hyperlinks for each hatch object in a separate layer to check if they are correct.
(defun c:hwohyp2 ( / ss i hatchobj)
;selects hatch object without hyperlink
;and sets their color to red
(vl-load-com)
(setvar "cmdecho" 0)
(if(not (tblsearch "layer" "hyperlinks")) (command "_.layer" "_make" "hyperlinks" "_color" "8" "" ""))
(setq ss (ssget "X" '((0 . "HATCH"))) i 0)
(if ss
(repeat (sslength ss)
(setq Hyperlinks (vla-get-Hyperlinks (vlax-ename->vla-object (ssname ss i))) hyp "")
(vlax-for hyperlink Hyperlinks (setq hyp (strcat hyp (vla-get-URL hyperlink) "")))
(if (not (wcmatch hyp "*.\*"))(setpropertyvalue (ssname ss i) "color" 1))
(vla-getboundingbox (vlax-ename->vla-object (ssname ss i)) 'minPt 'maxPt)
(setq p1 (vlax-safeArray->list minPt))
(setq p2 (vlax-safeArray->list maxPt))
(setq midPt (mapcar '(lambda (x1 x2) (/ (+ x1 x2) 2.0)) p1 p2))
(entmakex (list (cons 0 "TEXT") (cons 8 "hyperlinks")(cons 10 midPt) (cons 1 hyp) (cons 40 10) (cons 50 0)))
(setq i (+ i 1))
)
)
(setvar "cmdecho" 0)
(princ "\n Hatch objects without set hyperlink are now colored red !")
(princ "\n All hyperlink locations were created in layer HYPERLINKS!")
)
Miljenko Hatlak

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.