Preserve MTEXT grid location when changing justification (in object properties)

marek
Contributor
Contributor

Preserve MTEXT grid location when changing justification (in object properties)

marek
Contributor
Contributor

Probably there is some system variable, which is changed in my template.

 

The issue:

 

I have MTEXT object with text, justified to Bottom Center. I want to change it to Bottom Left. If I change it, text is visually on the same position, and location geometry (grid) is changed. The same of command JUSTIFYTEXT.

 

But my intention is to keep grid location and visually move text around the "point".

 

How to do it?

What system variable do I need to change?

 

Thank you.

0 Likes
Reply
Accepted solutions (1)
305 Views
2 Replies
Replies (2)

marek
Contributor
Contributor

My workaround:

 

All my MTEXTs are very similar, no annotative, one line, same height, similar width, justification is Bottom Center.

 

So I can change them to DTEXTs and move it to original positions and then changing justification works as I described.

 

1/ I need to remember original position, so for one MTEXT object a create POINT in grid point of that MTEXT object. Let call it pivot point and pivot text.

 

2/ I set same width for all MTEXT objects. Bigger than the biggest one, so no word wrap happen.

 

3/ Set justification to Bottom Left. Now all MTEXT objects have exactly same distance of current grid point to original grid point (distance is width/2).

 

4/ Explode these MTEXT objects to DTEXT objects.

 

5/ Move to original grid points. Move all these DTEXT so pivot text has its grid point in pivot point.

 

6/ Delete temporary pivot point.

0 Likes

ВeekeeCZ
Consultant
Consultant
Accepted solution

I wrote this simple routine for myself to convert MTEXTs (in my case usually coming from C3D) to TEXT preserving the origin.

 

 

(defun c:Mtext2Text ( / ss ed)
  (if (setq ss (ssget '((0 . "MTEXT"))))
    (progn
      (command "_.UCS" "_World")
      (repeat (setq i (sslength ss))
	(setq ed (entget (ssname ss (setq i (1- i)))))
	(entmake (list (cons 0 "TEXT")
		       (assoc 10 ed)
		       (assoc 40 ed)
		       (assoc 1  ed)
		       (assoc 8  ed)
		       (assoc 50 ed)
		       )))
      (command "_.ERASE" ss "")
      (command "_.UCS" "_Previous")
      ))
  (princ)
  )

 

0 Likes