broncos15 Posted July 13, 2017 Share Posted July 13, 2017 So I am trying to have the ability to change the text color of mulitleaders from bylayer to red (it is part of a QC routine). After looking through all the properties, the only way I can figure out how to do it is by doing a workaround where I basically just copy and paste the text back into the multileader. (vla-put-TextString obj (strcat "{\\C" (itoa txtcol) ";" txtstring "}")) The issue is that this will override if there are any fields within the text. Is there some other workaround that I am not thinking of? Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted July 13, 2017 Share Posted July 13, 2017 You could change the TextColor property of the corresponding MLeader Style, e.g.: (defun c:test ( / aci col sel sty ) (if (and (setq sel (ssget "_+.:E:S" '((0 . "MULTILEADER")))) (setq aci (acad_colordlg 1 nil))) (progn (setq sty (vla-item (vla-item (vla-get-dictionaries (vla-get-activedocument (vlax-get-acad-object) ) ) "acad_mleaderstyle" ) (vla-get-stylename (vlax-ename->vla-object (ssname sel 0))) ) col (vla-get-textcolor sty) ) (vla-put-colorindex col aci) (vla-put-textcolor sty col) ) ) (princ) ) (vl-load-com) (princ) Note that this will affect all MLeaders referencing the Style however. Quote Link to comment Share on other sites More sharing options...
Grrr Posted July 14, 2017 Share Posted July 14, 2017 You could change the TextColor property of the corresponding MLeader Style, e.g.:.. I like your suggestion. Quote Link to comment Share on other sites More sharing options...
broncos15 Posted July 14, 2017 Author Share Posted July 14, 2017 Lee thank you so much for the help! I thought about changing the style, but the problem is that the work flow goes, a person manually checks an mtext or multileader, corrects anything that is incorrect, then turns the text red to indicate that it is correct and has been checked. Then after everything has been checked, I place them back on the bylayer. It isn't a huge deal, I might just add a check into the command so that the user can't select objects that have fields in it. Quote Link to comment Share on other sites More sharing options...
handasa Posted July 14, 2017 Share Posted July 14, 2017 here a one i used from afralisp.com (defun c:colorchange ( / ssg) (setq ssg (ssget)) (chc ssg 1) ;;; 1 for red color ) (defun chc (sset color) ;load the visual lisp extensions (vl-load-com) ;check for selection ;set up the counter (setq ctr 0) ;count the number of entities and loop (repeat (sslength sset) ;extract the entity name (setq item (ssname sset ctr)) ;convert to vl object (setq item (vlax-ename->vla-object item)) ;check if the entity has a color property ;and it can be updated (setq check (vlax-property-available-p item "Color" T)) ;if it can (if check ;change it's color (vlax-put-property item 'Color color) );if ;increment the counter (setq ctr (1+ ctr)) );repeat );defun Quote Link to comment Share on other sites More sharing options...
hzdriggers Posted July 12, 2018 Share Posted July 12, 2018 I'm trying to set the text color of the mleaderstyle using the following with no luck... but it seems you may be able to help me... (progn (setq *doc* (vla-get-activedocument (vlax-get-acad-object))) (setq mldrdict (vla-item (vla-get-dictionaries *doc*) "ACAD_MLEADERSTYLE")) (setq newldrstyle (vlax-invoke mldrdict 'addobject "Standard" "AcDbMLeaderStyle")) (vlax-put-property newldrstyle 'AlignSpace 0.18) (vlax-put-property newldrstyle 'Annotative -1) (vlax-put-property newldrstyle 'ArrowSize 0.125) (vlax-put-property newldrstyle 'BlockConnectionType 0) (vlax-put-property newldrstyle 'BlockRotation 0.0) (vlax-put-property newldrstyle 'BlockScale 1.0) (vlax-put-property newldrstyle 'BreakSize 0.125) (vlax-put-property newldrstyle 'ContentType 2) (vlax-put-property newldrstyle 'Description "Standard") (vlax-put-property newldrstyle 'DoglegLength 0.125) (vlax-put-property newldrstyle 'DrawLeaderOrderType 0) (vlax-put-property newldrstyle 'DrawMLeaderOrderType 1) (vlax-put-property newldrstyle 'EnableBlockRotation -1) (vlax-put-property newldrstyle 'EnableBlockScale -1) (vlax-put-property newldrstyle 'EnableDogleg -1) (vlax-put-property newldrstyle 'EnableFrameText 0) (vlax-put-property newldrstyle 'EnableLanding -1) (vlax-put-property newldrstyle 'FirstSegmentAngleConstraint 0) (vlax-put-property newldrstyle 'LandingGap 0.125) (vlax-put-property newldrstyle 'LeaderLineType 1) (vlax-put-property newldrstyle 'LeaderLineTypeId "ByLayer") (vlax-put-property newldrstyle 'LeaderLineWeight -1) (vlax-put-property newldrstyle 'MaxLeaderSegmentsPoints 0) (vlax-put-property newldrstyle 'name "Standard") (vlax-put-property newldrstyle 'ScaleFactor 1.0) (vlax-put-property newldrstyle 'SecondSegmentAngleConstraint 0) (vlax-put-property newldrstyle 'TextAlignmentType 0) (vlax-put-property newldrstyle 'TextAngleType 1) (vlax-put-property newldrstyle 'TextHeight 0.09375) (vlax-put-property newldrstyle 'TextColor Yellow) (vlax-put-property newldrstyle 'TextLeftAttachmentType 1) (vlax-put-property newldrstyle 'TextRightAttachmentType 1) (vlax-put-property newldrstyle 'TextString "") (vlax-put-property newldrstyle 'TextStyle (getvar "textstyle"))) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.