(attribute definition) cutting_length is inside a block, right?
Is dimension line "dim A" part of the block? maybe a dynamic block?
If the dimension is just a loose dimension, try this (command DTA, for dim to attribute):
;; Set Attribute Value - Lee Mac
;; Sets the value of the first attribute with the given tag found within the block, if present.
;; blk - [ent] Block (Insert) Entity Name
;; tag - [str] Attribute TagString
;; val - [str] Attribute Value
;; Returns: [str] Attribute value if successful, else nil.
(defun LM:setattributevalue ( blk tag val / enx )
(if (and (setq blk (entnext blk)) (= "ATTRIB" (cdr (assoc 0 (setq enx (entget blk))))))
(if (= (strcase tag) (strcase (cdr (assoc 2 enx))))
(if (entmod (subst (cons 1 val) (assoc 1 (reverse enx)) enx))
(progn
(entupd blk)
val
)
)
(LM:setattributevalue blk tag val)
)
)
)
(defun c:dta ( / dim blk lng)
(setq dim (entsel "\nSelect the dim"))
(setq blk (entsel "\nSelect the block"))
(setq lng (cdr (assoc 42 (entget (car dim)))))
(LM:setattributevalue (car blk) "cutting_length" (rtos lng 2 3)) ;; that 3 is the precision. Feel free to change it
(princ)
)
attachment: the circle is a block called "B" with an attribute "cutting_length"
dta.dwg