Draw a line from its midpoint

Draw a line from its midpoint

Anonymous
Not applicable
9,825 Views
13 Replies
Message 1 of 14

Draw a line from its midpoint

Anonymous
Not applicable

Hi, this is kind of hard to explain, but is there a way to draw a line starting at its midpoint? Like if I want to draw a 10 inch line i pick a point and it extends out in both directions 5 inches. Kind of like how you draw a circle. Sorry if this is a stupid question, or if it is super simple or easy to do.

 

Thanks for taking the time to read this, and any help is greatly appreciated.

Accepted solutions (1)
9,826 Views
13 Replies
Replies (13)
Message 2 of 14

Alfred.NESWADBA
Consultant
Consultant

Hi,

 

you might use a block as replacement for a line. The block can contain a line from -1,0 to +1,0 ... when you then insert the block you can show rotation and scalefactor and the result would be a (visual) line which has it's midpoint where you showed the insertion point of the block.

 

I would not know a function that can do that in AutoCAD.

Alterative could be to use commands _LENGTHEN or _SCALE, but then the line has already to exist.

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2025
------------------------------------------------------------------------------------

(not an Autodesk consultant)
0 Likes
Message 3 of 14

dbroad
Mentor
Mentor

Use an xline and trim.

Architect, Registered NC, VA, SC, & GA.
0 Likes
Message 4 of 14

john.vellek
Alumni
Alumni

Hi @Anonymous,

 

There is no in-the-box way to do this.  You could construct a dynamic block that inserts at the middle and then allows you to stretch the line. Or, perhaps a visit to the customization forum will get you a lisp routine that does this for you.

 

 

Please select the Accept as Solution button if my post solves your issue or answers your question.


John Vellek


Join the Autodesk Customer Council - Interact with developers, provide feedback on current and future software releases, and beta test the latest software!

Autodesk Knowledge Network | Autodesk Account | Product Feedback
Message 5 of 14

Kent1Cooper
Consultant
Consultant

If you don't mind not seeing both ends stretch, but you're open to drawing half of it and then having it "finished" to full length [in simplest terms]:

 

(defun C:LineMid ()
  (command
    "_.LINE" pause pause ""
    "_.scale" "_last" "" "@" 2
  ); command
  (princ)
)

Prompts could be added where those pauses are, to make it clear what you're going to get.

 

To see it "drag" at both ends as you draw it, a routine using (grread) and (grdraw) shouldn't be hard to work out.

Kent Cooper, AIA
Message 6 of 14

Kent1Cooper
Consultant
Consultant

@Kent1Cooper wrote:

.... 

To see it "drag" at both ends as you draw it, a routine using (grread) and (grdraw) shouldn't be hard to work out.


 

Such as this quickie:

;;  LineMidPoint.lsp [command name: LMP]
;;  To draw a Line starting from its midpoint, rather than from end
;;    to end as in AutoCAD's LINE command.
;;  Drags shape of resulting Line as cursor is moved.
;;  Kent Cooper, 4 January 2019
(defun C:LMP ; = Line from MidPoint
  (/ mid cur cor1 cor3 delta bulge cor2 cor4 prelist vertices rect)
  (setq mid (getpoint "\nMidpoint of Line: "))
  (prompt "\nOne end of Line: ")
  (while
    (and mid (setq cur (grread T 12 0)))
    (cond
      ((= (car cur) 5); moved cursor - draw vector
        (grdraw
          (cadr cur)
          (polar mid (angle (cadr cur) mid) (distance (cadr cur) mid))
          -1 1 ; contrast color to background, highlight
        ); grdraw
      ); moved-cursor condition
      ((= (car cur) 3); picked point - draw Line, end (while) loop
        (entmake
          (list
            '(0 . "LINE")
            (cons 10 (cadr cur))
            (cons 11 (polar mid (angle (cadr cur) mid) (distance (cadr cur) mid)))
          ); list
        ); entmake
        (setq mid nil); end (while) loop
      ); picked-point condition
    ); cond - grread possibilities
  ); while
  (princ)
); defun - LMP
(prompt "\nType LMP to draw a Line starting at its MidPoint.")

Unfortunately, it doesn't honor Osnap for picking the one endpoint [though it does for the midpoint].

 

Kent Cooper, AIA
Message 7 of 14

CRGDesign
Community Visitor
Community Visitor

Another very basic tool every other CAD software has that AUTOCAD doesnt...

Message 8 of 14

ryanYF2FK
Participant
Participant

I was getting graphical glitches when I tried Kent Cooper's. It may be an issue of what versions we're using.

 

Anyway, I made up my own. Activate with "LMID".

 

Update: I started getting odd errors, and found that there are several situations that break what I made. I'm pulling this down until I can figure out the issue.

0 Likes
Message 9 of 14

Kent1Cooper
Consultant
Consultant

@ryanYF2FK wrote:

I was getting graphical glitches when I tried Kent Cooper's. ....


[Which one?  What kinds of issues?]

Kent Cooper, AIA
0 Likes
Message 10 of 14

ryanYF2FK
Participant
Participant

With LMP, I was getting ghosted images like in this photo. 

ryanYF2FK_0-1739473911382.png

 

The first one you shared (LineMid) seems to work great! I completely missed it when I was reading through the comments originally. Now if I fix mine, it'll only be for the practice haha

0 Likes
Message 11 of 14

pendean
Community Legend
Community Legend

@ryanYF2FK wrote:

With LMP, I was getting ghosted images like in this photo. 


I bet a REGEN or REGENALL command fixes that, doesn't it.

 

Your video card choked, nothing more: share with us screenshots of your AutoCAD's ABOUT and GRAPHICSCONFIG command pop-ups please.

0 Likes
Message 12 of 14

ryanYF2FK
Participant
Participant

I tried both regeneration commands and it didn't fix it. But I still admit it's probably my graphic's card - it's on my work computer, and I've had problems with it ever since they bought it.

 Screenshot 2025-02-13 163917.png

Screenshot 2025-02-13 164924.png

Should I make this into a separate post somewhere? Not trying to spam everyone.

0 Likes
Message 13 of 14

cadffm
Consultant
Consultant
Accepted solution

Hi,
regardless of the problem here:

You have installed "less important" updates for Architecture, but not a single update for AutoCAD?

AutoCAD Productversion, current is 2025.1.1

 

[F1] https://help.autodesk.com/view/ARCHDESK/2025/ENU/?guid=AUTOCAD_2025_UPDATES

Sebastian

0 Likes
Message 14 of 14

ryanYF2FK
Participant
Participant

Good catch, thanks. I've got that fixed now.

0 Likes