Need to add text size option to this LISP

Need to add text size option to this LISP

Mabwys
Observer Observer
357 Views
3 Replies
Message 1 of 4

Need to add text size option to this LISP

Mabwys
Observer
Observer

Hello! I am new to coding and I'm not sure how to add a line about text size. I was able to change the size of the octagon, but I need the text size to update with it. Any solutions? LISP file is attached

0 Likes
Accepted solutions (1)
358 Views
3 Replies
Replies (3)
Message 2 of 4

calderg1000
Mentor
Mentor
Accepted solution

Regards @Mabwys 

Maybe this change will help.

; inserts increasing numbers inside hexagon
(defun c:nmp (/ p n ni ts oecho ds th txt na)  
;;;  (if (= 0 (getvar "dimscale"))
;;;;;;    (setq ds 1.0)
;;;;;;    (setq ds (getvar "dimscale"))
;;;  )
;;;  (setq th (getvar "dimtxt"))
  (setq th(getreal"\nEnter text height...:"))
;;;  (setq txt (* th ds))
  (setq txt th)
  (setq ts txt)
  (if nn (setq nn (fix nn))(setq nn 1))
  (if (= nn 0)(setq nn 1))
  (princ "\n Increment by < ")
  (princ nn)
  (princ " >? : ")
  (setq ni (getint))
  (if (= ni nil)(setq ni nn)(setq nn ni))
  
  (if np
    ()
    (setq np 1)
  )
  (princ "\n Start or continue with number < ")
  (princ np)
  (princ " >? : ")
  (setq n (getint))
  (if (= n nil)
    (setq n np)
    (setq np n)
  )
  (setq p (getpoint "\n Number location: "))
  (setq oecho (getvar "cmdecho"))
  (setvar "cmdecho" 0)
  
  (while p
    (setq na (itoa n))
    (entmake (list (cons 0 "TEXT")	
		    (cons 10 p)	
		    (cons 11 p)	
		    (cons 1 na); actual text
		    (cons 7 (getvar "TEXTSTYLE"))
		    (cons 40 txt)
		    (cons 72 4)
	      )
     )
    (if (> n 99)
      (command "polygon" "8" p "c" (* ts 142.5))
      (command "polygon" "8" p "c" (* ts 120)))
    (setq p (getpoint "\n Next number location: ")
	  n (+ ni n)
	  np n
    )
  )
	 
  (setvar "cmdecho" oecho)
  (princ)
)

(princ "\n Type > NMP <  to insert numbers inside hexagon")

Carlos Calderon G
EESignature
>Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

0 Likes
Message 3 of 4

Sea-Haven
Mentor
Mentor

Something similar. Square or Circle. Save the Multi lisps in a support path for autoload.

 

I seem to remember doing a slot with round ends. I am trying to remember wether mtext has other than a rectang as a background mask. 

 

SeaHaven_0-1712637276380.png

 

0 Likes
Message 4 of 4

Mabwys
Observer
Observer

Hey this did help the text size, but it broke the rest of the code. I am using LT if that makes a difference

@calderg1000 

 

nvm I fixed it thank you so much!!!!

 

0 Likes