Jump to content

Recommended Posts

Posted

(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?

  • Replies 21
  • Created
  • Last Reply

Top Posters In This Topic

  • RobDraw

    6

  • Andrew1979

    4

  • SAFeSTeR

    4

  • rlcad

    4

Top Posters In This Topic

Posted Images

Posted

Perhaps justify MText to 'Middle Left', select it then pick the square grip and move it to the desired position?

Posted

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

attachment.php?attachmentid=56589&cid=1&stc=1

 

x8Ky8buBRTPhQAAAABJRU5ErkJggg==

Capture.JPG

Posted

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)

Posted

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.

Posted
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

Posted
[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

Posted

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.

Posted

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, + & -.

Posted (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 by SAFeSTeR
typo
Posted
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.

Posted

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.

Posted

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.

Posted
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.

Posted

Did you try it? It works as stated. I got that one from Lynn Allen.

Posted

You can use the NODE Snap and select the corners of Center Justified Text.

Posted
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.

Posted
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.

Posted
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.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...