I am trying SplitFeatures with TrimSolid in iLogic, the objects by function are (SplitTool As Object, Body As SurfaceBody, [RemovePositiveSide] As Boolean), when use 2dPath and sketchLine to be ContainingSketchBlock not working and closes Inventor
I try used CreatePath and CreateSpecifiedPath functions by SplitTool but put error.
How do I do TrimSolid with curves in SketchBlock in illogic or macros?
I am trying with the next code.
Dim oCollection As ObjectCollection = ThisApplication.TransientObjects.CreateObjectCollection
Dim opartdoc As PartDocument = ThisApplication.ActiveDocument
Dim curve As Object = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kSketchCurveFilter, "Select sketch line")
If curve.type = ObjectTypeEnum.kSketchLineObject Then
If curve.ContainingSketchBlock Is Nothing Then
Logger.Trace("ContainingSketchBlock: false")
Dim path1 As Path = opartdoc.ComponentDefinition.Features.CreatePath(curve)
opartdoc.ComponentDefinition.Features.SplitFeatures.TrimSolid(path1,opartdoc.ComponentDefinition.SurfaceBodies.Item(1),True)
Else
Logger.Trace("ContainingSketchBlock: true")
oCollection.Add(curve)
Try
'Dim path2 As Path = opartdoc.ComponentDefinition.Features.CreatePath(curve)
Dim path2 As Path = opartdoc.ComponentDefinition.Features.CreateSpecifiedPath(oCollection)
Logger.Trace("---Path Count> " & path2.Count)
opartdoc.ComponentDefinition.Features.SplitFeatures.TrimSolid(path2, opartdoc.ComponentDefinition.SurfaceBodies.Item(1), False)
Catch ex As Exception
Logger.Trace("---Error Message> " & ex.Message)
End Try
End If
Else
Exit Sub
End If