Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 02/07/2020 in all areas

  1. Maybe this: (defun KGA_Conv_Pickset_To_ObjectList (ss / i ret) (if ss (repeat (setq i (sslength ss)) (setq ret (cons (vlax-ename->vla-object (ssname ss (setq i (1- i)))) ret)) ) ) ) (defun KGA_Conv_Collection_To_List (coll / ret) (reverse (vlax-for a coll (setq ret (cons a ret)) ) ) ) (defun c:Att_To_Link ( / doc linkPrefix lnks nme ss str tag) (setq nme "TEA_DISP_001") ; Change this. Block name in CAPS. (setq tag "ATT1") ; Change this. Attribute tag in CAPS. (setq linkPrefix "https://www.this_is_my_link.com/") ; Change this. (setq doc (vla-get-activedocument (vlax-get-acad-object))) (vla-endundomark doc) (vla-startundomark doc) (if (setq ss (ssget "_X" (list '(0 . "INSERT") '(66 . 1) (cons 2 (strcat "`**," nme))))) (foreach obj (KGA_Conv_Pickset_To_ObjectList ss) (if (and (= nme (strcase (vla-get-effectivename obj))) (setq str (vl-some '(lambda (att) (if (= tag (strcase (vla-get-tagstring att))) (vla-get-textstring att))) (vlax-invoke obj 'getattributes) ) ) (/= "" str) ) (progn (setq lnks (vla-get-hyperlinks obj)) (mapcar 'vla-delete (KGA_Conv_Collection_To_List lnks)) (vla-add lnks (strcat linkPrefix str) (strcat linkPrefix str)) ; 2nd argument is the description. ) ) ) ) (vla-endundomark doc) (princ) )
    2 points
  2. I I understand, you mean nested blocks. Here a lsp procedure which show you on command typing bar the different names of blocks, I'm not so expert with lsp but I tried and it works. see https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/report-number-of-nested-blocks/m-p/6340079/highlight/true#M341484 I'll try more with VBA, but sincerly I never had a similar issue.
    1 point
  3. TEA* block name. ATT1 tag name of attribute. Newstr value of matching attribute returned your hyperlink string (strcat newstr "hyperlink") ;do your hyperlink is (vla-put-textstring att "your hyperlink string") Not sure how to make any simpler.
    1 point
  4. Here is a start (setq ss (ssget "X" (list (cons 0 "Insert")(cons 2 "TEA*")))) (foreach att (vlax-invoke (vlax-ename->vla-object (ssname SS (setq x (-x 1)) )) 'getattributes) (if (= "ATT1" (strcase (vla-get-tagstring att))) (progn (setq newstr (vla-get-textstring att)) ; do your hyperlink ) ) ) I did something similar used the phone number of staff and added their photo by saving each staff picture as phonenum.jpg, had a lisp matched photo to seat position via phone number. It also had a grid index over it, added staff in alphabetical order and grid Alan H J 1 as well as their phone extension.
    1 point
  5. I would strongly advise against creating Fields using entmake/entmakex: whilst it is theoretically possible to create a Field using only Vanilla AutoLISP methods (as this old thread demonstrates), you would need to create the definition of the Extension Dictionary attached to the attribute definition, the ACAD_FIELD dictionary contained within the Extension Dictionary, the TEXT dictionary contained within the ACAD_FIELD dictionary, the FIELD entity container, and finally, the FIELD entity which contains the actual field expression. Compare the above with the ActiveX method of simply populating the object content with the field expression which is automatically recognised as such and creates the above automatically.
    1 point
×
×
  • Create New...