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


Autolisp pause when insert attributes

Autolisp pause when insert attributes

Autolisp pause when insert attributes

I have created a program that will automatically insert a standardized drawing title, and then insert a north arrow with a specified direction.  It works ok except that when lisp inserts "atitleft" and the user is prompted for the attribute title (txt), it will not allow for spaces between words. I've tried using pause instead of first using getstring-txt but that didn't work. Any ideas as how to allow for spaces when intering the title name?

(defun C:titlexft ()
 (setq la (getvar "clayer"))
 (command "blipmode" "on")
 (command "layer" "s" "titletxt" "")
 (setq lt (/ (getvar "ltscale") 30))
 (setq scf (/ (getvar "dimscale") 96))
 (setq pnt1 (getpoint "\nPick insertion point for bottom-left of text "))
 (setq txt (getstring "\nDrawing Title: "))
 (setq scl (getstring "\nDrawing Scale <20'>: "))
 (setq tem (getstring "\nDrawing Template <SCALE: 1=>: "))
 (command "insert" "atitleft" "s" lt pnt1 "" txt scl tem)
 (setq pnt2x (- (CAR  PNT1) (* 61 SCF)))
 (setq pnt2y (+ (CADR PNT1) (* 18 SCF)))
 (setq pnt2 (list pnt2x pnt2y))
 (setq ang1 (getorient PNT2 "DIRECTION OF NORTH ARROW: "))
 (setq ang2 (* (/ ANG1 PI) 180))
 (setq pnt3 (polar pnt2 (+ ANG1 PI) (* 27 SCF)))
 (command "insert" "anarrow" pnt2 scf "" ang2)
 (command "insert" "anlogo" pnt3 scf "" "")
 (command "layer" "s" la "")
 (command "blipmode" "off")

RE: Autolisp pause when insert attributes

In order to allow blanks with the getstring function the first optional argument should be non-nil.  Thus:

(setq txt (getstring T "\nDrawing Title: "))

will allow you to enter a string with spaces in it.

I'm confused though on the following command:

command "insert" "atitleft" "s" lt pnt1 "" txt scl tem)

After the double quotes (which is saying you're accepting the current number for the rotation). The insert command is done. I assume your trying to put in values for attributes. But as near as I can tell that won't work. I'm using Acad 2002 so maybe something changed but I doubt it.

RE: Autolisp pause when insert attributes

Thanks, that worked.  As for the three values, I'm using A2000 & A2004 and it does seem to work as it is- in both versions.  Yes the insert command is done, but the attributes were attached to the block that was inserted.  From what I've seen Autolisp seems to require that any additional values be added to the same command sequence.

RE: Autolisp pause when insert attributes

Great. I tried the insert command in 2006 and it worked.  I don't know if I just had my attributes goofed up earlier today when I tried it in 2002 or what, but you're right, it should work.

Anyway, glad I could help

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! Already a Member? Login


White Paper - How to Capitalize on HVAC/R Trends to Drive Business Growth
According to Steve Yurek, CEO of the Air Conditioning, Heating and Refrigeration Institute, the HVAC/R industry is facing change on all fronts. This includes challenging trends on contractors and distributors like new refrigerants, growing automation, complex sensors and monitoring, green initiatives and a technician shortage. We look at these trends and outline actionable insights on how it all can be turned into a competitive advantage and business opportunity. Download Now
eBook - Manufacturing the Cars of Tomorrow
In this ebook, we'll explore how additive manufacturing is going to transform the way cars are made. This includes commentary from thought leaders such as Ford's CTO, Ken Washington, Customer case studies of ways 3D printing is being used today, and a variety of part examples where 3D printing is already impacting how automobiles are made. Download Now
White Paper - Smart Manufacturing for Semiconductor
New technologies and approaches present great opportunities for semiconductor manufacturers to achieve high levels of innovation, yield and improvement. This white paper explores some of these cutting-edge technologies and how they can be applied effectively in the semiconductor industry. Read about how Smart Manufacturing is transforming the semiconductor industry. Download Now

Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close