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

acedSetCurrentView crash

0 REPLIES 0
Reply
Message 1 of 1
cadproman
366 Views, 0 Replies

acedSetCurrentView crash

I'm getting an Unhandled Access Violation immediately after a call to acedSetCurrentView, but before a call to a user defined function, UNLESS I add use acutPrintf in between them. The user defined function is to get a filtered selectionset, but if I place the acutPrintf just inside the function at the top I still get the crash. Should I be calling some kind of update function after changing the view? Here is part of the code:

		AcDbViewTableRecord view;
		AcGePoint2d centerPt;

		view.setHeight(1.5 * max(abs(startPt.y - endPt.y), abs(startPt.x - endPt.x)));
		centerPt.x = (startPt.x + endPt.x) / 2;
		centerPt.y = (startPt.y + endPt.y) / 2;
		view.setCenterPoint(centerPt);

		acedSetCurrentView(&view, NULL);
		//acutPrintf(_T("\nfirst zoom complete at 204"));

		ads_name BeamTextSS;
		
		// if there is an error, no text was found.
		Adesk::Boolean TextFound = FALSE;
		//acutPrintf(_T("\nLine 224"));
		if(RTERROR != BeamTextSelSet(BeamTextSS, rbPointList))

 

 

and the called function:

//-----------------------------------------------------------------------------------//
// returns a selection set containing beam labeling text between the provided points
//-----------------------------------------------------------------------------------//
int BeamTextSelSet(ads_name BeamTextSS, resbuf *pointlist)
{
	// Build a filter that excludes all except the following:
	// 1. Object type = TEXT										DXF code 0
	// 2. Layer ends in "_BEAM_NOTES"								DXF code 8
	// 3. Text value matches "*-*x*-*"								DXF code 1

	int result = RTNORM;
	struct resbuf part1, part2, part3;
	struct resbuf *rbFilter = &part1;

	TCHAR _tcsbuf1[6], _tcsbuf2[18], _tcsbuf3[9];
	//acutPrintf(_T("\nSelectionSets.cpp Line 85"));
	part1.restype = 0;							// Filter type is entity name
	_tcscpy(_tcsbuf1, _T("TEXT"));				// Filter value
	part1.resval.rstring = _tcsbuf1;
	part1.rbnext = &part2;
	
	part2.restype = 8;							// Filter type is layer name
	_tcscpy(_tcsbuf2, _T("*_BEAM_NOTES"));		// Filter value
	part2.resval.rstring = _tcsbuf2;
	part2.rbnext = &part3;

	part3.restype = 1;							// Filter type is conditional operator
	_tcscpy(_tcsbuf3, _T("*-*x*-*"));			// Filter value
	part3.resval.rstring = _tcsbuf3;
	part3.rbnext = NULL;	
	

	//from http://forums.autodesk.com/t5/Autodesk-ObjectARX/acedSSGet-fence-mode-problem/m-p/3030342/highlight/...
	// all points must be visible in current view
	// look into using zoom and getGeomExtents
	//acutPrintf(_T("\nSelectionSets.cpp Line 105"));
	result = acedSSGet(_T("CP"), pointlist, NULL, rbFilter, BeamTextSS);
	acutRelRb(rbFilter);

	return result;
}

 I found a couple more posts about trouble with acedSelectionSet, but no answered ones. One left off asking if the coordinates were to large, so I have already tried converting the point values to integers, ending up with the same results.

 

Thanks,

Ralph

0 REPLIES 0

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

Post to forums  

Autodesk Design & Make Report

”Boost