APi Help Lock edge and face selection to a specific part in an assembly

APi Help Lock edge and face selection to a specific part in an assembly

neodd70
Enthusiast Enthusiast
354 Views
1 Reply
Message 1 of 2

APi Help Lock edge and face selection to a specific part in an assembly

neodd70
Enthusiast
Enthusiast

Can anyone tell me if there is a way to lock the selection of edges and faces to a specific part within an assembly. I have created a rule for making a hole pattern. I want the user to select the face of the part they want the hole pattern on and then select an edge that the hole pattern will be parallel to as well as the left and right edges that the hole pattern will start from and end at but I want the user to only be able to select edges that are part of the face. Is there a filter that will only allow the selection of edges that are edges of the face that was selected?

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

matt_jlt
Collaborator
Collaborator

There is no filter I can think of but you can code in a selection filter. Here is a rough example on testing if an edge matches a face.

 

Matt

 

' User face selection
Dim oSelFace As Face = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartFaceFilter, "Select Part Face")

' Check face was selected
If oFace Is Nothing Then
	MessageBox.Show("No face selected")
	Exit Sub
End If

' User edge selection
Dim oSelEdge As Edge = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartEdgeFilter, "Select Part Edge")

' Check edge was selected
If oSelEdge Is Nothing Then
	MessageBox.Show("No edge selected")
	Exit Sub
End If

' Matching edge boolean flag
Dim bFlag As Boolean = False

' Iterate through edges in the selected face, see if it matches selected edge
For Each oEdge In oSelFace.Edges
	If oEdge Is oSelEdge Then bFlag = True
Next

' Prompt with true / false selection match
MessageBox.Show("Edge Found = " & bFlag)

'' Can also do the reverse of the above and check the faces under the selected edge
'' e.g. example snippet below
'For Each oFace In oSelEdge.Faces
'	If oSelFace Is oFace Then bFlag = True
'Next  

 

0 Likes