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

trace a perpendicular line with lisp

  • Thread starter Thread starter Angelo2449
  • Start date Start date

Angelo2449

Guest
Hello.

I am trying to track a line perpendicular to a previously tracked using autolisp but, even after countless attempts I failed in the intent.

This should be code :
Code:
(command-s "_line" point1 point2")
(command-s "_line" pointo "-per" point1 point2")
the second instruction should draw a line from the point "point" perpendicular to the point1 point2 line but this does not happen.

Thank you.
 
Hello.

I am trying to track a line perpendicular to a previously tracked using autolisp but, even after countless attempts I failed in the intent.

This should be code :
Code:
(command-s "_line" point1 point2")
(command-s "_line" pointo "-per" point1 point2")
the second instruction should draw a line from the point "point" perpendicular to the point1 point2 line but this does not happen.

Thank you.
prova:

(command "_line" point1 point2")
(command "_line" p3 (osnap point2 "per") "")
 
It doesn't work.

It is impossible to apply the concept of perpendicularity using only one point (point2).

apart from the error contained in my post "-per" instead of "_per", the concept is that, the syntax is wrong, in fact it generates a mistake.

I tried to use "_last" instead of "point1 point2" but it doesn't work, I always think for wrong syntax.

Thank you.
 
...I try to trace a line perpendicular to a previously tracked using autolisp but, even after countless attempts I failed in the intent.
you have to calculate the point and then use it to create the line.
Code:
;; project point onto line  -  lee mac
;; projects pt onto the line defined by p1,p2

(defun lm:projectpointtoline ( pt p1 p2 / nm )
    (setq nm (mapcar '- p2 p1)
          p1 (trans p1 0 nm)
          pt (trans pt 0 nm)
    )
    (trans (list (car p1) (cadr p1) (caddr pt)) nm 0)
)
 
becomes much easier to temporarily activate via lisp a perpendicular osnap

(setq oldosmode (getvar "osmode")); preserves the current state of osnap
(setvar "osmode" 128); septa l'osnap a perpendicular

... routine line creation (poiche l'osnap is activated pointing in a x,y point becomes secondary to the osnap)
...
...

(setvar "osmode" oldosmode) ; it restores the original value of the osnap before the procedure.

In this way, without coordinate calculations, I managed to trace a tangent line to 2 circles one on the upper dial and one on the lower dial.
 

Forum statistics

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

Members online

No members online now.
Back
Top