- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I want to do a split of a worksurface, with a sketchblock (can also be a normale sketch)
with my code, Inventor 2017 is crashing.
and when not crashing, VB will give me an error.
what am I missing here?
thanks!
my code:
Private Sub CreatesplitHole()
Dim oPartDoc As Inventor.PartDocument = _inventorApplication.ActiveDocument
Dim oCompDef As PartComponentDefinition = oPartDoc.ComponentDefinition
'Dim oSelectSet As SelectSet = oPartDoc.SelectSet
Dim oSketch As PlanarSketch = oPartDoc.ComponentDefinition.Sketches(2)
Dim oTobjs As TransientObjects = _inventorApplication.TransientObjects
Dim objectCollection As ObjectCollection = oTobjs.CreateObjectCollection
Dim oWSFace As WorkSurface = oPartDoc.ComponentDefinition.WorkSurfaces(1)
Dim oSurfBody As SurfaceBody = oWSFace.SurfaceBodies(1)
Dim oFace As Face = oSurfBody.Faces(1)
objectCollection.Add(oFace)
Dim oSplitfeatures As SplitFeatures = oPartDoc.ComponentDefinition.Features.SplitFeatures
Dim oSketchBlocks As SketchBlocks = oSketch.SketchBlocks
For Each oSketchBlock As SketchBlock In oSketchBlocks
Dim oPath As Path = Nothing
Dim oSketchEntities As SketchEntitiesEnumerator = oSketchBlock.Definition.SketchEntities
For Each oSketchEntity As Object In oSketchEntities
If oSketchEntity.Construction = False Then
If oSketchEntity.Type <> ObjectTypeEnum.kSketchPointObject Then
oPath = oCompDef.Features.CreatePath(oSketchEntity)
Exit For
End If
End If
Next
Dim oSplit As SplitFeature
' Why does the split not work?
'oSplit = oSplitfeatures.SplitFaces(oPath, False, oSurfBody)
oSplit = oSplitfeatures.SplitFaces(oPath, False, objectCollection)
Next
End Sub
Kudo's are also appreciated

Succes on your project, and have a nice day
Herm Jan
Solved! Go to Solution.