| Author |
Message |
SS
Guest
|
Posted:
Wed Nov 30, 2005 9:10 pm Post subject:
How to get the coordinates of a line/ edge of rectangle |
|
|
Hi,
I would like to know how to get the coordinates of an edge of a
rectangle that is selected(which is a line).
I can get the coordinates of the BBox. But this wont help me since
I need to know which side of the BBox is selected .
can anyone help me out.
thanks,
Sriram
|
|
| Back to top |
|
 |
Andrew Beckett
Guest
|
Posted:
Thu Dec 01, 2005 5:10 pm Post subject:
Re: How to get the coordinates of a line/ edge of rectangle |
|
|
On 30 Nov 2005 09:50:16 -0800, "SS" <ssriramiyer@gmail.com> wrote:
| Quote: | Hi,
I would like to know how to get the coordinates of an edge of a
rectangle that is selected(which is a line).
I can get the coordinates of the BBox. But this wont help me since
I need to know which side of the BBox is selected .
can anyone help me out.
thanks,
Sriram
|
geGetSelSetFigPoint() is the function you want. This will tell you which points
on an object are selected.
Andrew. |
|
| Back to top |
|
 |
Suresh Jeevanandam
Guest
|
Posted:
Thu Dec 01, 2005 5:10 pm Post subject:
Re: How to get the coordinates of a line/ edge of rectangle |
|
|
Andrew Beckett wrote:
| Quote: | On 30 Nov 2005 09:50:16 -0800, "SS" <ssriramiyer@gmail.com> wrote:
Hi,
I would like to know how to get the coordinates of an edge of a
rectangle that is selected(which is a line).
I can get the coordinates of the BBox. But this wont help me since
I need to know which side of the BBox is selected .
can anyone help me out.
thanks,
Sriram
geGetSelSetFigPoint() is the function you want. This will tell you which points
on an object are selected.
Andrew.
|
Andrew,
obj = car(geGetSelSet())
mapcar('and geGetSelSetFigPoint(obj) obj->points)
=> *Error* eval: not a function - 57.0
However, the following code works,
mapcar(lambda((a b) and(a b)) geGetSelSetFigPoint(obj) obj->points)
=> ((57.0 1587.6) (57.0 1062.45) nil nil nil nil nil nil)
Whats the difference between the two?
regards,
Suresh
|
|
| Back to top |
|
 |
Andrew Beckett
Guest
|
Posted:
Thu Dec 01, 2005 9:10 pm Post subject:
Re: How to get the coordinates of a line/ edge of rectangle |
|
|
On Thu, 01 Dec 2005 19:24:09 +0530, Suresh Jeevanandam
<sureshj@DELETETHISti.com> wrote:
| Quote: | Andrew Beckett wrote:
On 30 Nov 2005 09:50:16 -0800, "SS" <ssriramiyer@gmail.com> wrote:
Hi,
I would like to know how to get the coordinates of an edge of a
rectangle that is selected(which is a line).
I can get the coordinates of the BBox. But this wont help me since
I need to know which side of the BBox is selected .
can anyone help me out.
thanks,
Sriram
geGetSelSetFigPoint() is the function you want. This will tell you which points
on an object are selected.
Andrew.
Andrew,
obj = car(geGetSelSet())
mapcar('and geGetSelSetFigPoint(obj) obj->points)
=> *Error* eval: not a function - 57.0
However, the following code works,
mapcar(lambda((a b) and(a b)) geGetSelSetFigPoint(obj) obj->points)
=> ((57.0 1587.6) (57.0 1062.45) nil nil nil nil nil nil)
Whats the difference between the two?
regards,
Suresh
|
The issue is that and() is a syntax form, which selectively evaluates its
arguments depending on the value of the previous argument. In fact that's one of
the real benefits of and()!
What is happening here is that mapcar is collecting a value from each of
the lists, that is being processed and applying that (or doing a funcall) to the
specified function name. Now this is OK if it's an ordinary (lambda) function,
because it's going to just treat them as values - but if a syntax form is called
(like and), the syntax form may decide to evaluate its arguments.
The same error occurs if you do:
funcal('and t car(obj~>points))
what's happening is it is seeing this as:
and(t (57.0 1587.6))
Wrapping the and in a lambda turns the syntax form into an ordinary function,
and it all behaves as you'd expect then.
Andrew. |
|
| Back to top |
|
 |
SS
Guest
|
Posted:
Thu Dec 01, 2005 9:10 pm Post subject:
Re: How to get the coordinates of a line/ edge of rectangle |
|
|
Andrew and Suresh,
Thanks |
|
| Back to top |
|
 |
|
|
|
|