[V8i C++] Locating elements using MStnElementSetTool

I'm attempting to "simplify" the element selection process for my tool. In my model I will have cells whose origin lie atop linear elements. I want to be able to determine the "intersection" of the cell's origin and the linear element, and have the result of the locate process return (hilite) the linear element and the intersection location. I know I can use "origin" snap, and find the cell's origin, then "reset" until the linear element is found, but it also seems that one should (I hope) be able to use a single datapoint to do all that (activate origin snap, and move cursor over any part of the cell, which "finds" the origin, and then datapoint to have the tool perform it's locate at the found origin, not the actual datapoint location, then cycle thru the elements at that origin until a linear element is found).

I've tried to test if AccuSnap is active in OnDataButton(), and if it is, get the current SnapPath, and SnapPoint, creating a new MstnButtonEvent and passing it to __super::OnDataButton():

	if ( mdlAccuSnap_isSnapped() )
	{
		SnapPathCP	snapPath=mdlAccuSnap_getCurrent();
		MstnButtonEvent		newEv=*ev;
		newEv.SetPoint( mdlSnapPath_getSnapPoint ( snapPath ) );
		bool	rc = __super::OnDataButton( &newEv );
		return rc;
	}

But that's just like picking the cell with a datapoint on some part of the cell. Using RESET doesn't cycle thru any elements.

Parents
  • The problem with this approach is that locate will only find overlapping elements within locate tolerance of the cursor location. Locate first identities the candidate elements, then we evaluate the snap location for the "best" candidate; we don't locate anything at the snap location. So in the image below, when locating this cell by the locate point shown, it's not going to find the red line that happens to have it's end point coincident with the cell origin. Make sense?

    HTH

    -B



Reply
  • The problem with this approach is that locate will only find overlapping elements within locate tolerance of the cursor location. Locate first identities the candidate elements, then we evaluate the snap location for the "best" candidate; we don't locate anything at the snap location. So in the image below, when locating this cell by the locate point shown, it's not going to find the red line that happens to have it's end point coincident with the cell origin. Make sense?

    HTH

    -B



Children