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


eBook - Simulation-Driven Design With SOLIDWORKS
Simulation-driven design can reduce the time and cost of product development. In this engineering.com eBook, we’ll explore how SOLIDWORKS users can access simulation-driven design through the SOLIDWORKS Simulation suite of analysis tools. Download Now
eBook - Integrating the Engineering Ecosystem
Aras Innovator provides multiple options for integrating data between systems, depending on the scenario. Utilizing the right approach to meet specific business requirements is vital. These needs range from authoring tools, federating data from various and dissimilar databases, and triggering processes and workflows. Download Now
Research Report - Simulation-Driven Design for SOLIDWORKS Users
In this engineering.com research report, we discuss the rising role of simulation and the paradigm shift commonly called the democratization of simulation. In particular, we focus on how SOLIDWORKS users can take advantage of simulation-driven design through two analysis tools: SOLIDWORKS Simulation and 3DEXPERIENCE WORKS. 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