Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

need Lisp - Surface Angle with 4 points

24 REPLIES 24
Reply
Message 1 of 25
gringooo
1558 Views, 24 Replies

need Lisp - Surface Angle with 4 points

Hello all,

 

i am new here and hope for some help...

 

I need very very often to know the angle between two surfaces to write cnc programms...

At the moment i draw allways two lines normal to the line between the two surfaces an use then the angle measuring tool.

Works good, faster then bks and dimensioning, but need also time and allways need to delete the lines after...

 

Is it possible to get a lisp which ask für 1 point on the first surface, 1 point on the other surface and two points on the line between the 2 surfaces? So the lisp know 3 points of each surface and can give out the angle between... Should be allways between 0-180°

So it needs only 4 klicks to get a angle! That would be so great! Smiley Surprised

 

Is there a lisp programmer who can make this possible?

 

Many Thanks!

 

Ingo

 

Tags (1)
24 REPLIES 24
Message 21 of 25
Lee_Mac
in reply to: gringooo


@gringooo wrote:

is it possible to get the answer automaticly into the clipboard?


Try this:

 

(defun c:test ( / a1 a2 an nv p1 p2 x1 x2 x3 )
    (if
        (and
            (setq a1 (getpoint "Select 1st point of intersection line:"))
            (setq a2 (getpoint "Select 2nd point of intersection line:" a1))
            (setq p1 (getpoint "\nSelect point on 1st plane: " a1))
            (setq p2 (getpoint "\nSelect point on 2nd plane: " a1))
        )
        (progn
            (setq nv (mapcar '- a2 a1)
                  x1 (angle '(0.0 0.0) (trans (mapcar '- p1 a1) 0 nv))
                  x2 (angle '(0.0 0.0) (trans (mapcar '- p2 a1) 0 nv))
                  x3 (rem (+ pi pi (- x2 x1)) (+ pi pi))
                  an (angtos (min (- (+ pi pi) x3) x3) 0 2)
            )
            (LM:copytoclipboard an)
            (princ (strcat "\nAngle: " an))
        )
    )
    (princ)
)

;; Copy to Clipboard  -  Lee Mac
;; Using the same method as MP demonstrates here: http://bit.ly/170kacW

(defun LM:copytoclipboard ( str / clp htm par )
    (if (setq htm (vlax-create-object "htmlfile"))
        (progn
            (vl-catch-all-apply
               '(lambda ( )
                    (setq par (vlax-get htm 'parentwindow)
                          clp (vlax-get par 'clipboarddata)
                    )
                    (vlax-invoke clp 'setdata "Text" str)
                )
            )
            (foreach obj (list clp par htm)
                (if (= 'vla-object (type obj))
                    (vlax-release-object obj)
                )
            )
            str
        )
    )
)

(vl-load-com) (princ)
Message 22 of 25
gringooo
in reply to: Lee_Mac

unbelievable! Smiley Happy

 

many thanks for this quick usefull support! i wish i could spend you some beer!

maybe there is a paypal donate account to support your great work?

 

thx!

 

 

Message 23 of 25
Lee_Mac
in reply to: gringooo


@gringooo wrote:

unbelievable! Smiley Happy

 

many thanks for this quick usefull support! i wish i could spend you some beer!

maybe there is a paypal donate account to support your great work?


You're entirely welcome!

 

Thank you for your generous offer of a donation, but I couldn't possibly accept a donation for what is mostly phanaem's work. Smiley Wink

 

Lee

Message 24 of 25
gringooo
in reply to: Lee_Mac

you should create here a public donate account for all programmer and make a party once a year Smiley Happy

 

anyway, thx to phanaem and lee for your amazing quick support!

Message 25 of 25
gringooo
in reply to: gringooo

here again... Smiley Happy

 

is it possible to get also a lisp witch put me out, with same system as above (0-180° allways between), the angle betwen 2 lines and put the output also into the clipboard?

 

similar as the _MEASUREGEOM/ANGLE but allways between the lines where i mark these and 0-180° and commandline and clipboard output?

 

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost