AutoLISP: Perpendicular to Entity

Here’s a handy routine that lets you draw many perpendicular lines to any type of object. This can be done manually by using the perpendicular Osnap, but this routine lets you do this quickly.

Very handy for curved objects. As seen in the picture below, I used Splines, Polylines and an arc. One draw back is that the LISP routine looks for the closest part of the selected object.

Here’s how:

  • PERP2ENT <enter> to start
  • Select the object that you want the lines to be drawn to
  • Pick points where you want the line drawn from

;; by sinc @ the Swamp 07/22/2004
;; Repeatedly draws a line from a pick point perpendicular
;; to a selected object
(defun c:perp2ent (/ entity pt)
(while (setq entity (car (entsel "\nSelect entity: ")))
(setq pt (getpoint "\nSelect point to draw perpendicular from: "))
(entmake (list '(0 . "LINE") (cons 10 (trans pt 1 0))
(cons 11 (vlax-curve-getClosestPointTo entity (trans pt 1 0)))) ;_ list
) ;_ entmake
) ;_ while
) ;_ while
) ;_ defun

About AutoCAD Tips

This blog serves as a knowledge base for myself (and anyone else) so that I can reference tips & tricks that I have learned and also refer others to it as well. I hope that this blog helps you learn at least one tip to make your drafting/design experience better.
This entry was posted in AutoLISP, Polylines, TIPS. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s