TheSwamp
CAD Forums => CAD General => Topic started by: MSTG007 on June 01, 2015, 08:38:01 AM
-
Has anyone seen a way to select an MTEXT and then click a button or command that will insert the SheetSet Title to replace the Mtext value?
Thanks
-
I believe all you have to do is replace your text with: %<\AcSm Sheet.Title>%
All of the Field Expressions are readily available at the bottom of the Field dialog box.
-
I don't think macro's can change the value of a mtext entity.
(defun c:TextChange (/ a b)
(vl-load-com)
(while T
(setq a
(car
(nentsel "\nSelect text or mtext entity to change")))
(if (or a
(setq b(entget a))
(= (cdr (assoc 0 b)) "TEXT")
(= (cdr (assoc 2 b)) "MTEXT")
) ; end check
(vla-put-TextString(vlax-ename->vla-object a) "%<\AcSm Sheet.Title>% ")
(princ "\n Invalid Selection")
); end if
) ; end while
(princ)
); end
Quick and dirty.
-
alternately replace that text with an attribute in the title block, block....then let that attribute be a field....
attsync...and save/resave all sheets should accomplish the desired result
-
I don't think macro's can change the value of a mtext entity.
(defun c:TextChange (/ a b)
(vl-load-com)
(while T
(setq a
(car
(nentsel "\nSelect text or mtext entity to change")))
(if (or a
(setq b(entget a))
(= (cdr (assoc 0 b)) "TEXT")
(= (cdr (assoc 2 b)) "MTEXT")
) ; end check
(vla-put-TextString(vlax-ename->vla-object a) "%<\AcSm Sheet.Title>% ")
(princ "\n Invalid Selection")
); end if
) ; end while
(princ)
); end
Quick and dirty.
Well I did try the above and I get the famous (####). When I double click on the field it shows as (UNKNOWN) at the top left of the dialogue box Field Category. Other than that, its great.
-
is this sheet part of a set?
if not then one should expect ####
-
It is part of a sheet set. I just tried the command, saved the file, closed it and then thru the sheetset manager I re-opened the sheet. There still is the famous (####). Version of CAD shouldn't matter right?
-
Just a quick look but the entity check will never be evaluated in the code above using OR:
Instead I'd use:
-
Thanks for checking that out. I think I found the issue. In the lisp above it calls for the full "%<\AcSm Sheet.Title>%". But when I go to edit the field it shows the field expression as "%<AcSm Sheet.Title>%" without the (\) in it.
-
Use: "%<\\AcSm Sheet.Title>%"
-
Guess what. Solved! works awesome.
-
Derp, was too early in the morning :embarrassed2:
-
lol. Thanks though