Determine if circular face is "open" or "closed"

Determine if circular face is "open" or "closed"

ianteneth
Advocate Advocate
609 Views
1 Reply
Message 1 of 2

Determine if circular face is "open" or "closed"

ianteneth
Advocate
Advocate

In the screenshot below there are two holes, one is "closed" (a full circle, not on the edge) and the other is "open" (semi-circle on the edge). Using the code below, I am trying to highlight circular faces red, but I don't want the "open" half circle hole to be highlighted. See attached part file to help testing.

How can I differentiate between the two circular faces and figure out which one is "open" or "closed"?

 

screenshot.png

 

 

 

Sub Main()
	
	Dim part As PartDocument
	part = ThisDoc.Document
	
	Dim style As RenderStyle
    style = part.RenderStyles.Item("red")
	
	For Each face In part.ComponentDefinition.SurfaceBodies.Item(1).Faces
		
	   If Face.SurfaceType = SurfaceTypeEnum.kCylinderSurface Then
		   	Face.SetRenderStyle(kOverrideRenderStyle, style) 
	    End If
		
	Next Face
	
End Sub

 

0 Likes
Accepted solutions (1)
610 Views
1 Reply
Reply (1)
Message 2 of 2

_dscholtes_
Advocate
Advocate
Accepted solution

You can get the edges of the selected face. If the face is 'closed', I recon the amount should be 2 (the upper and lower circles). If the face is 'open', I recon the amount should be 4 (the upper and lower arc sections and the two vertical edges). 

If Face.Edges.Count = 2 Then
   'face is closed
Else
   'face is open
End