Coordinates of Selection Window

Coordinates of Selection Window

EMD1954
Advocate Advocate
1,014 Views
7 Replies
Message 1 of 8

Coordinates of Selection Window

EMD1954
Advocate
Advocate

Hopefully a simple (not stupid) question.  When selecting objects with acedSSGet, or for that matter, any selection window, how can i get the coordinates of the corners (or vertices if it's a polyline)?

 

Thanks,

Ed

0 Likes
1,015 Views
7 Replies
Replies (7)
Message 2 of 8

owenwengerd
Advisor
Advisor

Take a look at acedSSNameX().

--
Owen Wengerd
ManuSoft
0 Likes
Message 3 of 8

EMD1954
Advocate
Advocate

Thank you.

0 Likes
Message 4 of 8

EMD1954
Advocate
Advocate

Owen,

 

Sorry, I need a litle more help.  I have a line that goes from 0,0,0 to 240,0,0.  I'm selecting the line with acedSSGet(_T("X"), NULL, NULL, rb, sel_set)and manually typing in the coordinates of a crossing window of 12,12,0 and -12,-12,0.  I then print out the 4 points returned by

acedSSNameX(&rb2, sel_set, -1) and the stretchPoints of the line.  Here's what I get (I'm in the WCS):

 

4 Points Returned as RT3DPOINT from the resbuf:

-12.09837853 12.09830217 13464.12157445
12.09837810 12.09830217 13464.12157445
12.09837810 -12.09830240 13464.12157445
-12.09837853 -12.09830240 13464.12157445


Stretch Point 0 = 0.0000 0.0000 0.0000
Stretch Point 1 = 240.0000 0.0000 0.0000

 

Any thoughts?

 

0 Likes
Message 5 of 8

owenwengerd
Advisor
Advisor

What do you need help with?

--
Owen Wengerd
ManuSoft
0 Likes
Message 6 of 8

EMD1954
Advocate
Advocate

If I input the coordinates on the command line as 12, 12, 0 and -12, -12, 0, what do the 4 resulting points represent?  From where does the 13464.12157445 for the Z coordinate come from?  I've been assuming that these are the 4 corners of the selection (crossing) window.  Maybe I'm not understanding "point on vertex "line" (in WCS)"?

 

-12.09837853 12.09830217 13464.12157445
12.09837810 12.09830217 13464.12157445
12.09837810 -12.09830240 13464.12157445
-12.09837853 -12.09830240 13464.12157445

 

And how do I use them to see that one endpoint of the line (Stretch Point 0 = 0.0000 0.0000 0.0000) is within the selection window?

 

Also, don't understand the second set of numbers I get (when not in the WCS) "vector describing direction of vertex "line" or direction & distance to other end of line segment (only present if viewpoint is not plan WCS)".  What is a vertex line?

 

Thanks,

Ed

0 Likes
Message 7 of 8

owenwengerd
Advisor
Advisor

Did you perhaps miss the paragraph entitled "Pick Point Selection"? In a normal view, your selection window represents an infinitely deep and infinitely tall box parallel to your viewing direction. The vectors define the view direction at each point.

 

The returned points describe one point on each of the 4 view-parallel edges of that imaginary box. To determine whether a point falls inside that box, you would calculate a plane which is perpendicular to the view direction at the line endpoint, and includes the endpoint. You would then project the 4 selection rectangle points onto that plane using the associated view-direction vectors for the projection. In a normal view this projection results in a rectangle that lies in the same plane as the line endpoint, but it's conceivable that some types of view projections could result in the projected curve being a trapezoid. In any case, the problem is now reduced to a 2D problem, and you can then use any "is-point-inside-closed-2D-curve" algorithm to determine whether the line endpoint falls inside the projected curve.

 

I hope that helps.

 

--
Owen Wengerd
ManuSoft
0 Likes
Message 8 of 8

EMD1954
Advocate
Advocate

Absolutely, and very clearly.

 

Much appreciated,

Ed

0 Likes