Author Topic: Insert prefix  (Read 1323 times)

0 Members and 1 Guest are viewing this topic.

Fabricio28

  • Swamp Rat
  • Posts: 670
Insert prefix
« on: March 20, 2015, 03:40:30 PM »
Hi guys,

I was trying to do 2 things in this code.
1- Change the the text size.
2- Prefix A=

I got modify the text size. But I couldn't put prefix.

Anybody could help me, please?

And give me a class about it, because I really wanna know more about lisp.

Thank you

Code: [Select]
;;; Cálculo de área em Hectares


(defun c:HA( / )

(setq ponto (getpoint "\nClique no centro da Área :"))


(command "color" "yellow" "")
(command "boundary" ponto "")


(command "area" "o" "last")
(command "color" "ByLayer" "")
(setq CONF "S")
(initget 1 "S s N n")
(setq CONF(getkword "\nConfirma?Sim/Não: "))
(command "erase" "last" "")

(if (or (= CONF "S") (= CONF "s"))
(progn

(setq a (getvar "area"))
(setq a (/ a 10000.00))
(setq a (rtos a 2 4))

(setq final (strcat a " Ha"))


(command "_.text" "M" ponto "" "0" final 2.54 )
;(command "_text" "_j" "_mc" "90" 2.54)
)
)
(princ)
)




(defun c:SETL (/ cnt int lname pref)
(setq int (getint "\nParte?: "))
(setq pref (getstring T "\nLayer: "))
(setq cnt 0)
(while (< cnt int)
(setq cnt (1+ cnt))
(setq lname (strcat pref (itoa cnt)))
(if (not (tblsearch "LAYER" lname))
(command "._layer" "_M" lname "_C" (itoa cnt) lname "_Lt" "Continuous" lname ""))
)
(princ)
)


wkplan

  • Mosquito
  • Posts: 10
Re: Insert prefix
« Reply #1 on: March 21, 2015, 05:13:39 AM »
The strcat does the job. The same way you added " Ha" to the area.

Just change:
Code: [Select]
(setq final (strcat a " Ha"))
to:
Code: [Select]
(setq final (strcat "A= " a " Ha"))
regards
Wolfgang