Finding center of text

Hello, I'm trying to write a lisp routine to rotate all selected text around it's center of location (so it doesn't move as when the insertion pt is used as with CHT )
but I don't know how to find the data that shows the coordinates of the end pt of the text. It doesn't show in a list or object properties readout. Can someone give me a clue as to how to find this data info.
Add pictures here
βœ–
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Part of the solution might be to use use Express tools "justify text" to change all to middle center. This works without moving the text objects.

Add pictures here
βœ–
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Ah yes I had already tried that but the cht rotation "always" centers it's rotation on the insertion point no matter where the text is justified.
Add pictures here
βœ–
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
JG a ιcrit :

Hello,
Use the TEXTBOX lisp function...
Philippe
--
http://www.DeliCAD.com - Applicatifs pour AutoCAD et IntelliCAD.
http://www.DeliCAD.com - AutoCAD and IntelliCAD add-ons.
  Click to see the full signature.
Add pictures here
βœ–
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Thanks for the reply, but I don't know of any TEXTBOX lisp function. Is it downloadable somewhere? We are running AutoCad R-14 with Civil Design Softdesk8. We do have Bonus Tools but when I type in TEXTBOX I get "unknown command" .
Add pictures here
βœ–
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

In the Help files for R14 (text, bounding box, AutoLISP) there is a lisp routine for drawing a box around text:
(defun C:TBOX ( / textent tb ll ur ul lr) (setq textent (car (entsel "\nSelect text: "))) (command "ucs" "Object" textent) (setq tb (textbox (list (cons -1 textent))) ll (car tb) ur (cadr tb) ul (list (car ll) (cadr ur)) lr (list (car ur) (cadr ll)) ) (command "pline" ll lr ur ul "Close") (command "ucs" "p") (princ)
)
Use that; draw the diagonal and rotate the text around the midpoint of the diagonal.
There might be other ways...
Brian.
Add pictures here
βœ–
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Thank you! This will do it I'm sure, just some trig from here.
Add pictures here
βœ–
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
HiHo; Here is a R14 lisp program and DCL. Hope this helps. ............................................................................ ................ SAVE BELOW as jrRoText.lsp ............................................................................ ................. ;;;jrRoText ;;; A general text rotater ;;; Rotates text about the midpoint ;;; of selected text. ;;;======================================================= (defun *error* (msg) (Alert msg) (princ) );end defun error
;=========================================================; Set and Save System Variables ; REMBEMBER to edit the vlist list ;========================================================= (Defun pushvars ( ) (setq vlist '(("cmdecho" . 0) ("osmode" . 0) ("OSNAPCOORD" . 1) ("PICKFIRST" . 1) ("AUNITS" . 0) ("ANGBASE" . 0) ("ANGDIR" . 0) ) );end setq
(ForEach pair vlist (Setq name (Strcase (CAR pair) T)) (If (Not (Assoc name sysvars)) (Setq sysvars (Cons (Cons name (GetVar name)) sysvars) ) ) (If (CDR pair) (Setvar name (CDR pair)) ) );end foreach );end pushvars
;=========================================================; Restore System Variables ;========================================================= (Defun popvars ( ) (ForEach pair sysvars (Setvar (CAR pair) (CDR pair)) ) (Setq *error* old_error) (Setq sysvars Nil) );end popvars
;========================================================;;;Start Subs ;========================================================= (defun jrotext ( ) (setq DCL_ID (load_dialog "jrRoText.dcl")) (if (not (new_dialog "jrRoText" DCL_ID)) (exit)) (action_tile "AngEnt" "(setq ang_in (atof $value))") (start_dialog) (unload_dialog DCL_ID)
(setq hr (fix ang_in) mm (fix (* 100 (- ang_in hr))) ss (fix (- (* 10000 ang_in) (+ (* 10000 hr) (* 100 mm)))) ang_out (+ hr (/ mm 60.0) (/ ss 3600.0)) );setq
(PRINC "\nSELECT TEXT TO ROTATE") (SETQ SS1 (SSGET '((0 . "TEXT"))) len 0 );end setq (WHILE (> (sslength ss1)len) (setq enam (SSNAME SS1 len)) (get_middle) (command "ROTATE" enam "" middle ang_out) (setq len (1+ len)) );end while
);end jrotext ;=========================================================; Middle point of text entity ;========================================================= (Defun get_middle () (Command ".ucs" "e" enam) (Setq middle (Trans (Apply 'xer_midpoint (TextBox (EntGet enam)) ) 1 0 ) ) (Command ".ucs" "p") (Setq middle (Trans middle 0 1)) );end get_middle
;==========================================================; Midpoint between p1 and p2 ;=========================================================(Defun xer_midpoint (p1 p2) (MapCar '(Lambda (x1 x2) (* 0.5 (+ x1 x2))) p1 p2 ) );end xer_midpoint
;=========================================================;;;End Subs ;=========================================================;;;Start of main program ;=========================================================(defun c:grt (/ SumVars Stuff) (setq old_error *error*) (pushvars) ;;; The rest of the program goes here (jrotext)
;========================================================= (popvars) (princ) );end c:grt (prompt "\Enter grt to run") ............................................................................ . ............................................................................ SAVE BELOW as jrRoText.dcl ............................................................................ // jrRoText DCL // Use for comments // use ; for end of field
jrRoText : dialog { // begin dialog definition label = "Rotate Text";
:edit_box { label = "Enter Rotatation Angle DD.MMSS"; key = "AngEnt"; edit_width = 10; value = "0"; }
errtile; ok_cancel;
}
Add pictures here
βœ–
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Thank you! I will try this as soon as I get home. Also I wonder if you could help me with my outdated version of VLisp. I'm running the R-14 Version of Cad and Vlisp which I just installed. However when I try to Debug a file all of my Step Into Step Over Step Out are grayed out ? I have the breakpoint set at the first function I have the lsp file loaded and open I've also tried creating a project but the step functions seem hopeless grayed off. Do you know what I am doing wrong ??
Add pictures here
βœ–
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Well I figured it out. You have to set the breakpoint "before" you load the file. Seems like "load" should have been "run" to me, but whatever.
Add pictures here
βœ–
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Polytechforum.com is a website by engineers for engineers. It is not affiliated with any of manufacturers or vendors discussed here. All logos and trade names are the property of their respective owners.