TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: velasquez on December 30, 2010, 06:50:42 AM

Title: To calculate coordinates
Post by: velasquez on December 30, 2010, 06:50:42 AM
I get two points with different functions: 
P1 -> (143.219 209.053 0.0) 
P2 -> (167.335 163.947 0.0) 
The difference between P1 and P2 is my reference. 
I seek the best form to place this difference in P2. 
Does anybody can me to help?

Thanks.
Title: Re: To calculate coordinates
Post by: gile on December 30, 2010, 07:03:23 AM
Hi,

the vector from P2 to P1:
Code: [Select]
(mapcar '- P1 P2)
Title: Re: To calculate coordinates
Post by: velasquez on December 30, 2010, 08:32:20 AM
Thank you gile, 
See as this working. 
1 -   (setq P1 (cadr (grread 5))) -> (246.28 106.895 0.0) 
2 -   (setq P2 (dcl_GetDwgMouseCoords)) -> (269.159 61.7892 0.0) 
3-   (setq Pnew (mapcar '+ pt2 (mapcar '- pt1 pt2))) -> (246.28 106.895 0.0)

dcl_GetDwgMouseCoords -> Function of OpenDCL
With this I only need the function Grread to create a reference coordinate.
I am trying to create a function of I drag for an object.