Select Hatchings That Have No Hyperlinks

Select Hatchings That Have No Hyperlinks

jmartt
Collaborator Collaborator
894件の閲覧回数
4件の返信
メッセージ1/5

Select Hatchings That Have No Hyperlinks

jmartt
Collaborator
Collaborator

I'm not 100% certain this can't be done through normal means, but I've tried (using Quick Select). I'm also not 100% certain that this can be done using LISP or other methods. But if it is, I hope it is super easy.

 

I have a drawing with thousands of hatchings. Almost all of them have hyperlinks. Can I somehow isolate or otherwise identify only the hatchings that do not have hyperlinks?

 

Thanks.

0 件のいいね
解決済み
895件の閲覧回数
4件の返信
返信 (4)
メッセージ2/5

Ajilal.Vijayan
Advisor
Advisor
解決済み

With quick select you can do this.

First select all hatches (includes with hyperlinks also)

then quick select command and use the wild card match option with value *.\*

Capture.JPG

 
0 件のいいね
メッセージ3/5

hak_vz
Advisor
Advisor
解決済み

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

EESignature

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.
メッセージ4/5

jmartt
Collaborator
Collaborator

So either way, then. Bravo!

Geez. You know what I was doing with the Quick Select? I wasn't selecting the hatching and then applying the secondary filter with the wildcard. I was always selecting starting with the entire drawing and trying to get the result with one filter. I never knew or thought that Quick Select could be used like that. I should have been using it like that. 

0 件のいいね
メッセージ5/5

jmartt
Collaborator
Collaborator

Hey @hak_vz.

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

 

That's great. This will help me a lot with the next step. Thanks so much!

0 件のいいね