Jump to content

Recommended Posts

Posted

Hi,

 

 

I wanted to see if someone could help me out? I am trying to find a lisp that can help me insert a hyperlink "name" to an object. I am not using it to actual set a hyperlink but to assign a name to the object. Example ... I have TONS of grid lines. So what I do is I type Hyperlink>Select Object (in this case I select the line)> then assign the "Text to Display" and "Type the file or Web page name" as C10 ... I use this so I don't have to keep zooming in and out or without creating extra layers. When zoomed in really close to the drawing I can just hoover over the line and it'll tell me the name ... so I would just like to type

HTXT and for it to prompt me to "Assign Name" and then "Select the Object" or Select Object first then Assign Name. Thanks in advanced

Posted
(defun c:htxt ( / ss obj hlinks str)
 (setq ss (ssget ":s"))
 (if ss
   (progn
     (setq obj (vlax-ename->vla-object (ssname ss 0)))
     (setq hlinks (vlax-get-property obj 'Hyperlinks))
     (setq str (getstring "\nEnter Hyperlink: "))
     (vla-add hlinks str)
     )
   )
 (princ)
 )

Posted

I will patiently wait for the request of a lisp to remove all hyperlinks in a drawing. :D :D :D

Posted
  Hippe013 said:
I will patiently wait for the request of a lisp to remove all hyperlinks in a drawing. :D :D :D

 

test

  (defun c:xurl (/ en)
    (if (setq en (car (entsel "\nSelect entity.. ")))
      (vlax-for x (vla-get-hyperlinks (vlax-ename->vla-object en)) (vla-delete x))
      ) 
    (princ)
    )

Posted

ROFL sounds like a good idea haha

Posted

This is what I needed, thanks so much

  • 4 years later...
Posted (edited)

Hello guys,

 

Is there any possible way to link a batch of images to text or mtext content? (eg. content of the text or mtext is same as the filename of a certain image).

I am thinking for a lisp the will select all the text or mtext in a certain layer and hyperlink the content to the corresponding filename of the image file in a certain folder.

Thank you.

 

Edited by GLORY
Posted

I did a staff locality plan that has a staff image, I just used their phone number as image name and just searched for block got number and vla-addraster at that point. Like 100 images in one go. I just redid the dwg each time it was updated saving as new dwg. It only took like 1 minute to do.

 

Try this will need directory change and image scale. Change the ssget to get text etc.

 

; routine to insert images based on a block position
; By Alan H 

(vl-load-com)
(defun *error* ( msg )
        (princ "\nerror: ")
        (alert (strcat "\n Missing phone number image" name))
        (princ)
)
(setq mspace (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object))))

(setvar "clayer" "staffimages")
(setq ss1 (ssget "x"  (list (cons 0 "INSERT") (cons 2 "phnum"))))  ;block name is phnum
(setq len (sslength ss1))
(setq x 0)
; then insert block value at x,y


