Line Lisp routine

Discussion in 'AutoCAD' started by aosterday, Apr 5, 2005.

  1. aosterday

    aosterday Guest

    I have a routine that draws a line between point 1 and point 2, then inserts a block at point 2. I now need to have the line at point 1 to extend past the point by a certain percentage. Any help I can get is much appreciated.
     
    aosterday, Apr 5, 2005
    #1
  2. aosterday

    Jeff Mishler Guest

    (setq proportion 0.1);10% longer
    (setq initial_length (distance pt1 pt2))
    (setq length2add (* initial_length proportion))
    (setq newpt1 (polar pt1 (angle pt2 pt1) length2add))
     
    Jeff Mishler, Apr 5, 2005
    #2
  3. Assuming:
    - you always want the line extended by the same percentage of the overall
    line length, say 10%, beyond point 1, and
    - your points are called pt1 and pt2 in your routine;

    after inserting the block, you could do something like:

    (command "lengthen" "de" (* (distance pt1 pt2) 0.1) pt1 "")

    Change the 0.1 for a different percentage, and the pt1 and pt2 for the names
    you use in your routine. And this assumes there's not likely to be
    something else that it might find at pt1.
     
    Kent Cooper, AIA, Apr 5, 2005
    #3
  4. aosterday

    aosterday Guest

    Thank you Jeff, that worked perfectly
     
    aosterday, Apr 5, 2005
    #4
  5. ....then it needs something to Change the line to the newpt1 location....
     
    Kent Cooper, AIA, Apr 5, 2005
    #5
  6. ....or if you had in mind to do this prior to drawing the line in the first
    place, that works....
     
    Kent Cooper, AIA, Apr 5, 2005
    #6
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.