ObjectARX
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Forming a Crossing Polygon in DCS for passing to acedSSGet

7 REPLIES 7
SOLVED
Reply
Message 1 of 8
Anonymous
1212 Views, 7 Replies

Forming a Crossing Polygon in DCS for passing to acedSSGet

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

7 REPLIES 7
Message 2 of 8
owenwengerd
in reply to: Anonymous

The points should be in UCS coordinates.

--
Owen Wengerd
ManuSoft
Message 3 of 8
Anonymous
in reply to: owenwengerd

Thanks Owen. That fixed it.
Message 4 of 8
Anonymous
in reply to: Anonymous

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?

 

Message 5 of 8
Anonymous
in reply to: Anonymous

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?

Tags (4)
Message 6 of 8
owenwengerd
in reply to: Anonymous

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
Message 7 of 8
Anonymous
in reply to: owenwengerd

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.

Message 8 of 8
Kyudos
in reply to: Anonymous

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.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost