Hello,
I want to make a new function in my own add-in to dril holes in cupboard panels for a dowel connection.
I used to make holes in other "own" functions where the user selects the faces.
In this function the user must select 2 parts in an assembly and then find the adjacent (planar) faces. I need this faces to make the sketch for the holes.
Does anyone know how to find these adjacent faces?
Roelof
I tried to select the adjacent face of two parts in an assembly. I get the error: Method 'LocateUsingPoint' of object 'SurfaceBodyProxy' failed.
What is the cause of this?
Regards,
Roelof
Sub SelectPartFace()
Dim PartA As ComponentOccurrence Dim PartB As ComponentOccurrence
Set PartA = ThisApplication.CommandManager.Pick(kAssemblyOccurrenceFilter, "Selecteer part A:")
Set PartB = ThisApplication.CommandManager.Pick(kAssemblyOccurrenceFilter, "Selecteer part B:")
Dim FaceA As Face Dim FaceB As Face
Dim FaceProxyA As FaceProxy Dim FaceProxyB As FaceProxy
Dim dAfstand As Double
Dim FacePoint As Point
Dim Werkpunt As WorkPoint Dim FacePointProxy As Object
Dim AdFace As Object Dim RaakvlakProxy As FaceProxy
Dim SurfaceBodyProxyA As SurfaceBodyProxy Dim SurfaceBodyProxyB As SurfaceBodyProxy
For Each FaceA In PartA.Definition.SurfaceBodies(1).Faces
Debug.Print FaceA.InternalName
Call PartA.CreateGeometryProxy(FaceA, FaceProxyA)
Set FacePoint = FaceProxyA.PointOnFace
Call PartB.CreateGeometryProxy(PartB.SurfaceBodies(1), SurfaceBodyProxyB)
Set AdFace = SurfaceBodyProxyB.LocateUsingPoint(kFaceObject, FacePoint)
If AdFace Is Nothing
Then
Else
ThisApplication.ActiveDocument.SelectSet.Select Raakvlak
Set AdFace = Nothing
End If
Next
End Sub