
Originally Posted by
cadtag
I don't believe there's any way a field can do that -- fields are essentially dynamic in nature and you want something that will remain static (until you re-run the LISP routine).
I'd suggest that you modify the LISP code to change the value of a text string that's part of the block to display the new name you are giving the new block definition.
It will still be prone to breakage -- what should hapopen if someone uses the RENAME command after the new block definition is made via LISP?
Object-specific Fields simply reference an ObjectId, which ultimately is a simple string substitution within the resultant (copied) Field, in order to reference the ObjectId of the resultant Object being referenced in same.
Code:
(vl-load-com)
(defun c:GetFieldCode (/ x)
(if
(and
(setq x (ssget ":S:E"))
(setq x (vlax-ename->vla-object (ssname x 0)))
(vlax-method-applicable-p x 'fieldcode)
)
(prompt (strcat "\nFieldCode: " (vla-fieldcode x)))
(prompt "\n** Invalid selection ** ")
)
(princ)
)
(defun c:GetObjectId (/ x)
(if
(and
(setq x (ssget ":S:E"))
(setq x (vlax-ename->vla-object (ssname x 0)))
)
(prompt (strcat "\nObjectId: " (itoa (vla-get-objectid x))))
)
(princ)
)