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: 

How do I create a custom collection of surface bodies?

1 REPLY 1
SOLVED
Reply
Message 1 of 2
Anonymous
387 Views, 1 Reply

How do I create a custom collection of surface bodies?

Option Explicit
Dim blFeatChk As Boolean
Dim oWorkSurfs As WorkSurfaces
Dim oSurfBody As SurfaceBody
Dim oSurfBodies As SurfaceBodies
Dim oCompDef As ComponentDefinition
Dim oPartCompDef As PartComponentDefinition
Dim oPartDoc As PartDocument
Dim oCombFeat As CombineFeature
Public Sub DeriveInterference()
   
   Dim oCutSurfBodies As ObjectCollection
   Dim oTO As TransientObjects
   Set oTO = ThisApplication.TransientObjects
   Set oCutSurfBodies = oTO.CreateObjectCollection
   
   Set oPartDoc = ThisApplication.ActiveDocument
   Set oCompDef = oPartDoc.ComponentDefinition
   Set oSurfBodies = oCompDef.SurfaceBodies
   For Each oSurfBody In oSurfBodies
    
    If oSurfBody.Name = Not ("INT" Or "CAUT") Then
    
        oCutSurfBodies.Add (oSurfBody)
    End If
    
   Next oSurfBody
   Set oPartCompDef = oPartDoc.ComponentDefinition
   Set oCombFeat = oPartCompDef.Features.CombineFeatures.Add _
        (oSurfBody, oSurfBodies, kIntersectOperation, True)
   
End Sub

 I have this code and keep getting a type mismatch error when trying to add a surfbody to a collection.  I'm not certain what's wrong.  All I need is to select all of the solids in a model except a few identified solids.

 

The ultimate goal is to do a combine feature with one piece as the base and select all else as the toolbodies.

1 REPLY 1
Message 2 of 2
Anonymous
in reply to: Anonymous

        oCutSurfBodies.Add (oSurfBody)

'To be replaced with Call oCutSurfBodies.Add (oSurfBody)

 Figured this out.

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

Post to forums  

Autodesk Design & Make Report