Jump to content

project toward a line in a perpendicular angle


Recommended Posts

Posted

Hi

 

my problem is like this :

 

in some points in my script the lisp generate a line, than i ask the user to set a point in a specific location , the point than has to project toward the line in a perpendicular angle , and than perform break on the intersected point.

 

i have no clue how to do it or if its even possible

 

see attchment

 

Thanks in advance

Shay

prep.jpg

Posted

Please check the vlax-curve-getClosestPointTo function; the shortest distance from a point to a line is its projection on said line (the perpendicular).

Posted

(defun c:demo ()
 (command "_.line" "\\" "\\" "")
 (setq lin (entlast))
 (command "_point" "\\")
 (setq p (vlax-curve-getClosestPointTo lin (getvar 'lastpoint)))
 (command "_break"
   lin
   "_non"
   (setq p (vlax-curve-getClosestPointTo lin (getvar 'lastpoint)))
   "_non"
   p
 )
)

 

EDIT: Oops. Msasu beat me to it anyhoo try the demo code :)

Posted

thank you

what is "\\" ? (cant excute right now)

Posted

i think there is aproblem with `lastpoint

Posted

im using cad 2010

 

its "lastpoint" that works

 

Thanks again

Shay

Posted
thank you

what is "\\" ? (cant excute right now)

Replace it with pause and try again .

Posted
Replace it with pause and try again .

 

i see

thanx

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...