@mujaffar_peerzade ,
You said: i need it mainly for copying tolerance with precision. does that means text + tolerance?!
Anyway have this current version, it copies the text (it is the dimension text override) + all tolerance properties
and made fine tuning, so it's a little shorter.
again at source object you can pick a block with text (or attribute) and it's copy the text value to destination dimension. the destination must be a dimension.
Moshe
(vl-load-com)
; Match Text Property
(defun c:mtxp (/ chksel ; local function
flag pick ename0 ename1 AcDbDim0 AcDbDim1)
(defun chksel (Qent sw / p nent)
(set Qent (car pick))
(cond
((= sw 0) ; coming from source
(cond
((eq (cdr (assoc '0 (entget (eval Qent)))) "INSERT")
(if (and
(setq p (nentselp (cadr pick)))
(setq nent (car p))
(wcmatch (cdr (assoc '0 (entget nent))) "TEXT,MTEXT")
)
(progn
(set Qent nent) ; Qent gets the ename of text
nil ; this is good
); progn
t ; this is error
); if
); case
((eq (cdr (assoc '0 (entget (eval Qent)))) "DIMENSION")
nil ; this is good
); case
( t ) ; this error
); cond
); case
((= sw 1) ; coming from destination
(not (eq (cdr (assoc '0 (entget (eval Qent)))) "DIMENSION"))
); case
); cond
); chksel
; here start c:mtxp
(while (setq pick (entsel "\nPick source object: "))
(cond
((chksel 'ename0 0) ; pass quote param
(vlr-beep-reaction)
(prompt "\nSource object can be a dimension or insert.")
); case
( t
(setq flag nil)
(setq AcDbDim0 (vlax-ename->vla-object ename0))
(while (and
(not flag)
(setq pick (entsel "\nPick destination object: "))
)
(cond
((chksel 'ename1 1) ; pass quote param
(vlr-beep-reaction)
(princ "\nDestination object must be dimension.")
); case
( t
(setq AcDbDim1 (vlax-ename->vla-object ename1))
(cond
((wcmatch (vla-get-objectName AcDbDim0) "AcDbText,AcDbMText")
(vla-put-textOverride AcDbDim1 (vla-get-textString AcDbDim0))
); case
( t
(foreach prop (list 'textOverride 'TolerancePrecision 'tolerancedisplay 'toleranceLowerLimit
'ToleranceUpperLimit 'ToleranceSuppressLeadingZeros 'ToleranceSuppressTrailingZeros
'ToleranceSuppressZeroFeet 'ToleranceSuppressZeroInches 'AltTolerancePrecision
'AltToleranceSuppressLeadingZeros 'AltToleranceSuppressTrailingZeros 'AltToleranceSuppressZeroFeet
'AltToleranceSuppressZeroInches 'PrimaryUnitsPrecision)
(vlax-put-property AcDbDim1 prop (vlax-get-property AcDbDim0 prop))
); foreach
); case
); cond
(setq flag t)
(vlax-release-object AcDbDim1)
); case
); cond
); while
(vlax-release-object AcDbDim0)
); case
); cond
); while
(princ)
); c:mtxp