Anuncios

The Autodesk Community Forums has a new look. Read more about what's changed on the Community Announcements board.

ВeekeeCZ
en respuesta a: cool.stuff

Not really sure why your code works with "total distance"... this not make sense to me.

But try this code?

 

(defun c:TextDist (/ done p1 p2)
  
  (or *TD-Scale* (setq *TD-Scale* 1.))
  (or *TD-Height* (setq *TD-Height* 1.))
  
  (while (progn
	   (setq done nil)
	   (while (not done)
	     (princ (strcat "Current setting:  Scale " (rtos *TD-Scale*) "  Height " (rtos *TD-Height*)))
	     (initget "Scale Height")
	     (setq p1 (getpoint "\nSpecify a point or [Scale/Height]: "))
	     
	     (cond ((= p1 "Scale") 	(initget 3) (setq *TD-Scale* (getdist "\nScale factor: ")))
		   ((= p1 "Height") 	(initget 3) (setq *TD-Scale* (getdist "\nText height: ")))
		   ((setq done T))))
	   p1)
    
    (if (setq p2 (getpoint p1 "\nSecond point: "))
      (entmake (list (cons 0 "TEXT")
		     (cons 10 (trans p2 1 0))
		     (cons 7 (getvar 'textstyle))
		     (cons 40 *TD-Height*)
		     (cons 1 (rtos (/ (distance p1 p2) *TD-Scale*)))
		     (cons 50 (angle '(0 0 0) (getvar 'ucsxdir)))
		     ))))
  (princ)
  )