×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-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!

*Tek-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

Leader Lisp

Leader Lisp

Leader Lisp

(OP)
Greetings All,

I'm updating some old lisp routines and one of them is a routine that draws a leader by picking points, drawing lines among those points and instering an arrow block at the original point.  I'd rather have people just draw a normal leader but the learning curve is rather steep here (we have old schooler's) so the intent is to rewrite the existing lisp without anyone knowing there were any changes.

The old lisp lets you pick the first point then as many points as needed until you hit enter or cancel. The problem I'm having is the furthest I've been able to get it is the first and second point.  I assume a WHILE command would continue the points but can't figure out where it should be inserted.

Here's my current code:

CODE

(defun C:AL (/ pt1 pt2)
 (command "_.LAYER" "_S" "DIMEN" "")
   (setq pt1 (getpoint "\nStart of leader: ")
         pt2 (getpoint pt1 "\nTo point: "))
   (command "_.LEADER" pt1 pt2 "_Annotation" "" "n")
)

and here's the WHILE code from the old lisp:

CODE

(while (setq pt2 (getpoint pt2 "\n   To point: "))
   (command pt2)) (command "")

If that code is used in the leader command it errors and starts a regular leader entity.

Thanks,

Keith

RE: Leader Lisp

I don't see a way of incorporating the unlimited picks in the command & displaying it as you go.  Could use the "pline" command, erase it, use points in the "leader" command.

Here's a partial solution, it doesn't show the leader if multiple poimts are picked, se what you think..

(defun C:ldr ()
  (setq Pt1 (getpoint "\nSelect leader start point: "))
  (command "leader" Pt1)
  (while (setq Pt1 (getpoint Pt1 "Next point: "))
     (command Pt1)
  )
  (command "_Annotation" "" "_N")
  (princ)
)

RE: Leader Lisp

(OP)
That works real well, exactly what I'm looking for but you're right it doesn't display it.  I can imagine the frantic phone calls if I use it, though.

My lisp is a bit rusty, how could we incorporate your idea of using a pline?

RE: Leader Lisp

Hmmm..shooting from the hip.  No error trapping-

(defun C:ldr ()
  (setvar "CMDECHO" 0);disable command prompts
  (setq Pt1 (getpoint "\nSelect leader start point: "))
  (setq PtList (list Pt1));list of 1 point
  (command "pline" Pt1);;start pline command with first point
  (while (setq Pt1 (getpoint "\nNext point: "))
     (command Pt1);;draw next point of polyline)
     (setq ptList (cons Pt1 PtList));;add point to list
  )
  (command "");end pline command
  (setq ptList (reverse PtList));reverse so first point at front
  (entdel (entlast));delete pline
  (command "leader")
  (foreach Pt PtList
         (command Pt);feed points to leader
  )
  (command "" "_Annotation" "" "_N");;finish leader cmd
  (princ)
)

RE: Leader Lisp

(OP)
Wow, pretty slick!  BTW, had to remove the first set of double quotes in the last command line.  Unfortunately the rubber band doesn't show, is there a chance of turning it on?  I hate to be picky but with these guys here ANY change would be devastating.

Thanks.

RE: Leader Lisp

Ok, just one change to the "getpoint" line.  You're welcome :)

CODE

(defun C:ldr ()
  (setvar "CMDECHO" 0);disable command prompts
  (setq Pt1 (getpoint "\nSelect leader start point: "))
  (setq PtList (list Pt1));list of 1 point
  (command "pline" Pt1);;start pline command with first point
  (while (setq Pt1 (getpoint Pt1 "\nNext point: "))
     (command Pt1);;draw next point of polyline)
     (setq ptList (cons Pt1 PtList));;add point to list
  )
  (command "");end pline command
  (setq ptList (reverse PtList));reverse so first point at front
  (entdel (entlast));delete pline
  (command "leader")
  (foreach Pt PtList
         (command Pt);feed points to leader
  )
  (command "_Annotation" "" "_N");;finish leader cmd
  (princ)
)

RE: Leader Lisp

(OP)
Par excellent!  Thanks very much for your time and efforts!

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 Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

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

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

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

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close