cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Ask to share ideas to collect holes

CHASEONHO
18-Opal

Ask to share ideas to collect holes

Hello,

 

I am configuring an algorithm to collect holes from a solid model.
If ProSurfacedataGet returns 2, it is determined to be a hole.

Q56.png
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

1 ACCEPTED SOLUTION

Accepted Solutions
sully7
13-Aquamarine
(To:CHASEONHO)

One method we've used in the past (its a bit cumbersome, but it works) is to use:

  • ProSolidSurfaceVisit - to loop through the surfaces on the PRT, followed by
  • ProSurfaceContourVisit - to loop through the contours on the surface, followed by
  • ProContourEdgeVisit - to find all edges in the contour

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

President & Founder
CadActive Technologies - www.cadactive.com

View solution in original post

6 REPLIES 6
sully7
13-Aquamarine
(To:CHASEONHO)

One method we've used in the past (its a bit cumbersome, but it works) is to use:

  • ProSolidSurfaceVisit - to loop through the surfaces on the PRT, followed by
  • ProSurfaceContourVisit - to loop through the contours on the surface, followed by
  • ProContourEdgeVisit - to find all edges in the contour

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

President & Founder
CadActive Technologies - www.cadactive.com

@sully7 ,Thanks a lot.

I'll test and apply it.//

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.

FV
17-Peridot
17-Peridot
(To:sully7)

RPN
14-Alexandrite
14-Alexandrite
(To:CHASEONHO)

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.

Announcements