Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X
Hello,
I am configuring an algorithm to collect holes from a solid model.
If ProSurfacedataGet returns 2, it is determined to be a hole.
In the case of the slot, there is no sense of how to deal with it.
The argument we use to identify the hole is a solid model, surface.
Can anyone share a good idea to identify the hole in the case of a slot?
Thanks.
Warm Regards,
SeonHo Cha
Solved! Go to Solution.
One method we've used in the past (its a bit cumbersome, but it works) is to use:
If you loop through all of these items, you can use the appropriate data methods (such as ProContourdataGet and ProEdgeDataGet) to help determine what kind of edges you have. From there, its pretty easy to determine what a "slot" is by comparing # of edges in the contour, + the types, lengths, and radii of the edges.
One nice thing about this method too, as opposed to using ProHole methods (etc), is that it usually works pretty well on imported or non-native geometry as well.
Hope this helps!
James Sullivan
One method we've used in the past (its a bit cumbersome, but it works) is to use:
If you loop through all of these items, you can use the appropriate data methods (such as ProContourdataGet and ProEdgeDataGet) to help determine what kind of edges you have. From there, its pretty easy to determine what a "slot" is by comparing # of edges in the contour, + the types, lengths, and radii of the edges.
One nice thing about this method too, as opposed to using ProHole methods (etc), is that it usually works pretty well on imported or non-native geometry as well.
Hope this helps!
James Sullivan
Dear @sully7 ,
There is a problem applying.
The slots and holes shown in the picture are the same number and type of contours and edges.
I attached the simple code that i used.
Could you please help me in more detail?
static int contourSize,edgeSize;
ProError Eooo(ProEdge p_edge,ProError status,ProAppData data)
{
edgeSize++;
ProGeomitemdata *gmdt;
ProEdgeDataGet(p_edge,&gmdt);
return PRO_TK_NO_ERROR;
}
ProError Cooo(ProContour p_contour,ProError status,ProAppData data)
{
contourSize++;
ProContourTraversal p_traversal;
ProContourTraversalGet(p_contour,&p_traversal);
ProContourEdgeVisit((ProSurface)data,p_contour,(ProContourEdgeVisitAction)Eooo,NULL,NULL);
return PRO_TK_NO_ERROR;
}
ProError Test()
{
ProError status = PRO_TK_NO_ERROR;
ProSelection *sel;
int n_sel;
ProModelitem mdlitem;
ProSurface surface;
status = ProSelect("surface",1,NULL,NULL,NULL,NULL,&sel,&n_sel);
if(status != PRO_TK_NO_ERROR) return status;
status = ProSelectionModelitemGet(sel[0],&mdlitem);
status = ProGeomitemToSurface((ProGeomitem*)&mdlitem,&surface);
/*Slot check*/
contourSize = 0;
edgeSize = 0;
ProSurfaceContourVisit(surface,(ProSurfaceContourVisitAction)Cooo,NULL,(ProAppData)surface);
return status;
}
Agree that below both combination are having 12 edges.
import feature having hole
slot consisting of extrude and round
For non linear edge (ProEdgeType() API would help you on this), You can try API ProEdgeNeighbour() which identifies new neighbor edge as non linear edge would result into hole.
this one has good explanations:
http://www.cs.umd.edu/~nau/others-papers/regli_thesis95.pdf
OpenCASCADE has defeaturing algorithm library:
You may give this a try as well:
ProSurfaceSameSrfsFind (ProSolid solid,
ProSurface surface,
ProSurface **r_surf_arr,
int *r_size);
Purpose: Finds and returns an array of surfaces that are the same as the
input surface. For example, in the case of a cylinder, Creo Parametric
creates two half-cylindrical surfaces. If you input one half, the
other half is returned by this function.