×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Modify Lisp Routine

Modify Lisp Routine

Modify Lisp Routine

(OP)
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))

RE: Modify Lisp Routine

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.

RE: Modify Lisp Routine

If you want your previous txtht setting to be reused, you can also do:

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

Don Phillips
http://worthingtonengineering.com

RE: Modify Lisp Routine

(OP)
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

RE: Modify Lisp Routine

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.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources