AutoCAD/multiple segment line

Advertisement


Question
I need to draw a multiple segment line using the @ command and the < command, for example:
line @3<25
line @25.75<180.5
line @17<90.625
and so on...
Ideally I would click on one button or toolbar and be prompted to enter a length and then an angle and then repeat the routine as many times as necessary until I choose to exit. How do I write a program to do that?

Answer
Bob:
I wrote the following code for you.
Save it in a text file and name if AL.lsp
Load from the command line thus:  (load "al")
After that, type AL to execute.
Keep in touch
Bill DeShawn
http://my.sterling.net/~bdeshawn

(defun c:al (/ sp ds angl lp )
  (setq sp (getpoint "Starting point:  "))
  (setq ds (rtos (getdist "\nLength:  ")))
  (setq angl (getstring "\nAngle:  "))
  (command "line" sp (strcat "@" ds "<" angl) "")
  (setq lp (getvar "lastpoint"))
  (while ds
     (command "line" "" (strcat "@" ds "<" angl) "")
     (setq ds (getdist "\nLength:  "))
     (if (null ds) (exit))
     (setq ds (rtos ds))
     (if null ds (exit))
     (setq angl (getstring "\nAngle:  "))
  )            
  (princ)
)

AutoCAD

All Answers


Answers by Expert:


Ask Experts

Volunteer


Bill DeShawn

Expertise

I can address all 2-D questions and some 3-D questions. I do programming in AutoLISP if it doesn`t involve solid modeling. I can also address menu customization issues and can help you find answers to questions I can`t answer by taking your question directly to Autodesk via their newsgroups.

Experience

I used to do electronic and mechanical design for a flat panel monitor manufacturer, and now I do architectural drafting for an architect. I did and do AutoLISP and menu customization and take pride in making my lisp routines to do the work exactly the way the client likes them done.

Publications
I had a routine published in CADENCE magazine (no longer in publication and taken over by CADALYST). Some of my routines are published on my website at http://my.sterling.net/~bdeshawn

©2012 About.com, a part of The New York Times Company. All rights reserved.