• This forum is the machine-generated translation of www.cad3d.it/forum1 - the Italian design community. Several terms are not translated correctly.

draw a line from a point perpendicular to a line

  • Thread starter Thread starter Angelo2449
  • Start date Start date

Angelo2449

Guest
Hello everyone,
I am trying to track a line from a previously defined point (getpoint) to a previously tracked line.
The data are these:
starting point : pointemanation
line to which to trace the perpendicular : first pointgrondauno , second pointgrondauno or l (as entity)
I tried with:
Code:
(command "_line" pointemanation "_per" first pointgrondaone second pointgrondauno")
But nothing happens.
Thank you very much.
 
osnap in lisp don't work.
you have to calculate the perpendicular point by the absolute angle of the line to which it must be perpendicular(seq angle1 (the first pointgrondano second pointgrondauno))to which add 90°(setq theolo2 (+ theolo1 (/ pi 2))Now you have the perpendicular angle. if the point is on the left of the line the angle is right, if the point is on the right you have to add 180° (pi)this applies to units with positive right-hand rotation.
you create a p3 support
(setq p3 (polar pointemanation angle2 1.00))
and you search for the intersection point between the initial line and the support line(setq p_perp (inters first pointgrondaone second pointgrondaone pointemanation p3 nil))

il nil final in function inters allows you to have intersection even if the 2 lines materially do not intersect (consider the two lines as if they were xlines)

only at that point you can create your perpendicular line through the points you have obtained from the calculations(command "_line"
 
thanks crystal,
Great solution! I don't understand why it doesn't work with the osnap since the direct command works!
Boh!
 
another solution to the problem, suggested by confutatis a little time ago:

(setq nomeobj (vlax-ename->vla-object nproiez))
(setq ptp (vlax-curve-getclosestpointto nomeobj pt1))

where nproiez is the name of the line and pt1 the point from where the perpendicular line to nproiez should start.
vlax-curve-getclosestpointto calculates the minimum distance between object and point.
 

Forum statistics

Threads
44,997
Messages
339,767
Members
4
Latest member
ibt

Members online

No members online now.
ciao
Back
Top