rlcad Posted January 8, 2016 Posted January 8, 2016 (I've tried Textalign but it only works with multiple texts). I have an MText justified to Center. I need it to be left-aligned with a rectangle so that the leftmost edge of the text is aligned with the leftmost edge of the rectangle. How can I do that? Quote
SAFeSTeR Posted January 8, 2016 Posted January 8, 2016 Perhaps justify MText to 'Middle Left', select it then pick the square grip and move it to the desired position? Quote
Andrew1979 Posted January 8, 2016 Posted January 8, 2016 As SAFeSTer wrote you need to simply adjust the grip alignment point of the text. To do that, open the properties window by holding down CTRL key and pressing the number 1 key on your keyboard. Select the text In the properties window, scroll down to justify, then in the drop down box, select either Top Left, Middle Left or Bottom Left Quote
BIGAL Posted January 9, 2016 Posted January 9, 2016 Had a long coffee this morning ; mtext 1 2 3 or text ; 4 5 6 ; 7 8 9 ; no error checking for above 9 or m-text picked. ; by Alan H Jan 2016 (vl-load-com) (setq doc (vla-get-utility (vla-get-activedocument (vlax-get-acad-object)))) ; open database (defun c:mtx ( / tobj Pt1 Pt2 x) ;select the object (vla-getentity doc 'tobj "\nSelect Mtext/Text: ") (setq x (getint "\nEnter position 1-9")) (vla-put-attachmentpoint tobj x) ; see above for position ;get the insertion point (setq Pt1 (vla-get-insertionpoint tobj)) ;get the displacement (setq Pt2 (vla-getpoint doc pt1 "\nSpecify point of displacement: ")) ;move the object (vla-move tobj Pt1 Pt2) ) ;defun (princ) Quote
rlcad Posted January 9, 2016 Author Posted January 9, 2016 The problem is, I need the text to keep its Center justification. What I want is that the left side of the bounding box of the text be underneath the left side of the rectangle - while keeping the justification intact. Quote
Andrew1979 Posted January 9, 2016 Posted January 9, 2016 The problem is, I need the text to keep its Center justification. What I want is that the left side of the bounding box of the text be underneath the left side of the rectangle - while keeping the justification intact. Is the text going to change? If so then what you want to do isn't going to work. Everytime you change the text it will no longer line up on the left. I don't think you have given us a clear enough picture of what you are trying to do exactly. I am confused to why you would want centre justification and also keep the text on the left Quote
rlcad Posted January 9, 2016 Author Posted January 9, 2016 Text_align.dwg Here is an attachment, showing what I need to do. Quote
Andrew1979 Posted January 9, 2016 Posted January 9, 2016 [ATTACH]56594[/ATTACH]Here is an attachment, showing what I need to do. Just had a look at the drawing. If I deleted or added even one character to the top line the mtext will no longer line up with the left edge of the box. Still not clear on what you are trying to do Quote
rlcad Posted January 9, 2016 Author Posted January 9, 2016 I should have said so in the OP: the text is not going to change (of course, otherwise it would be impossible, as you said). As for its use, I was just curious as to what I should do, should this situation arise. Quote
BIGAL Posted January 10, 2016 Posted January 10, 2016 There is a problem the bounding box size its controlled by a column width factor. Try the code above using 1, I did notice I had to dbl click CTRL A and reset all text center then code works perfect, moving to any of the 9 positions it may be it needs to be set to centre as well before moving. You could add also X & Y offsets, + & -. Quote
SAFeSTeR Posted January 11, 2016 Posted January 11, 2016 (edited) ...I was just curious as to what I should do, should this situation arise. So the question is purely hypothetical? I wouldn't worry about it in that case. If the situation does arise, deal with it then, there's no point wasting time on it before. I didn't try BIGAL's code but unless it's absolutely essential the text lines up exactly with the box then I would just do it by eye. Edited January 11, 2016 by SAFeSTeR typo Quote
Andrew1979 Posted January 11, 2016 Posted January 11, 2016 then I would just do it by eye. I second this....do it by eye. If you wanted to get really accurate though, you could make a copy of the text on top of the original text, then using Express tools explode the text. You will then be able to snap onto the exploded text exactly and move the original text with the exploded text to the left as required. Then simply delete the exploded text. Quote
RobDraw Posted January 11, 2016 Posted January 11, 2016 I'm curious as to why the text would need to remain center justified, if it is not changing and the goal is to have it appear left justified. Quote
RobDraw Posted January 11, 2016 Posted January 11, 2016 If the center justification is absolutely necessary, one could temporarily justify it left so that positioning is easy. Then use the justify command in the right click contextual menu to change the justification back to center without affecting the position of the text. Quote
SAFeSTeR Posted January 11, 2016 Posted January 11, 2016 If the center justification is absolutely necessary, one could temporarily justify it left so that positioning is easy. Then use the justify command in the right click contextual menu to change the justification back to center without affecting the position of the text. I think that would only work if the text width is set to the actual length of the text string. Quote
RobDraw Posted January 11, 2016 Posted January 11, 2016 Did you try it? It works as stated. I got that one from Lynn Allen. Quote
SLW210 Posted January 11, 2016 Posted January 11, 2016 You can use the NODE Snap and select the corners of Center Justified Text. Quote
RobDraw Posted January 11, 2016 Posted January 11, 2016 You can use the NODE Snap and select the corners of Center Justified Text. Then you would run into the issue that SAFeSTeR was referring to. The width would need to be zero or the same as the length of the text string. Quote
SAFeSTeR Posted January 11, 2016 Posted January 11, 2016 Did you try it? It works as stated. I got that one from Lynn Allen. I did try it with the file the OP uploaded and it didn't work for me. However, it does work for me on my own files but I have MTEXT columns set to none rather than dynamic, so I guess this helps. Quote
RobDraw Posted January 11, 2016 Posted January 11, 2016 I did try it with the file the OP uploaded and it didn't work for me. However, it does work for me on my own files but I have MTEXT columns set to none rather than dynamic, so I guess this helps. I keep columns turned off unless I actually need them. They get in the way of some things, like that one. That's one of those "new features" that are on by default but IMHO, should be off until needed. Quote
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.