Forming a Crossing Polygon in DCS for passing to acedSSGet

Forming a Crossing Polygon in DCS for passing to acedSSGet

Anonymous
Not applicable
2,265 Views
7 Replies
Message 1 of 8

Forming a Crossing Polygon in DCS for passing to acedSSGet

Anonymous
Not applicable

Hello,

 

I am new to ARX. I appreciate any help in advance.

 

My task at hand is to create a command that will take two points, select a few things in the vicinity of line of these two points and process the selected things. To do this, I am doing the following

1. Take two points from the user, which are in WCS.

2. Convert the two points using acedTrans from WCS to DCS

3. Add a small displacement to these points to get corners of the polygon I want to form.

4. Pass these points to acedSSGet.

 

The acedSSGet returns -5001, which I think is "other error".

 

What I don't understand is

1. If the points are in DCS, I expect them to be on XY plane (have same Z values). But that is not the case. The points are allover. Not even on XZ or YZ plane. If that's the case, what is the meaning of DCS? What CS the acedSSGet expect?

 

Code is as follows

--------------------------

	ads_point startpt_wcs, endpt_wcs, startpt_dcs, endpt_dcs;
	// AT THIS POINT, I ALRADY HAVE STARTPOINT AND ENDPOINT INPUT BY THE USER
	CGeomEntities::GetAdsPointFromAcgePoint(StartPoint, startpt_wcs); 
	CGeomEntities::GetAdsPointFromAcgePoint(EndPoint, endpt_wcs);

	// Convert to DCS
	resbuf *rb_wcs = acutBuildList(RTSHORT, 0, RTNONE);
	resbuf *rb_dcs = acutBuildList(RTSHORT, 2, RTNONE);

	if (RTNORM != acedTrans(startpt_wcs, rb_wcs, rb_dcs, 0, startpt_dcs))
		return false;
	if (RTNORM != acedTrans(endpt_wcs, rb_wcs, rb_dcs, 0, endpt_dcs))
		return false;

	// Adjust points to form a crossing window
	ads_point top_left_dcs, bottom_right_dcs;
	double deltaX = dFuzz* 0.7071;
	if ( startpt_dcs[X] > endpt_dcs[X])
		deltaX *= -1;
	double deltaY = dFuzz* 0.7071;
	if ( startpt_dcs[Y] > endpt_dcs[Y]  )
		deltaY *= -1;

	top_left_dcs[X] = startpt_dcs[X] - deltaX;
	top_left_dcs[Y] = startpt_dcs[Y] + deltaY;
	top_left_dcs[Z] = startpt_dcs[Z];

	bottom_right_dcs[X] = endpt_dcs[X] + deltaX;
	bottom_right_dcs[Y] = endpt_dcs[Y] - deltaY;
	bottom_right_dcs[Z] = endpt_dcs[Z];

	// Use crossing window for selection
	int ret = acedSSGet( _T("C"), top_left_dcs, bottom_right_dcs, NULL, crossingcheckpipes);

	// AT THIS POINT RET = -5001?? WHY? WHAT AM I MISSING?
	acutRelRb(rb_dcs);
	acutRelRb(rb_wcs);

	if (ret != RTNORM)
		return false; 

	return true;

 Thanks in advance,

 

K

0 Likes
Accepted solutions (1)
2,266 Views
7 Replies
Replies (7)
Message 2 of 8

owenwengerd
Advisor
Advisor
Accepted solution

The points should be in UCS coordinates.

--
Owen Wengerd
ManuSoft
Message 3 of 8

Anonymous
Not applicable
Thanks Owen. That fixed it.
0 Likes
Message 4 of 8

Anonymous
Not applicable

But just for my conceptutal understanding,

What is DCS if it's not the co-ordinates you see on screen? Is it not everything projected on one plane?

 

0 Likes
Message 5 of 8

Anonymous
Not applicable

Update. Changing to UCS does not fully fix the issue.

I changed the transformation in the above code from "from WCS to DCS" to "from WCS to UCS".

I tried it on a model. It worked.

Then I rotated the model and tried. It didn't work. It does not find a particular line which it finds before rotating.

 

Is there anything else I need to do to make it work in every case?

0 Likes
Message 6 of 8

owenwengerd
Advisor
Advisor

Your points (and the entities you're selecting) need to be visible on the screen. In addition, you may be calculating the coordinates of your points incorrectly. The points are expressed in UCS, but their position in space will be view dependent, so your algorithm for calculating the coordinates of your points must consider the DCS in arriving at the final coordinates.

--
Owen Wengerd
ManuSoft
0 Likes
Message 7 of 8

Anonymous
Not applicable

Thanks Owen.

 

Right now this is what I am doing.

1. Convert the WCS points to UCS.

2. Form a crossing polygon. Using the points I create AcgeVector3d. Then I get it's ortho vector and use that to form a rectangle.

3. I pass this crossing polygon in acedSSGet.

 

That seems to be working for now in all of my test cases. I am not using the DCS coordinates right now. But I will come back to this if I come across a selection failure in future.

 

Thanks again for your help.

0 Likes
Message 8 of 8

Kyudos
Advisor
Advisor

Sorry to resurrect this ancient post, but I'm having exactly this problem and I don't understand the solution. I am selecting entities that via a crossing line. I start with zooming to my area of interest to make sure the correct things are visible, I have two WCS points, convert them to UCS using acedTrans, and the use acedSSGet("C"... but some expected items aren't selected when my view is rotated.

 

This works OK un-rotated, so I suspect I need to allow for the DCS somewhere but I don't know how to incorporate it.

0 Likes