TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Coder on June 12, 2018, 06:33:41 AM

Title: Help with text alignment
Post by: Coder on June 12, 2018, 06:33:41 AM
Hello guys.

I am facing a problem with the text alignment when it is not Left then the insertion point would be the same as the selected text.

Code - Auto/Visual Lisp: [Select]
  1. (setq txt_val (getstring "\nNew string :"))
  2. (setq txt_obj (ssget '((0 . "TEXT"))))
  3. (setq copy_txt (vla-copy (vlax-ename->vla-object (ssname txt_obj 0))))
  4. (vla-put-textstring copy_txt txt_val)
  5.  
  6. (while (= (car (setq vals (grread t 15 0))) 5)
  7.     (redraw)
  8.   (vlax-put-property copy_txt 'insertionpoint (vlax-3d-point (cadr vals)))
  9.   )
  10.  

Thank you in advance.
Title: Re: Help with text alignment
Post by: Coder on June 12, 2018, 07:24:17 AM
Solved with function 'TextAlignmentPoint instead of 'insertionpoint if justification is other than left.
Title: Re: Help with text alignment
Post by: Lee Mac on June 12, 2018, 08:26:36 AM
You may also refer to the functions aligntext:gettextinsertion & aligntext:puttextinsertion used as part of my Align Text (http://lee-mac.com/aligntext.html) program.
Title: Re: Help with text alignment
Post by: Coder on June 12, 2018, 09:00:48 AM
You may also refer to the functions aligntext:gettextinsertion & aligntext:puttextinsertion used as part of my Align Text (http://lee-mac.com/aligntext.html) program.

Wow, that's too advanced to me although I got your point with dxf 10 otherwise 11  :grinwink:
Thank you for your kind reply and time.
Title: Re: Help with text alignment
Post by: cmwade77 on June 12, 2018, 11:48:07 AM
There is also my align text routine, probably a little simpler (especially if you ignore the supporting routine that reduces the MTEXT box sizes to the minimum needed) than Lee's, but Lee's code usually is better. In fact this is one of the few routines I have that doesn't have some of his code in it, at least I don't think I have any of his code here.
Title: Re: Help with text alignment
Post by: Coder on June 12, 2018, 03:47:18 PM
Thank you for your kind reply.