Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations IDS on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Draw a Perpendicular Line to the end of another line 2

Status
Not open for further replies.

GAEngr

Civil/Environmental
Oct 28, 2003
4
Dear all,

Could somebody please advise how to draw a perpendicular and have it snap to the end of another line? I can draw a perpendicular line with the "perp" (is there another way to draw a perpendicular line, icon, perhaps?) but it snaps to somewhere along the line and not at the end. Thanks.
 
Replies continue below

Recommended for you

I have arrayed the line 90 degrees about the end point
and this will you a perpendicular line.
 
You could set your snap angle to match the line, then draw orthogonaly from the endpoint, then reset your snap angle. A macro could easily be written and associated with a button. Here's a lisp program to do it. Save it as a text file with a .lsp extension, in AutoCAD load it and use the new command AE to run it.

(DEFUN C:AE (/ osm otm sa a) ; Set snap angle using endpoints
(setq osm (getvar "osmode")
otm (getvar "orthomode")
sa (getvar "snapangle")
)
(setvar "osmode" 1)
(setvar "orthomode" 1)
(setq a (getangle "\nSelect line ENDpoints to set new SNAP angle: "))
(setvar "snapang" a)
(command "line" pause pause "")
(setvar "osmode" osm)
(setvar "orthomode" otm)
(setvar "snapang" sa)
(PRINC)
)


 
The only problem with IFR's routine is that your variables aren't reset after you are done.

Flores
 
This resets the variables back:
Code:
(DEFUN C:AE (/ osm otm sa a)		; Set snap angle using endpoints
  (setq	osm (getvar "osmode")
	otm (getvar "orthomode")
	sa  (getvar "snapang")
  )
  (setvar "osmode" 1)
  (setvar "orthomode" 1)
  (setq a (getangle "\nSelect line ENDpoints to set new SNAP angle: "))
  (setvar "snapang" a)
  (command "line" pause pause "")
  (setvar "osmode" osm)
  (setvar "orthomode" otm)
  (setvar "snapang" sa)
  (PRINC)
)[\code]
Surprisingly, ACAD changed the variable "snapang" even though the original code was mispelled "snapangLE".  


Flores
 
Hi,

I use "_ucs"-> _object -> click the line -> "_line" -> snap the endpoint -> and draw the line (Don't forget "F8")

Lothar
 
Thanks, everyone for their wonderful suggestions. They were all very useful. Since I am not much of a "programmer" and not familiar with writing "routines" yet, the suggestion from Lothar using "UCS Object" was the most practical one for me. Have a great day!
 
I use OFFSET tru the point and the join by a line from to both ends.



Pardal
 
The @distance<direction is the easy way to do this type of task. The explanation to this is the @ sign starts the function then the length of line is next then< serves as the direction. example @4<30 give you a line 4&quot; long at 30 deg. your next line would be a length then <120 deg. giving you a perpendicluar line at the end of the first line, this can continue to complete your project.
 

Try this lisp:

; RITEANG.LSP
; ------------------------------------------------------------------------
; Description: create a line 90 degrees anywhere along an existing line.
; ------------------------------------------------------------------------
(prompt &quot;\nType RA2 to run.&quot;)(graphscr)(princ)
(defun C:RA2(/ P1 P2)
(setq OMODE(getvar &quot;ORTHOMODE&quot;))
(setq SANG (getvar &quot;SNAPANG&quot;))
(setvar &quot;OSMODE&quot; 512)
(setq P1 (getpoint &quot;\nPick a point on the existing line for the start of the new line.&quot;))
(setq P2 (getpoint &quot;\nPick a second point on the existing line.&quot;))
(prompt &quot;\nPick a point for the end of the new line.&quot;)
(setvar &quot;ORTHOMODE&quot; 1); ortho on
(setvar &quot;SNAPANG&quot; (+(angle P2 P1)(/ pi 2)) ); set snapang to angle of line
(command &quot;line&quot; P1 pause &quot;&quot;); draw the line
(setvar &quot;ORTHOMODE&quot; OMODE)
(setvar &quot;SNAPANG&quot; SANG)
(princ)
); End of Program
; ------------------------------------------------------------------------
 
GAEngr:
In Mechanical Desktop there is a simpler method: type AMCOPYRM, then pick the line in the snap point wanted, answer yes to copy prompt and enter 90 (degrees) or the angle you want.
Explore AMCOPYRM, is a great order.
If you does not have Mec desktop, there are Lisp programs that do the same the order does.
Try Google or write a request.
Excuse my english.
Xan.
 
Draw the line using &quot;perp&quot; osnap, this will draw the line perpendicular to the one you choose.

Then use move &quot;end&quot; point of new line at intersection to &quot;end&quot; point of original line.

Unless I am missing something?
 
Maybe a little easier is to try this.

Grip the line
Hot grip the endpoint of the line
Space
Space (For rotate)
C (for copy)
90 or -90
Esc
Esc (to get out of grip)
 
I use this simple routine in my lisp file:

(defun c:1 ()(command &quot;ucs&quot; &quot;ob&quot;))

It sets the '1' as a command for the ucs<object like Exxit's explanation.

It is quick and I use this command constantly having to deal with roof pitches (3:12, etc.) The end of the object you select that is closest, will become the origin and the x-axis will align down the part.

 
Or how about this:

Start drawing the line from the other end? i.e. Make sure you have a running OSNAP set to (at least) endpoint, and voila - no programming required.

I MUST be missing something, or it would not seem this trivial...
 
OK, I just realized what I was missing:[blush]

The lines are not necessarily oriented with the UCS.

IN that case, some of the above answers (not involving programming) would be my choice. Another option, is to temporarily re-orient the UCS and use F8 (ortho).

Oops...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor