Message 1 of 12
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi, I need a lisp for transforming several texts into the same several different mtext, thx!
Solved! Go to Solution.
Hi, I need a lisp for transforming several texts into the same several different mtext, thx!
Solved! Go to Solution.
yes, take a look at drawing in att, thx
Try Text1MtextJust.lsp with its T1MJ command, available >here<. Not only does it convert individual Text objects into individual separate Mtext objects, but it also does it to Attribute definitions, and it preserves all aspects of justification, which TXT2MTXT does not always do.
At its most basic
(defun c:T2MT (/ c_doc sv_lst sv_vals ss cnt)
(vl-load-com)
(setq c_doc (vla-get-activedocument (vlax-get-acad-object))
sv_lst (list 'cmdecho 'osmode)
sv_vals (mapcar 'getvar sv_lst)
);_end_setq
(mapcar 'setvar sv_lst '(0 0))
(setq ss (ssget '((0 . "TEXT"))))
(cond (ss
(if (= 8 (logand 8 (getvar 'UNDOCTL))) (vla-endundomark c_doc))
(vla-startundomark c_doc)
(repeat (setq cnt (sslength ss))
(vl-cmdf "txt2mtxt" (ssname ss (setq cnt (1- cnt))) "")
)
(if (and c_doc (= 8 (logand 8 (getvar 'UNDOCTL)))) (vla-endundomark c_doc))
)
)
(mapcar 'setvar sv_lst sv_vals)
(princ)
)
I am not one of the robots you're looking for
this is it! thx you!
Is it easy to add a Bottom Centre justification to the created MText?
@krazeymike wrote:
Is it easy to add a Bottom Centre justification to the created MText?
If the source Text object is justified that way, T1MJ will make the Mtext conversion likewise. If not, this will give the VLA object version [the obj variable here] of an Mtext object that justification:
(vla-put-AttachmentPoint obj 8)
Thankyou Kent, I'm just not sure how to add (vla-put-AttachmentPoint obj 8) into the M2MT Lisp above
@krazeymike wrote:
Thankyou Kent, I'm just not sure how to add (vla-put-AttachmentPoint obj 8) into the M2MT Lisp above
Do you mean T2MT in Message 5? If so, I hope just adding a line [here, line 3] would do it [untested]:
(repeat (setq cnt (sslength ss))
(vl-cmdf "txt2mtxt" (ssname ss (setq cnt (1- cnt))) "")
(vla-put-AttachmentPoint (vlax-ename->vla-object (entlast)) 8)
)
[That assumes that the TXT2MTXT conversion inside there results in a new entity name, as it does manually.]
Yes I did mean T2MT on in message 5.
Pasting it into Line 3 wouldn't run but placing it before the (princ) on line 27 worked like a charm.
Thankyou
(Original Edited)
I went a bit off topic here, can't delete so I have edited instead. Thanks for the help Kent
I have a Lisp routine that converts mText or Text to blocks about the insertion point. The only problem is that no matter the justification standard text is always inserted to the left node rather than the centre.
I'm not sure what causes standard text insertion to default to the left node and so am not sure where to look to correct this.