ssget text entity that has hyperlink string

ssget text entity that has hyperlink string

kpennell
Collaborator Collaborator
1,180 Views
5 Replies
Message 1 of 6

ssget text entity that has hyperlink string

kpennell
Collaborator
Collaborator

The text entity I want to get the ename of has a hyperlink with a string "NumberOfLayouts"

 

is there a way in VL to retrieve the entity name, so that I can change the string of the text entity?

 

 (
    (-1 . <Entity name: 7ffffb192a0>)
    (0 . "TEXT")
    (5 . "55E2")
    (102 . "{ACAD_XDICTIONARY")
    (360 . <Entity name: 7ffffb192b0>)
    (102 . "}")
    (330 . <Entity name: 7ffffb50f10>)
    (100 . "AcDbEntity")
    (67 . 1)
    (410 . "SHT 01")
    (8 . "0_TEXT")
    (100 . "AcDbText")
    (10 8.10893 0.278125 0.0)
    (40 . 0.1)
    (1 . "SADF")
    (50 . 0.0)
    (41 . 0.75)
    (51 . 0.0)
    (7 . "Romans")
    (71 . 0)
    (72 . 1)
    (11 8.25 0.328125 0.0)
    (210 0.0 0.0 1.0)
    (100 . "AcDbText")
    (73 . 2)
    (-3
      (
        "PE_URL"
        (1000 . "NumberOfLayouts")
        (1002 . "{")
        (1000 . "NumberOfLayouts")
        (1002 . "{")
        (1071 . 1)
        (1002 . "}")
        (1002 . "}")
      )
    )
  )

0 Likes
Accepted solutions (2)
1,181 Views
5 Replies
Replies (5)
Message 2 of 6

Ranjit_Singh
Advisor
Advisor
Accepted solution

For example call below as (somefunc "NumberOfLayouts" "New text string value")

(defun somefunc  (urlstring textstr / i ss1 entdata)
    (setq ss1 (ssget "X" '((0 . "TEXT,MTEXT") (-3 ("PE_URL"))))
          i   0)
    (repeat (sslength ss1)
        (if (= urlstring
               (cdr (assoc 1000 (reverse (cadr (assoc -3 (setq entdata (entget (ssname ss1 i) '("*")))))))))
            (entmod (subst (cons 1 textstr) (assoc 1 entdata) entdata)))
        (setq i (1+ i)))
    (princ))

 

 

0 Likes
Message 3 of 6

kpennell
Collaborator
Collaborator
Accepted solution

Thanks for the response. Close but not quite there.

 

So, I may have a test entity that has a hyperlink named "NumberOfLayouts". I will also have a text entity that has a hyperlink name of "DrawingName".

 

If I use your (ssget "X" '((0 . "TEXT,MTEXT") (-3 ("PE_URL")))), it will select all entities that have a URL/hyperlink assigned to the entity.

 

Would this make sense?

 

(ssget "X" '((0 . "TEXT,MTEXT") (-3 (1000 . "NumberOfLayouts"))))

 

it returns "; error: bad SSGET list value" but it's the jest of want I'm looking for.

 

Thanks again,

Kyran

0 Likes
Message 4 of 6

kpennell
Collaborator
Collaborator

whoops,

 

wait a minute, I just studied what you proposed. I didn't catch the "*" you had written in there. let me investigate.

0 Likes
Message 5 of 6

Ranjit_Singh
Advisor
Advisor

Which Hyperlink you wish to select is specified here

(setq ss1 (ssget "X" '((0 . "TEXT,MTEXT") (-3 ("PE_URL"))))

It should only be selecting those Hyperlinks. I am not sure what the problem is. Post a drawing and I can look into it.

 

0 Likes
Message 6 of 6

kpennell
Collaborator
Collaborator

I managed to get it to work.

 

I could have several entities that have hyperlinks. I converted your "*" with the specific hyperlink string, and it changed it no problem.

 

(setq ss1 (ssget "X" '((0 . "TEXT,MTEXT") (-3 ("PE_URL")))))
 (setq i 0)
 (repeat (sslength ss1)
  (if
   (= "NumberOfLayouts" (cdr (assoc 1000 (reverse (cadr (assoc -3 (setq entdata (entget (ssname ss1 i) '("*")))))))))
   (entmod (subst (cons 1 "wild") (assoc 1 entdata) entdata))
  )
  (setq i (1+ i))
 )

0 Likes