- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello!
I'm trying to write a routine that does something like this. First of all the user puts in two values - one "constant" and one that's supposed to increase by one per click. As an example would this be useful for naming objects, if you have 10 boxes that should be named 60E1-1, 60E1-2, 60E1-3 and so on ...
I want the name to appear where the user clicks on a new created layer. Most of it is working, but I'm struggeling with combining the user inputs with strcat as I want to call it an integer, but then I'm not able to combine, and it won't write anything with my rtos now (I think).
Maybe you pros can find the problems here?
;;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;;Message to user
(princ "Write TBP to begin ... ")
;;Cleaning up
(defun LM:gpp ( / )
(vl-load-com)
(setq
cmdech (getvar "CMDECHO")
oldlay (getvar 'clayer)
);_ setq
(setvar "CMDECHO" 0)
);_ defun
;;Getting input
(defun LM:brukerinput ( / )
(setq
konstant (vl-string-translate " " " " (getstring T "\nWrite constant value "))
)
(setq
variabelsv (getstring "\nWrite start value ") ;;I actually want this to be a getint, as it's supposed to be a number ...
)
);_defun
;;Combining input
(defun LM:kombinering ( / )
(setq
kombinert (strcat konstant variabelsv) ;;This one fails when they're not both strings apparently
)
);_defun
;;Write text
(defun LM:skrivtekst ( / )
(command "_.Layer" "_Make" "Tellelag" "_Color" "7" "" "LType" "Continuous" "" "")
(eval
(append
'(command "._text" punkta)
(if
(zerop
(cdr
(assoc 40
(entget
(tblobjname "style"
(getvar 'textstyle)
)
)
)
)
)
'(0.5);;Text size
)
'(0
(rtos kombinert 2 0);; And here lies (I think) my next problem, rtos maybe isn't what I'm supposed to use?
)
)
)
);_defun
;;mp
(defun c:tbp ( / )
(LM:gpp)
(LM:brukerinput)
(LM:kombinering)
(while
(setq
punkta (getpoint "\nChoose point ")
variabelsv (+ variabelsv 1)
)setq
(LM:skrivtekst)
)
(setvar "CMDECHO" cmdech)
(setvar "CLAYER" oldlay)
(princ)
);_defun
;;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> End of routine
Regards
ts
Solved! Go to Solution.