The Global ARCHICAD Community

Stay informed. Get help. Share your knowledge.

Discussions about using GRAPHISOFT's tools (API DevKit) for independent software developers

Moderators: Barry Kelly, Karl Ottenstein, LaszloNagy, ejrolon, gkmethy, Tibor Lorántfy, MOREH Tamas, Akos Somorjai, Ed Brown, Mihály Palenik

#282310
Hello! I get a zone Polygon2DData,when I test the ChamferPolygon2DDataContour and ChamferPolygon2DDataVertex with chamfered the zone polygon,the return err=NoError,But the resulting polygon is always zero count,Has anyone used these functions? :) :) :) :) :) :)

Test code below this:

Code: Select all
static GSErrCode	ChamferPolygonWithRadius(Geometry::Polygon2DData& polygon2DData, vector<double> dRadius)
{
	GSErrCode err = NoError;

	////1.ChamferPolygon2DDataContour test
	//GS::VAArray<Geometry::Polygon2DData> chamPolys;
	//err = ChamferPolygon2DDataContour(polygon2DData, 1, 1.5, &chamPolys);
	//WriteReport_Alert("count is%d", chamPolys.GetItemCount());
	//WriteReport_Alert("err=%d", err);
	//if (err == NoError && chamPolys.GetItemCount() == 1)
	//	Geometry::CopyPolygon2DData(&polygon2DData, chamPolys[1]);

	//for (UIndex iResPoly = 1; iResPoly <= chamPolys.GetItemCount(); iResPoly++)
	//	Geometry::FreePolygon2DData(&chamPolys[iResPoly]);


	//2.ChamferPolygon2DDataVertex test
	Int32 minIndex = std::min(Int32(dRadius.size()), Int32(polygon2DData.nVertices));
	WriteReport_Alert("maxindex%d", minIndex);
	Int32 nvIndex = 0;
	for (Int32 i = 0; i < minIndex; i++)
	{
		if (IS_ZERO(dRadius[i]))
			continue;
		GS::VAArray<Geometry::Polygon2DData> chamPolys;
		err = ChamferPolygon2DDataVertex(polygon2DData, i+1, dRadius[i], &chamPolys);
		WriteReport_Alert("count is%d", chamPolys.GetItemCount());
		WriteReport_Alert("err=%d", err);
		if (err == NoError && chamPolys.GetItemCount() == 1)
			Geometry::CopyPolygon2DData(&polygon2DData, chamPolys[1]);

		for (UIndex iResPoly = 1; iResPoly <= chamPolys.GetItemCount(); iResPoly++)
			Geometry::FreePolygon2DData(&chamPolys[iResPoly]);
		
	}
	return err;
}
Attachments
TIM截图20180604201044.png
Last edited by leilei on Wed Jun 06, 2018 2:29 pm, edited 2 times in total.