See the top rated post in this thread. Click here

Page 1 of 3 123 LastLast
Results 1 to 10 of 27

Thread: Draw a line starting from the midpoint of itself

  1. #1
    Active Member Neo_Richard_Blake's Avatar
    Join Date
    2006-09
    Location
    Bakersfield, CA
    Posts
    67
    Login to Give a bone
    0

    Default Draw a line starting from the midpoint of itself

    Is there a way to draw a line by first picking it's midpoint? I'm trying to draw some lines that will have the same centerline, but I hate drawing a line, then moving it, draw line, move it, etc. This gets easily irritating with a lot of lines.

    If AutoCAD does it, and I just didn't know that'd be awesome, but I'm hoping someone has a LISP file that I can load up to do it. Thanks in advance for the help.

  2. #2
    100 Club
    Join Date
    2008-05
    Posts
    161
    Login to Give a bone
    0

    Default Re: Draw a line starting from the midpoint of itself

    Can you give a better example of what you are trying to do?

    If you know the Midpoint then you already have the Endpoints. So why would you need to pick the Midpoint of the line first if the Endpoints are already known?

  3. #3
    Active Member Neo_Richard_Blake's Avatar
    Join Date
    2006-09
    Location
    Bakersfield, CA
    Posts
    67
    Login to Give a bone
    0

    Default Re: Draw a line starting from the midpoint of itself

    Okay, say you have a line that will be your centerline for a pipe. Well, when you draw the ends of the pipe, they'll be perpendicular, and bisected by said line, right? Well, to draw the end you could run the LINE command and then...

    ...select the endpoint of the centerline, draw half your needed distance, then go back and stretch, mirror, copy or paste the pipe-end line.

    ...use the FROM osnap, and draw the whole needed length. (honestly though, I have never really been able to get FROM to work properly for me since it uses coordinates).

    My idea is that this could be done without having to use an extra command. Sort of like how ARC lets you select the start point or center. I want to be able to select the start point or midpoint of a line from the get-go. Then half the entered length will go out from both ends of your selection point, so you get one line of the appropriate length, with it's midpoint already in its desired ending location.

    Does that make more sense?

  4. #4
    Certified AUGI Addict jaberwok's Avatar
    Join Date
    2000-12
    Location
    0,0,0 The Origin
    Posts
    8,570
    Login to Give a bone
    0

    Default Re: Draw a line starting from the midpoint of itself

    Okay, that makes sense.
    There's no in-built tool but look up Tracking (tk) in Help for A20009. I think it was Temporary Tracking Points (tt) in earlier versions.

  5. #5
    Active Member Neo_Richard_Blake's Avatar
    Join Date
    2006-09
    Location
    Bakersfield, CA
    Posts
    67
    Login to Give a bone
    0

    Default Re: Draw a line starting from the midpoint of itself

    Well, 2 things. I don't have 2009, I have 2008. Sorry I should have specified. And I think you're refering to osnap tracking right? Well, that only works for specific points. Endpoint, midpoint, quadrant, etc. Use the tracking and you can start a certain distance form that point right? Well, let's change the imagined situation a bit. Let's pretend we don't have a centerline drawn, but we want things to line up as though there were one. We drafters area lazy bunch, and we don't want to have to erase the line later. But we're going to draw a section view of a cone from centerpoint to centerpoint. Make sense? We know that we're going to end up with a trapazoid shape at the end. Let's say, one end of the cone has a 1" dia. flat, and the other end has a 2" dia flat. the total length is 8". I want the midpoint of the 1" to be at origin.

    Now, what I want to do is to be able to type LINE; 0,0; [midpoint]; (move my mouse in the desired direction); 1, and get a line that goes out (let's say) vertically, 1/2" from origin in each direction. Is it just me, or doesn't that sound easier than having to mess with osnap tracking, or FROM, or MOVE, etc.? Then, you can osnap track 8" from the midpoint of this line; click; [midpoint]; 2, and now you've got both ends of the trapazoid.

  6. #6
    100 Club
    Join Date
    2008-05
    Posts
    161
    Login to Give a bone
    0

    Default Re: Draw a line starting from the midpoint of itself

    Ok... I got ya...

    It's quick and dirty but I think it's what you're trying to do.

    Code:
    (defun C:TZOID (/ p1 dq p2 d2 ang p1o1 p1o2 p2o1 p2o2)
      (setq p1 (getpoint "\nSpecify first point: ")
              d1 (/ (getreal "\nWidth: ") 2)
              p2 (getpoint "\nSpecify second point: ")
              d2 (/ (getreal "\nWidth: ") 2)
              ang (angle p1 p2)
              p1o1 (polar p1 (- ang (/ pi 2)) d1)
              p1o2 (polar p1 (+ ang (/ pi 2)) d1)
              p2o1 (polar p2 (- ang (/ pi 2)) d2)
              p2o2 (polar p2 (+ ang (/ pi 2)) d2)
              )
      (command ".line" p1o1 p1o2 p2o2 p2o1 "c")
      (princ)	
    )

  7. #7
    Certified AUGI Addict jaberwok's Avatar
    Join Date
    2000-12
    Location
    0,0,0 The Origin
    Posts
    8,570
    Login to Give a bone
    0

    Default Re: Draw a line starting from the midpoint of itself

    Quote Originally Posted by Neo_Richard_Blake View Post
    Well, 2 things. I don't have 2009, I have 2008. Sorry I should have specified. And I think you're refering to osnap tracking right? Well, that only works for specific points. Endpoint, midpoint, quadrant, etc.
    No, it works from any specified (including picked) point.
    Quote Originally Posted by Neo_Richard_Blake View Post
    Use the tracking and you can start a certain distance form that point right? Well, let's change the imagined situation a bit. Let's pretend we don't have a centerline drawn, but we want things to line up as though there were one. We drafters area lazy bunch, and we don't want to have to erase the line later.
    You're speaking for yourself. I'm quite happy to erase construction geometry.
    Quote Originally Posted by Neo_Richard_Blake View Post
    But we're going to draw a section view of a cone from centerpoint to centerpoint. Make sense? We know that we're going to end up with a trapazoid shape at the end. Let's say, one end of the cone has a 1" dia. flat, and the other end has a 2" dia flat. the total length is 8". I want the midpoint of the 1" to be at origin.
    Now, what I want to do is to be able to type LINE; 0,0; [midpoint]; (move my mouse in the desired direction); 1, and get a line that goes out (let's say) vertically, 1/2" from origin in each direction. Is it just me, or doesn't that sound easier than having to mess with osnap tracking, or FROM, or MOVE, etc.? Then, you can osnap track 8" from the midpoint of this line; click; [midpoint]; 2, and now you've got both ends of the trapazoid.
    Yes, it sounds easy but the tool doesn't exist. and now you would have two lines 1/2" long and 8" apart so you would need another pick to set the length of the second line. Rather like making a tapered polyline.
    And it wouldn't be a trapezoid. (edit: okay, it would be trapezoidal)
    Last edited by jaberwok; 2008-11-26 at 01:15 PM.

  8. #8
    I could stop if I wanted to Comach's Avatar
    Join Date
    2005-03
    Location
    Scotland
    Posts
    286
    Login to Give a bone
    0

    Default Re: Draw a line starting from the midpoint of itself

    Quote Originally Posted by Neo_Richard_Blake View Post

    Now, what I want to do is to be able to type LINE; 0,0; [midpoint]; (move my mouse in the desired direction); 1, and get a line that goes out (let's say) vertically, 1/2" from origin in each direction. Is it just me, or doesn't that sound easier than having to mess with osnap tracking, or FROM, or MOVE, etc.? Then, you can osnap track 8" from the midpoint of this line; click; [midpoint]; 2, and now you've got both ends of the trapazoid.
    I hope I undertsand what you are trying to do and may I suggest you simply draw a circle with the centre at the origin with a 1" diameter then draw a line from quadrant to quadrant.

  9. #9
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    6,416
    Login to Give a bone
    0

    Default Re: Draw a line starting from the midpoint of itself

    Sean, I've moved this thread to the acad General forum as the Tips and Tricks forum is not for asking for a tip, but sharing one.
    C:> ED WORKING....


    LinkedIn

  10. #10
    Certifiable AUGI Addict
    Join Date
    2015-11
    Location
    Jo'burg SA
    Posts
    4,512
    Login to Give a bone
    2

    Default Re: Draw a line starting from the midpoint of itself

    This should do exactly what you want:
    Code:
    ;;; Create line from its midpoint
    (defun c:LineM (/ pt1 pt2 pt0 ang len ed)
        (while (setq pt1 (getpoint "\nPick midpoint of line: "))
            (setq pt2 (getpoint pt1 "\nPick endpoint of line: "))
            (setq ang (angle pt2 pt1)) ;Calculate reverse angle
            (setq len (distance pt1 pt2)) ;Calculate half-length
            (setq pt0 (polar pt1 ang len)) ;Calculate other endpoint
            (setq ed (list '(0 . "LINE") (cons 10 pt0) (cons 11 pt2))) ;Create line's data
            (entmake ed) ;Make the line
        ) ;_ end of while
        (princ)
    ) ;_ end of defun

Page 1 of 3 123 LastLast

Similar Threads

  1. Replies: 13
    Last Post: 2014-07-01, 02:23 PM
  2. Replies: 2
    Last Post: 2012-07-13, 09:04 PM
  3. Replies: 2
    Last Post: 2007-04-04, 10:53 PM
  4. Flip parameter central to midpoint of a stretched line
    By mmccarter in forum Dynamic Blocks - Technical
    Replies: 4
    Last Post: 2006-01-12, 03:23 PM
  5. Linear stretch action, keep base point of the block at midpoint of a line
    By rustific41657 in forum Dynamic Blocks - Technical
    Replies: 1
    Last Post: 2005-12-16, 04:27 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •