Inventor VBA - Split Feature with Selected Face and Visible Workplane

Inventor VBA - Split Feature with Selected Face and Visible Workplane

Anonymous
Not applicable
1,100 Views
1 Reply
Message 1 of 2

Inventor VBA - Split Feature with Selected Face and Visible Workplane

Anonymous
Not applicable

Hey all, I'd appreciate any help provided.

 

My code prompts the user to select one face that's part of a surface body (the surface body has multiple faces that I developed from manually using the splits feature) and uses a visible workplane to perform a split all the way through.

 

The split on the face wont work at all. When I add the oFace.Surfacebody portion to my code, it performs the split but on the entire surface body parent.

 

I've tried the Faceproxy, Facecollection methods too and can't seem to find something that disnguishes just that one face I selected to be sliced

 

Again, I appreciate the help guys and gals

 

Here's my code:

 

 

Public Sub SplitAllSurfacesOfSelectedSingleSurfaceBodyFace()
    
    'Define Partdocument and Split Feature to use
    Dim oPartDoc As PartDocument
    Dim oCompDef As PartComponentDefinition
    Dim oSplit As SplitFeature    
    Set oPartDoc = ThisApplication.ActiveDocument
    Set oCompDef = oPartDoc.ComponentDefinition
    
    'Define workplane object
    Dim oWorkplane As WorkPlane
    
    'Planes of Interest to Skip
    Dim YZ As String
    Dim XZ As String
    Dim XY As String

    'Workplanes names to Skip
    YZ = "YZ Plane"
    XZ = "XZ Plane"
    XY = "XY Plane"
 
'Prompt user to select face Dim oFace As Face Set oFace = ThisApplication.CommandManager.Pick(kPartFaceFilter, "Pick Face") 'Create splits using visible workplane and selected surfacebody-face For Each oWorkplane In oCompDef.WorkPlanes 'Only utilize the current visible workplane If oWorkplane.Visible = True Then If oWorkplane.Name() <> YZ Then If oWorkplane.Name() <> XZ Then If oWorkplane.Name() <> XY Then On Error Resume Next 'place this in there for the instances where the plane object doesn't posses the Driveby.Name property
'Take the remaining workplanes and slice and dice Set oSplit = oCompDef.Features.SplitFeatures.SplitFaces(oWorkplane, _ True, oFace.SurfaceBody) 'Slices the surface body parent object, but not what I want ' True, oFace) 'does nothing with the face
End If End If End If End If Next oWorkplane MsgBox "The splits are now complete."
0 Likes
1,101 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable

did you ever get this code to work? I would love to have it if you did. 

0 Likes