Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Modify Lisp Routine

Status
Not open for further replies.

taffcad

Mechanical
May 27, 2004
49
0
0
GB
Hi To all you Lisp Gurus

I have a lisp routine that I would like the text size to be changed on the command line prompt. The 3rd line says about txt height and getvar? Is the answer already there and am I missing something.

Any help would be great.

Thanks

Taffcad

(defun c:AUTONUM ()
(setvar "cmdecho" 0)
(if (null txtht) (setq txtht (* 0.125 (getvar "ltscale"))))
(setq pt1 (getpoint "\nSelect starting point: "))
(setq n1 (getint "\nEnter first number: "))
(setq n2 (getint "Enter last number: "))
(setq inc (getint "Enter increment: "))
(setq drctn (getint "Enter 1 for hor, 2 for vert, 3 for angle: "))
(setq vfeed (getreal "Enter distance between numbers: "))
(setq hfeed vfeed)
(if (= drctn 1) (setq vfeed 0))
(if (= drctn 2) (setq hfeed 0))
(while (<= n1 n2)
(command "text" "c" pt1 txtht "0" n1)
(setq pt1 (list (+ hfeed (car pt1)) (+ vfeed (cadr pt1))))
(setq n1 (+ n1 inc))
 
Replies continue below

Recommended for you

Taffcad,
Try this. Comment out the line like so :

;(if (null txtht) (setq txtht (* 0.125 (getvar "ltscale"))))

and add this new line after it :

(setq txtht (getreal "\nEnter text height: "))

I hope that is what your asking for.
 
Cadmiles

Absolutely brilliant. Just what I wanted. You deserve a gold star.

Can I ask another favour. In the angle selection where does the 45> get stipulated in the code. Is it possible to enter a specific angle as a choice as with the text height.

Don Philips

Will try your post and see how I get on. Can you tell me where to stick it. Don't get personal. Do I put it in the same place instead of Cadmiles post and save as a seperate routine or does it get incorporated in it.

Many thanks for your responses. These lisps are pretty neat.

Cadman
 
I'll answer for Don :)

Stu=ick his code same place as CADMILES, it does essentially the same thing, except if there has already been a text height entered (routine has been run previously in same session), user will not get prompted for a new height, and the previous height will be used. You may or may not want this.

The 45 angle is just that 'hfeed' is set egual to 'vfeed', so each new number is offset in x & y by equal amounts. It wouldn't be too tough (try it!) to change the calculation for 'pt' (next to last line) to incorporate an angle.
 
Status
Not open for further replies.
Back
Top