BIM Coordinator Program (INT) April 22, 2024

Find the next step in your career as a Graphisoft Certified BIM Coordinator!

Archicad C++ API
About Archicad add-on development using the C++ API.

ChamferPolygon2DDataContour and ChamferPolygon2DDataVertex can not get chamfer polygon

leilei
Enthusiast
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:


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))
			continue;
		GS::VAArray<Geometry::Polygon2DData> chamPolys;
		err = ChamferPolygon2DDataVertex(polygon2DData, i+1, dRadius, &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;
}
1 REPLY 1
leilei
Enthusiast
Maybe I found the problem.When I use this polygon data with clockwise, it always gets the resulting polygon null,but err=NoError.
Now I have no problem when changing polygon data to counterclockwise. I can get the resulting polygon
success.
Learn and get certified!

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!