How to check Face overlap between two component occurance in an assembly

How to check Face overlap between two component occurance in an assembly

Anonymous
Not applicable
344 Views
1 Reply
Message 1 of 2

How to check Face overlap between two component occurance in an assembly

Anonymous
Not applicable

Hi All, i am stuck with this issue since long need your help.

 

I have two slots where it has collection of 12 faces. i need to check whether the two slots are aligned at 90deg forming "L" shape arrangement.

So i thought to check with any of the faces in slot whether they overlap.

i tried checking with face vertices but unable to get exact overlap.

 

please share solution how can i check whether two faces overlap each other.

 

Thanks in advance.

 

0 Likes
345 Views
1 Reply
Reply (1)
Message 2 of 2

Ralf_Krieg
Advisor
Advisor

Hello

 

It's difficult to imagine the exact situation. Can you post screenshots of possible positions of the two slots or a simplified demo assembly?

A simple way would be just to check the angle between two faces of the slots. If you assign the name "SideFace" to one face of the slot and the two occurrences in the assembly are named Part:1 and Part:2, the iLogic below can return the angle.

 

Sub Main()
	Dim oAssDoc As AssemblyDocument = ThisDoc.Document
	Dim fp1 As FaceProxy
	Dim fp2 As FaceProxy
	
	For Each oOcc As ComponentOccurrence In oAssDoc.ComponentDefinition.Occurrences
		Select Case oOcc.Name
			Case "Part:1" : fp1 =GetProxy(oOcc)
			Case "Part:2" : fp2 =GetProxy(oOcc)
		End Select
	Next
	
	Dim oAngle As Double = 180/PI * ThisApplication.MeasureTools.GetAngle(fp1, fp2)
	MsgBox(oAngle & "°")
End Sub

Private Function GetProxy(ByVal oOcc As ComponentOccurrence) As FaceProxy
	Dim iLogicAuto = iLogicVb.Automation
	Dim namedEntities = iLogicAuto.GetNamedEntities(oOcc.Definition.Document )

	Dim o As Object
	If namedEntities.NameExists("SideFace") Then
		o = namedEntities.FindEntity("Sideface")
		f=TryCast(o,Face)
	End If
	
	If f Is Nothing Then Return Nothing
	
	oOcc.CreateGeometryProxy(f, GetProxy)
End Function

 


R. Krieg
RKW Solutions
www.rkw-solutions.com
0 Likes