; need to pull out block find x,y and value
(repeat len
(foreach att (vlax-invoke (vlax-ename->vla-object (ssname SS1 x )) 'getattributes)
        (if (= "PHNUM" (strcase (vla-get-tagstring att)))  ; tagname is phnum
        (progn
	(setq blknum (vla-get-textstring att))
      	(setq inspt (vla-get-insertionpoint att))
        )
	)
)

(setq name (strcat "P:\\B St Offices\\" blknum ".jpg"  ))
(princ (strcat "\n" name))

(vla-AddRaster mspace name inspt 1.5 0.0) 

(setq x (+ x 1))
) ;repeatlen

(setq ss1 nil)
(princ "all done"
(princ)

 

  • 2 years later...
Posted

hi guys, can hypertext be created through lisp for matchline number with same page number of page sequence?

Posted (edited)

If your talking about layouts then could link to current tab (setq x (vla-get-taborder lay)). You can use taborder as a field property, not sure if that works in a hypertext.

 

Ps taborder as field is not supported in Bricscad V24 has been reported.

Edited by BIGAL
  • Agree 1
  • 3 weeks later...
Posted
  On 12/14/2024 at 10:32 PM, BIGAL said:

If your talking about layouts then could link to current tab (setq x (vla-get-taborder lay)). You can use taborder as a field property, not sure if that works in a hypertext.

 

Ps taborder as field is not supported in Bricscad V24 has been reported.

no. I was asking Matchline page no. mtext to be hyperlinked through lisp, page no. should connect with layout number. 

 

_hyperlink -->view of this drawing--> select layout same matchline number.

Posted
  On 12/14/2024 at 3:16 PM, smitaranjan said:

hi guys, can hypertext be created through lisp for matchline number with same page number of page sequence?

@smitaranjan Here is a simple example to add a hyperlink for each layout:

(defun c:foo (/ e)
   (vl-load-com)
   (foreach n (layoutlist) ;; for each layout name,
      (if (setq e (entsel (strcat "\nSelect Object to link to \"" n "\""))) ;; select an object to add the link
         (vla-add
            (vla-get-hyperlinks (vlax-ename->vla-object (car e)))
            ""                  ;; External Hyperlink
            (strcat "Go to " n) ;; display description
            (strcat "," n)      ;; Named location in the document
         )
      )
   )
)

 

  • Thanks 1
Posted
  On 1/3/2025 at 3:21 PM, pkenewell said:

@smitaranjan Here is a simple example to add a hyperlink for each layout:

(defun c:foo (/ e)
   (vl-load-com)
   (foreach n (layoutlist) ;; for each layout name,
      (if (setq e (entsel (strcat "\nSelect Object to link to \"" n "\""))) ;; select an object to add the link
         (vla-add
            (vla-get-hyperlinks (vlax-ename->vla-object (car e)))
            ""                  ;; External Hyperlink
            (strcat "Go to " n) ;; display description
            (strcat "," n)      ;; Named location in the document
         )
      )
   )
)

 

Expand  

@pkenewell its working perfectly to add hyperlink in VICINITY page. Can you add separate option to provide layout number manually and randomly and then select object for hyperlink

Posted
  On 1/3/2025 at 6:22 PM, smitaranjan said:

its working perfectly to add hyperlink in VICINITY page. Can you add separate option to provide layout number manually and randomly and then select object for hyperlink

@smitaranjan

I'm not exactly sure what you mean. If you mean that you just want to enter a number, like 1,2,3, etc., then your sheet naming for the layouts much be consistent. The reference for the hyperlink is entirely based on the sheet tab name. So if all your sheets are named for example "page 1", "page 2", "page 3", etc. then you can determine the correct layout from the name.

 

BTW - the HYPERLINK command can do this without the need for an AutoLISP routine if you are just doing a random layout, presenting all the layout names is a list, and even named views within each layout.

image.png.74821278388593046049e493297bd15e.png

  • Like 1
Posted
  On 1/3/2025 at 7:32 PM, pkenewell said:

@smitaranjan

I'm not exactly sure what you mean. If you mean that you just want to enter a number, like 1,2,3, etc., then your sheet naming for the layouts much be consistent. The reference for the hyperlink is entirely based on the sheet tab name. So if all your sheets are named for example "page 1", "page 2", "page 3", etc. then you can determine the correct layout from the name.

 

BTW - the HYPERLINK command can do this without the need for an AutoLISP routine if you are just doing a random layout, presenting all the layout names is a list, and even named views within each layout.

image.png.74821278388593046049e493297bd15e.png

Expand  

yes, just wanted to skip the process of going for each object by using lisp. Will it be possible to add another option in the previous program?

Posted (edited)
  On 1/3/2025 at 9:11 PM, smitaranjan said:

yes, just wanted to skip the process of going for each object by using lisp. Will it be possible to add another option in the previous program?

@smitaranjan Yes it's possible. I don't understand exactly what workflow you're asking for. Can you explain step by step how you would like it to run?

 

P.S. won't be able to work on it again until next week.

Edited by pkenewell
  • Like 1
Posted
  On 1/3/2025 at 10:18 PM, pkenewell said:

@smitaranjan Yes it's possible. I don't understand exactly what workflow you're asking for. Can you explain step by step how you would like it to run?

eg: foo--> layout list or custom-->(if layout list is selected as usual above code process)--> layout no.-->select objects to add the link(multiple object can be selected at a time{individual hyperlink entity})--> enter---> layout no.-->select objects to add the link {after entering esc the process will end}

Posted

Are you talking about a detail bubble ? Detail is on sheet 2.

image.png.35aabce9707baae37b1d29283611ea8e.png

Posted
  On 1/3/2025 at 11:20 PM, BIGAL said:

Are you talking about a detail bubble ? Detail is on sheet 2.

image.png.35aabce9707baae37b1d29283611ea8e.png

NO For matchline... image.png.5160cf72bb53f1b54ba1e705e28004cb.png

Posted

If you look at this image its a make layouts walking along a line or pline. It auto rotates the viewport to suit, I could add the what is previous page and what is next page, I am getting confused as to why you want to use hyperlinks. For a single road style plan then the before after is relatively easy, when we get to grid layouts a sheet can have say 4 sheets touching. You can get all layout names and there corresponding TABORDER. So labelling multiple layouts could be done.

layout1.png.9d03ab6cd7fbd5b4a128c15fbe0c31bf.png

 

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