Author Topic: To calculate coordinates  (Read 1441 times)

0 Members and 1 Guest are viewing this topic.

velasquez

  • Newt
  • Posts: 176
To calculate coordinates
« 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.

gile

  • Water Moccasin
  • Posts: 2234
  • Marseille, France
Re: To calculate coordinates
« Reply #1 on: December 30, 2010, 07:03:23 AM »
Hi,

the vector from P2 to P1:
Code: [Select]
(mapcar '- P1 P2)
Speaking English as a French Frog

velasquez

  • Newt
  • Posts: 176
Re: To calculate coordinates
« Reply #2 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.