Jump to content

HOW TO TEXT JUSTIFICATION ON MIDDLE CENTER


Recommended Posts

Posted
(DEFUN C:FLR()

  (COMMAND "PDMODE" 3)(COMMAND "-LAYER" "S" "Field-Line" "")

  (SETQ
    P1(GETPOINT "\n PICK FIELD LINE START POINT :")

    P2(GETPOINT P1 "\n PICK FIELD LINE END POINT :")

    P3(GETPOINT P1 "\n PICK RIGHT SIDE  :")

    AN1(ANGLE P1 P2)

      

    
    )

  
  (COMMAND "UCS" "3" P1 P2 P3 "")

   

  (REPEAT 100

   (vl-vbaload "E:/FMB Cadd/Field Line.dvb")

   (VL-VBARUN "FL") 

    (SETQ
      
    GS(GETSTRING "\n FIELD LINE NUMBER :")
    
    YV(GETREAL "\n ENTER LINE LENGTH VALUE:") 

    XV(GETREAL "\n ENTER OFFSET VALUE:") 

    th(atof(getvar "users1"))
    )
 ; (COMMAND "DELAY" 60)
  ;(COMMAND "POINT"  (LIST XV YV) )
  (COMMAND "CIRCLE"  (LIST XV YV)(+ TH 0.2) )
  ;(COMMAND "DELAY" 60)  

  (ENTMAKE (LIST (CONS 0 "TEXT")
                   (CONS 100 "AcDbEntity")
                   (CONS 100 "AcDbText")
                   (CONS 10 (trans (LIST XV YV) 1 0)) ; POINT
                   (CONS 40 th)
                   (CONS 7 (GETVAR 'textstyle))
                   (CONS 8 (getvar "CLAYER"))
                   (CONS 62 1)
                   (CONS 1 GS) ;VALUE
                   (CONS 50 0 )

		           (CONS 72 1)
                   (CONS 11 (LIST XV YV))
                   (CONS 73 2)

		 ))
)

  (vl-vbaload "E:/FMB Cadd/Field Line.dvb");testdial

   (VL-VBARUN "FL") 
  )

 

Posted (edited)

Use this

;;;	   just72 (left->0, center->1, right->2,aligned (if vertical alignment=0)->3)
;;;	   just73 (baseline->0, bottom->1, middle->2,top->3)
(cons 72 just72)				;;; Horizontal Alignment
(cons 73 just73)				;;; Vertical Alignment

;; or if you are using "just" numbers
'(72 . 1)
'(73 . 2)

And the insertion point should be  11  instead of 10

Edited by Isaac26a
  • Like 2
Posted

These have always worked for me if you don't want to entmod the text.

 

 

 

(defun c:jul()  (jut "l")) ;;ju: Justify + l: Left
(defun c:juc()  (jut "c")) ;; c: centre
(defun c:jur()  (jut "r")) ;; r: right
(defun c:jutl() (jut "tl"));; t: top
(defun c:jutc() (jut "tc"))
(defun c:jutr() (jut "tr"))
(defun c:juml() (jut "ml"));; m: middle
(defun c:jumc() (jut "mc"))
(defun c:jumr() (jut "mr"))
(defun c:jubl() (jut "bl"));; b: Bottom
(defun c:jubc() (jut "bc"))
(defun c:jubr() (jut "br"))

(defun jut (just / var ent)
  (setq var (getvar "CMDECHO"))
  (setvar "CMDECHO" 0)
  ;;https://www.cadtutor.net/forum/topic/35569-text-justification-lisp/
  (princ (strcat "\nSelect Text"))
  (if (setq ss (ssget "_:L" '((0 . "ATTDEF,MTEXT,TEXT"))))
    (command "_.justifytext" ss "" just)
  )
  (setvar "CMDECHO" var)
  (princ)
)

 

  • Like 1
Posted

THANKS Steven P NICE PROGRAM

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...