Hello all,
Video attached for clarity (hopefully). I am trying to find out if anyone has a LISP where I am able to change a linked field value by selecting said object and reassigning the field link to a different object via a point and click method that bypasses the edit field dialogue boxes. If it's even possible. Hopefully I explained that correctly.
TIA!
-Chris
You need to edit the ID of the field to be the ID of the new object. Post a sample dwg if possible.
Hello @Sea-Haven,
Thanks for responding. See attached sample. Let me know if anything more is needed.
AtbLnk.lsp seems to work on your dwg
hi there,
check the following
(defun c:inherit_another_block (/ nentsel_data target_attribute attribute_referenced_tag target_block another_block attribute_found)
(setq nentsel_data (nentsel "\nPick target attribute: ")
target_attribute (vlax-ename->vla-object (cdr (assoc -1 (entget (car nentsel_data)))))
attribute_referenced_tag (cdr (assoc 2(entget (cdr (assoc 331 (entget (cdr (assoc 360 (entget (cdr (assoc 360 (entget (cdr (assoc 360 (entget (cdr (assoc 360 (entget (car nentsel_data)))))))))))))))))))
)
(if (= 4 (length nentselp_data))
(setq target_block (vlax-ename->vla-object (car (last nentselp_data))))
(setq target_block (vlax-ename->vla-object (ssname (ssget (cadr nentsel_data)) 0)))
)
(terpri)
(while (and
(setq another_block (car (entsel "\nPick another target_block to reference field: ")))
(not
(and
(= (cdr (assoc 0 (entget another_block))) "INSERT")
(equal '(66 . 1) (assoc 66 (entget another_block)))
(vl-some '(lambda (attribute) (= attribute_referenced_tag (vla-get-tagstring (setq attribute_found attribute))))
(vlax-invoke (vlax-ename->vla-object another_block) 'getattributes)
)
)
)
(princ "wrong block")
)
)
(vla-put-textstring target_attribute (strcat "%<\\AcObjProp Object(%<\\_ObjId " (itoa (vla-get-objectid attribute_found)) ">%).TextString \\f \"%tc1\">%"))
(vla-regen (vla-get-activedocument (vlax-get-acad-object)) acactiveviewport)
)
Thanks for your responses. I have not had a minute to test these out yet. I hope to free some time up this week. Will report back.
Can't find what you're looking for? Ask the community or share your knowledge.