Object ARX 根据点选择其内包含的要素

在AutoCAD二次开发的过程中,随时可能会遇到框选要素的情况.
为了将我入门时的学习过程记录下来,特此撰写.

	AcDbPolyline * pPline;
	struct resbuf* pointlist;
	pointlist = acutNewRb(RT3DPOINT);
	//ads_point pt;
	int numVerts = pPline->numVerts();//矩形的点顺序
	for (int i=0; i<numVerts; i++)
	{
		AcGePoint3d tempLineSeg3d;
		pPline->getPointAt(i,tempLineSeg3d);
		ads_point pt;
		pt[X] = tempLineSeg3d.x;
		pt[Y] = tempLineSeg3d.y;
		pt[Z] = tempLineSeg3d.z;
		if(0 == i){
			pointlist = acutBuildList(RT3DPOINT,pt,NULL);
		}else{
			pointlist= acutBuildList(RTRESBUF, pointlist,RT3DPOINT, pt, NULL);
		}
	}

	// 选择图框内的要素

	ads_name ss;
	acedSSGet(_T("WP"),pointlist,NULL,NULL,ss);

	long lSSLen=0;
	if(RTNORM != acedSSLength(ss, &lSSLen) || lSSLen<=0 )
	{
		// acutPrintf(_T("\n面积线层上没有任何实体!\n"));
		return FALSE;
	}


引用
转载请注明baOZe

你可能感兴趣的:(RTRESBUF,AcDbPolyline,RT3DPOINT,acutBuildList)