Field value pulled from a separate Block attribute value via point and click

Field value pulled from a separate Block attribute value via point and click

cmacdonald
Contributor Contributor
558 Views
5 Replies
Message 1 of 6

Field value pulled from a separate Block attribute value via point and click

cmacdonald
Contributor
Contributor

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

0 Likes
Accepted solutions (2)
559 Views
5 Replies
Replies (5)
Message 2 of 6

Sea-Haven
Mentor
Mentor

You need to edit the ID of the field to be the ID of the new object. Post a sample dwg if possible.

0 Likes
Message 3 of 6

cmacdonald
Contributor
Contributor

Hello @Sea-Haven,

 

Thanks for responding.  See attached sample.  Let me know if anything more is needed.

0 Likes
Message 4 of 6

paullimapa
Mentor
Mentor
Accepted solution

AtbLnk.lsp seems to work on your dwg


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 5 of 6

komondormrex
Mentor
Mentor
Accepted solution

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)
)
0 Likes
Message 6 of 6

cmacdonald
Contributor
Contributor

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.

0 Likes