Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Select adjacent face

1 REPLY 1
Reply
Message 1 of 2
Meubelmaker1979
576 Views, 1 Reply

Select adjacent face

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

    

1 REPLY 1
Message 2 of 2

 

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report