mtext lisp

Is there any way to create mtext with a lisp routine? I am using 2006
if that makes a difference.
Reply to
Maintenancedude2000
Loading thread data ...
Yes, I have one. I can send it to you. Don't know where it came from. Is your e-mail address shown here valid?
Janice
Reply to
Janice G
Duh! Why not just copy the file contents and post? Sorry folks, brain-freeze, I guess. Well, here 'tis. Oh, be sure and read the "restrictions" part. You must select, in order, line by line, otherwise your finished project will be all jumbled.
;;; Text2MText ;;; (c) 1995 CR/LF GmbH, Essen/Germany ;;; Custom AutoCAD Programming since 1986 ;;; ;;; CR/LF GmbH ----------- ;;; Obere Fuhr 27 | CR / | | ;;; D-45136 Essen || / LF | | ;;; Tel.: ++49 201 254566 || snipped-for-privacy@yahoo.com wrote:
Reply to
Janice G
It's fairly easy to fix the selection issue. Here's part of a routine I use that takes selection set sset1 and re-orders it to sset2.
(while (> (sslength sset1) 0) (setq total_items (sslength sset1)) ; save the number of text lines (if (= base_insertion "") (set_base) ) (setq index 0) ; initialize the pointer (setq saved_distance 99999.9) ; initialize the entity distance ; from base variable (while (< index total_items) (setq this_item (ssname sset1 index)) ; get the next item in the ; selection set (setq this_entity (entget this_item)) ; get the next entity (setq this_insertion (cdr (assoc 10 this_entity))) ; use the base alignment point (setq this_distance (abs (- (cadr base_insertion) (cadr this_insertion) ) ) ) ; get the new Y distance (if (< this_distance saved_distance) (progn (setq saved_distance this_distance) (setq saved_item this_item) ) ) (setq index (1+ index)) ) (setq sset2 (ssadd saved_item sset2)) ; add item to the new ; selection set (ssdel saved_item sset1) ; and delete it from the old )
It also needs this subroutine:
(defun set_base (/ dist entity1 entity2 i1 i2 item1 item2 j1 j2 left_just left_just1 left_just2 max_dist pt1 pt2 total_items ) (setq total_items (sslength sset1)) (setq i1 0) (setq i2 1) (setq max_dist 0.0) (if (> total_items 1) (progn (while (< i1 (- total_items 1)) (while (< i2 total_items) (setq item1 (ssname sset1 i1)) (setq entity1 (entget item1)) (setq item2 (ssname sset1 i2)) (setq entity2 (entget item2)) (setq pt1 (cdr (assoc 10 entity1))) (setq pt2 (cdr (assoc 10 entity2))) (setq dist (abs (- (cadr pt1) (cadr pt2)))) ; get Y distance (if (> dist max_dist) (progn (setq j1 i1) (setq j2 i2) (setq max_dist dist) ) ) (setq i2 (+ i2 1)) ) (setq i1 (+ i1 1)) (setq i2 1) ) (setq item1 (ssname sset1 j1)) (setq entity1 (entget item1)) (setq pt1 (cdr (assoc 10 entity1))) (setq item2 (ssname sset1 j2)) (setq entity2 (entget item2)) (setq pt2 (cdr (assoc 10 entity2))) (if (> (cadr pt1) (cadr pt2)) (setq base_insertion pt1) (setq base_insertion pt2) ) ) (progn (setq item1 (ssname sset1 0)) (setq entity1 (entget item1)) (setq pt1 (cdr (assoc 10 entity1))) (setq base_insertion pt1) ) ) )
Martin
Janice G wrote:
Reply to
Martin Shoemaker

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.