Draw line perpendicular to another

Is there a simple way to draw a line perpendicular to another that starts at one end of other line please?

I tried snapping to end of line and then 'L' and type in length and then right click and 'snap to perpendicular' but that creates a line bearing 90°.

My usual method is to copy/ paste the reference line to same place then just rotate 90° about its end or draw a line from somewhere and perpendicular to the reference line then move it.
Both work but was hoping for a simpler way.

Comments

  • Have you concidered OFFSET function?

  • Yes I had thanks, but that still involves extra steps that means I then have to delete the offset line.
  • command ucs entity to the first line , than click F8 ortho mode , and draw line 90°

  • Thanks for input and apologies for not getting about. Had a broken wire in computer so I reckon you can guess the rest!

    Thats a neat routine Roberto thanks. Playing with UCS is something I have avoided in past (from ignorance and fear of a big mess).

    But I couldn't get that LISP routine to work.
    It gave the following message.
    Unable to recognize command "PERPL". Please try again.
    I had already loaded it, and I tried other LISP routines and they worked well.
    So unsure what is the matter with the LISP but that's not an area I'm confident in so may have messed up the file.

    regards


  • Richard,

    The Autodesk site is notorious for formatting problems.  On my computer copying the code and pasting it into a text editor yields a first line of

        (defun c:smileytongue:ERPL ( / e en obj param p1 perpang flag)

    because the Autodesk site renders ':P' as an emoticon.  The first line should be

        (defun c:PERPL ( / e en obj param p1 perpang flag)


  • I just tested the c:perpl code again and found that it works in Autocad but not in Bricscad.  The c:perpl routine adds a 'less than' character to a string representing the angle perpendicular to the curve at the selected point, then passes that string to the line command.  The 'less than' should be a override indicating that the string is specifying an angle, but apparently Bricscad does not support this.

    Here is a routine that works in both Autocad and Bricscad.  I do not recall where I found it or who wrote it.  To use esnaps/osnaps with this function use a shift/right-click esnap/osnap selection.

    [code](defun c:perpl (/ from_object from_point first_derivative line_angle loop perp_line grread_result end_point str)
      (setvar "CMDECHO" 0)
      (setq old_osmode (getvar "osmode"))
      (if (and (setq from_object (entsel "\nSelect curve at point to start the perpendicular line."))
                                                                         ; select
               (setvar "osmode" 0)
               (setq from_point (cadr from_object))                      ; get the point part
               (setq from_object (car from_object))                      ; get the entity part
               (setq from_point (vlax-curve-getclosestpointto from_object from_point))
                                                                         ; adjust point to be on the entity
               (not (vl-catch-all-error-p
                      (setq first_derivative (vl-catch-all-apply
                                    'vlax-curve-getFirstDeriv
                                      (list from_object (vlax-curve-getParamAtPoint from_object from_point))
                                  )
                      )
                    )
               )                                                         ; get the first derivative
          )
        (progn
          (entmake (list '(0 . "LINE") (cons 10 from_point) (cons 11 from_point)))
                                                                         ; create initial line
          (setq perp_line  (entlast)                                     ; store the initial line
                line_angle  (angle '(0 0 0) first_derivative)            ; get the slope
                loop T                                                   ; loop
          )
    ;      (princ "\nSpecify line length: ")
          (while (and (setq grread_result (grread T 12 0))               ; control cursor, no error on ESC, normal crosshairs
                      (/= (car grread_result) 3)                         ; 3 = point selected
                      loop                                               ; loop is active
                 )
            (cond
              ((= (car grread_result) 5)                                 ; mouse action
                (setq end_point (polar from_point
                                (if (minusp (sin (- (angle from_point (cadr grread_result)) line_angle)))
                                  (- line_angle (/ pi 2))
                                  (+ line_angle (/ pi 2))
                                )
                                (distance from_point (cadr grread_result))
                         )
                )                                                        ; calculate end point
                (entmod (subst (cons 11 (trans end_point 1 0)) (assoc 11 (entget perp_line)) (entget perp_line)))
                                                                         ; modify the line
              )
            )
          )
        )
      )
      (setvar "osmode" old_osmode)
      (princ)
    )
    [/code]


  • Hi there you smart guys. I used a system longtime ago (anyone ever heard of DOGS) that catched angels if you hit a key hovering over an entity. This is actually very useful. Say I want to draw a line from a random spot perp (R) or parallel (P) to a line that is not even close I would pick the first point and then hover the entity hit R/P to get the angel and then select my last point. Maybe this could be done in Lisp taking angels from highlight objects. Im thinking hover over a line hit a key to store an angular value and then restor it in your activity.

    Cheers Patrik

  • The following macro automates Roberto Marafante's suggestion:
    ortho;on;ucs;e;\line;\\;ucs;;ortho;off
  • NICE ONE LOUIS ! works like a charm. Thanks
  • Returning to this little issue. Louis trick works but not if I´m in the middle of a polyline. Not a very unusual situation that vertex nr X should be perp to previous .

  • Patrik wrote :
    "Not a very unusual situation that vertex nr X should be perp to previous ."

    Have you tried  'Relative'  polar mode ( this is flag 1 of the Polarmode setting).
    Make sure Polar tracking is on ( this is flag 8 of the AutoSnap setting).

    The default Polar angle is set at 90 degrees, but if you modify the Polarang value to e.g. 45 or 30, it will allow you to draw edges at any multiple of this angle, relative to the previous edge.

    While we're at it, did anyone discover this new V14 snapping aid:
    whenever a snap tracking line is displayed, press and hold the Shift key to lock it, next, when snapping to some point of interest, this point will be projected perpendicularly onto the tracking line. May sound complex, but when trying it out you will discover it is simple and very useful...


  • AAAHH works nicely with polylines as ling as you are in the function. Hans I tried it out and I dont really see what you mean. All that happends to me is that you seem to lock ortho. What would be nice is if you could lock a normal snap by holding shift. In case you start drawing from a point pick "perp snap" hover over a random line untill you see your snap press shift and keep that snap then you would have a dynamic line that is locked to the snap you have choosen. /Patrik

  • @ Hans:
    Thanks for the tips.

    @ Patrick:
    You can try creating two toolbar buttons with these commands:

    1. To set the snapang.
    [code](progn (setvar 'orthomode 0) (setvar 'snapang (getangle "\nAngle: ")) (setvar 'orthomode 1) (princ))[/code]

    2. To reset the snapang.
    [code](progn (setvar 'snapang 0) (setvar 'orthomode 0) (princ))[/code]

    I have used Lisp because I could not get the first command to work in Diesel.
  • Patrik wrote:
    "AAAHH works nicely with polylines as long as you are in the function. Hans I tried it out and I dont really see what you mean. All that happends to me is that you seem to lock ortho"

    As long as no tracking line is displayed, pressing the Shift key will indeed temporarily lock Ortho mode.
    Please try this:
    Make sure that (at least) the 'Endpoint' and 'Extension' entity snap mode flags are On (flags 1 and 4096 of the OSMODE setting)
    Start e.g. the line command and hover over an endpoint of a polyline edge from which you want to start a perpendicular line, until the small red trackpoint marker appears. Now drag the cursor away from that point, following the direction of the edge, and a blue extension tracking line will appear, press Shift to lock it (it becomes red)
    Now pick (or snap to) the endpoint to which you want to draw the perpendicular line, and pick that point again to complete the line.
    The explanation sounds much more complicated than the actual actions are...

    Patrik wrote:
    "In case you start drawing from a point pick "perp snap" hover over a random line until you see your snap press shift and keep that snap then you would have a dynamic line that is locked to the snap you have chosen"

    If I understand what you describe correctly, I think this is actually implemented already for lines and circles, not for polylines or other.
    How to proceed:
    1 Start e.g. the line command and click the Perpendicular icon on the Entity Snaps toolbar (or type 'PER')
    2 Select the circle or line from which you want to get a dynamic perpendicular line
    3 Pick the endpoint of the line (or pline edge)

    Supporting this deferred perpendicular snap for polylines or other entities probably would not be that hard. Would it make a big difference to have it available? For most situations I would think the available tools are sufficient, but perhaps I am overlooking or underestimating?

  • Roy fantastic close enough. THX

    Hans & Roy the thing with shiftlock is that ALL snaps would work.

  • Hans you managed to anwer when I was writing. Im thinking a snap lock to any snap would be a great feature. Lets say you draw a line from a random point and want it to point towards the tangent of a circle but not touch (or another snappable point). Choose the snap, hover over the snappoint and shift to lock . Perfect

  • Nothing critical at all.
  • You wrote :"Lets say you draw a line from a random point and want it to point towards the tangent of a circle but not touch (or another snappable point). Choose the snap, hover over the snappoint and shift to lock . Perfect "

    The example you give here, happens to be perfectly supported already:
    make sure that the tangent entity snap mode is active
    draw a line from a random point and hover over the tangent of a circle till the trackpoint marker appears
    move the cursor slightly back towards the start point of the line and a tracking line will appear, press Shift to lock, Bob's your uncle...

    BUT then came disappointment when I tried this with other types of snap points: the available tracking directions are limited according to the polar tracking settings,
    the direction towards the start point is not offered as a tracking line.
    We'll investigate if there is a valid reason not to do so, and if not... hahaa!

    "Nothing critical", but very interesting discussion to stir creative thinking, thanks, it's a pleasure!

  • I've really been waiting for this feature, and I expected it to be implemented exactly the way Patrick described - simply creating a locked tracking vector between LASTPOINT and a snap marker on pressing SHIFT.
    What Hans described ("move the cursor slightly back towards the start point of the line") is definitely not what I would look forward to - this would be as fiddly as inferring points is right now, which made me hardly use this feature so far, sticking to custom menu entries with point filters instead.
    Additional preferences of mine would be to always lock to the UCS axes (ignoring snap markers) in ORTHOMODE, and using SHIFT as a toggle rather than as a modifier (so keeping my left hand free to type in esnap overrides), but that's of minor concern.
    Am I right that SHIFT-locking has not yet been implemented in the current linux beta?
  • Not sure I am understanding what you want..  Maybe I am looking at this problem too simply?  Or you're looking for a LISP program? 

    When I want to create a line perpendicular to the end of another line, I click on the end of the line, and type "@distance"  Where "distance" is the length of the new segment, and "angle" is 90 or -90 depending on the  direction (CW or CCW) you selected in settings-drafting-drawing units-angular units.

    If you want to use the Polyline tool, you can create the entire border of your object with a succession of "@distance" commands.  Of course the angle doesn't have to be 90 degrees, either. And you can close the polyline by typing "C".
  • One of my characters did not appear in my post.  It is the  left pointing arrow (LPA) which is found on the comma key.   So the command is:

    @distanceLPAangle
This discussion has been closed.