AnsweredAssumed Answered

Power Select not working for surface type 

Question asked by Saugat Kc on May 12, 2016

I am trying to extract model information using power select options in solidworks. When I get the edge information by setting edge complexity, I am getting correct result. But when I use same technique for getting surface type using face, it always throws 10002 error.

Here's my working and non-working code to access power select.

 

Working Code for Edge:

gtcocswUtilities swUtil = default(gtcocswUtilities);

gtcocswPowerSelect swPwrSelect = default(gtcocswPowerSelect);

swUtil = swApp.GetAddInObject("Utilities.UtilitiesApp");

int errors = 0;

swPwrSelect = swUtil.PowerSelect;

swPwrSelect.Init();

swPwrSelect.SetSelectEntitiesTypes((int)gtPslSelectionType_e.gtPslSelectionType_Edge);

swPwrSelect.SetEdgeConvexityFilter(true, false, false);  //Select only convex edges

int[] result_concvexEdge = swPwrSelect.RunPowerSelect((int)gtResultOptions_e.gtResultNoUI, out errors);

 

 

Non-Working code for face count using plane surface:

gtcocswUtilities swUtil = default(gtcocswUtilities);

gtcocswPowerSelect swPwrSelect = default(gtcocswPowerSelect);

swUtil = swApp.GetAddInObject("Utilities.UtilitiesApp");

int errors = 0;

swPwrSelect = swUtil.PowerSelect;

swPwrSelect.Init();

swPwrSelect.SetSelectEntitiesTypes((int)gtPslSelectionType_e.gtPslSelectionType_Face);

int sel = swPwrSelect.SetSurfaceTypeFilter((int)swSurfaceTypes_e.PLANE_TYPE); // Count number of planes

int[] result_surfaceTypePlane = swPwrSelect.RunPowerSelect((int)gtResultOptions_e.gtResultNoUI, out errors);

 

 

what am I doing wrong here??

Outcomes