<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
<title>lisp routine adjustment</title>
<link>http://www.zwsoft.com/forum/viewthread.php?tid=2521</link>
<description>hi,this is a lisp routine that calculates the area of a polyline and lets you place a text in the dwg.
I want this text to be justified middle center but i don't know how to.
Can anyone help me?
thanks!



;;;RET een entiteit (name) NA SELECTIE DMV MEERDERE OPGEGEVEN TYPES ENTITEITEN (e_type)
;;;e_prompt = te geven prompt
(defun sel_ents
(e_type e_prompt / aard ent)
  (while (not (member aard e_type))
    (while (not (setq ent (entsel e_prompt))))
    (if
(not (member (setq aard (dxf 0 (entget (car ent)))) e_type))
      (prompt

&quot;\nIncorrect entiteit-type !&quot;
      )
    )
  )
  ent
)

(defun dxf (code elist) (cdr (assoc code elist)))


(defun c:MS (/ el pt_e pt_wcs o
ha_ a_ ca_ $ lay col txt_hgt hk
zone

     eed_l)

  (if (setq ent
(sel_ents (list &quot;LWPOLYLINE&quot; &quot;POLYLINE&quot;)

  &quot;\nSelecteer polyline: &quot;

)
      )
    (progn
      (setq el (entget (car ent)))
      (if (@main-even (dxf 70 el))

(alert &quot;Opgelet: polyline is niet gesloten !&quot;)
      )
      (command &quot;_area&quot; &quot;_O&quot; ent)
      (setq $opp (strcat &quot;Opp.= &quot; (rtos (/ (getvar &quot;AREA&quot;) 10000.0) 2 2) &quot; m2&quot;))
      (setq $omtrek (strcat &quot;Omtr.= &quot; (rtos (/ (getvar &quot;PERIMETER&quot;) 100.0) 2 2) &quot; lm&quot;))
      (setq pt (getpoint &quot;\nGeef positie tekst:&quot;))
      (@main_ent-mtext &quot;MEETSTAAT&quot; 8 (strcat &quot;\n&quot; $opp &quot;\n&quot; $omtrek) &quot;A_25_50&quot; pt 12.0 0.0 150.0 nil)
    )
  )
)



 ;;;MAAKT TEXT-ENTITEIT AAN
(defun @main_ent-mtext ($lay col str $style pt ht ang width ext_l / ent_list)
  (@main_ent-textstyle $style)
  (setq
    ent_list
     (list
       (cons 0 &quot;MTEXT&quot;)
       '(100 . &quot;AcDbEntity&quot;)
       (cons 8 $lay)
       (cons 62 col)
 
'(100 . &quot;AcDbMText&quot;)
       (cons 10 pt)
       (cons 40 ht)
       (cons 41 width)
       (cons 1 str)
       (cons 50 ang)
       (cons 7 $style)
       '(210 0.0 0.0 1.0)
     )
  )
  (if ext_l
    (setq ent_list (append ent_list (list (list -3 ext_l))))
  )
  (entmake ent_list)
)



(defun @main_ent-textstyle (style / ent_list)
  (if (not (tblsearch &quot;STYLE&quot; style))
    (setq
      ent_list
       (list

 '(0 . &quot;STYLE&quot;)

 '(100 . &quot;AcDbSymbolTableRecord&quot;)

 '(100 . &quot;AcDbTextStyleTableRecord&quot;)

 (cons 2 style)

 '(70 . 0)

 '(40 . 0.0)

 '(41 . 1.0)

 '(50 . 0.0)

 '(71 . 0)

 '(42 . 2.5)

 '(3 . &quot;txt&quot;)

 '(4 . &quot;&quot;)
       )
    )
  )
)


;;controleert of een getal even is
(defun @main-even (getal /)
  (if (= getal 0)
    T
    (if
(= (gcd 2 getal) 2)
      T
      nil
    )
  )
)


(prompt &quot;\nMeetstaat tool loaded.&quot;)
(princ)</description>
<author>tonyd</author>
<pubDate>2012-11-22 01:16:57</pubDate>
<item><link>http://www.zwsoft.com/forum/viewthread.php?tid=2521&amp;pid=16304</link>
<description>hi Daniel,
it works.
Thank you!</description>
<author>tonyd</author>
<pubDate>2012-11-22 15:13:27</pubDate>
</item><item><link>http://www.zwsoft.com/forum/viewthread.php?tid=2521&amp;pid=16303</link>
<description>You can use this:
(setq 
ent_list 
(list 
(cons 0 &quot;MTEXT&quot;) 
'(100 . &quot;AcDbEntity&quot;) 
(cons 8 $lay) 
(cons 62 col) 

'(100 . &quot;AcDbMText&quot;) 
(cons 10 pt) 
(cons 40 ht) 
(cons 41 width) 
(cons 1 str) 
(cons 50 ang) 
(cons 7 $style) 
(cons 71 5)
'(210 0.0 0.0 1.0) 
) 
)</description>
<author>huangy8949</author>
<pubDate>2012-11-22 10:53:06</pubDate>
</item>  </channel>
</rss>