Message 1 of 1
Sketchentity Split Function
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Is there a way to use "sketchsplitcmd" in API function? i tried it,but failed is any one to help?
Function GetSketchSplit(oSk As PlanarSketch)
Dim oSken1 As SketchEntity
Dim oSken2 As SketchEntity
Dim oSkents As List(Of SketchEntity) = oSk.SketchEntities.Cast(Of SketchEntity).Where(Function(x) x.type <> ObjectTypeEnum.kSketchPointObject).ToList
Dim oSelect As SelectSet = oSk.Parent.Document.SelectSet
oSk.Edit
For Each oSken1 In oSkents
For Each oSken2 In oSkents
Dim oSkpt As New List(Of SketchPoint)
If oSken1 Is oSken2 Then Continue For
If oSken1.Type = ObjectTypeEnum.kSketchLineObject Then
Dim oSkLine As SketchLine
oSkLine = oSken1
Dim oSLine As LineSegment2d
oSLine = oSkLine.Geometry
Dim oBj As ObjectsEnumerator = oSLine.IntersectWithCurve(oSken2.Geometry)
If oBj Is Nothing Then
Continue For
Else
' Dim oCommandMgr As CommandManager
' oCommandMgr = oInvApp.CommandManager
' Get control definition for the line command.
' Dim oControlDef As ControlDefinition
' oControlDef = oCommandMgr.ControlDefinitions.Item("SketchSplitCmd")
' oControlDef.Execute2(True)
' oCommandMgr.DoSelect(oSken1)
' oCommandMgr.DoSelect(oSken2)
Try
oSk.Parent.Document.SelectSet.Select(oSken1)
oSk.Parent.Document.SelectSet.Select(oBj(1))
oInvApp.CommandManager.ControlDefinitions.Item("SketchSplitCmd").Execute
Catch : End Try
oSk.Parent.Document.SelectSet.Clear
Try
oSk.Parent.Document.SelectSet.Select(oSken2)
oSk.Parent.Document.SelectSet.Select(oBj(1))
oInvApp.CommandManager.ControlDefinitions.Item("SketchSplitCmd").Execute
Catch : End Try
oSk.Parent.Document.SelectSet.Clear
' oCommandMgr.DoUnSelect(oSken2)
End If
End If
Next
Next
oSk.ExitEdit
End Function