Author Topic: Help with text alignment  (Read 1489 times)

0 Members and 1 Guest are viewing this topic.

Coder

  • Swamp Rat
  • Posts: 827
Help with text alignment
« 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.

Coder

  • Swamp Rat
  • Posts: 827
Re: Help with text alignment
« Reply #1 on: June 12, 2018, 07:24:17 AM »
Solved with function 'TextAlignmentPoint instead of 'insertionpoint if justification is other than left.

Lee Mac

  • Seagull
  • Posts: 12922
  • London, England
Re: Help with text alignment
« Reply #2 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 program.

Coder

  • Swamp Rat
  • Posts: 827
Re: Help with text alignment
« Reply #3 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 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.

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Help with text alignment
« Reply #4 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.

Coder

  • Swamp Rat
  • Posts: 827
Re: Help with text alignment
« Reply #5 on: June 12, 2018, 03:47:18 PM »
Thank you for your kind reply.