<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Sketchentity Split Function in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/sketchentity-split-function/m-p/13652806#M25</link>
    <description>&lt;P&gt;Is there a way to use "sketchsplitcmd" in API function? i tried it,but failed is any one to help?&lt;/P&gt;&lt;LI-CODE lang="visual"&gt;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 &amp;lt;&amp;gt; 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&lt;/LI-CODE&gt;</description>
    <pubDate>Wed, 28 May 2025 05:52:16 GMT</pubDate>
    <dc:creator>Stakin</dc:creator>
    <dc:date>2025-05-28T05:52:16Z</dc:date>
    <item>
      <title>Sketchentity Split Function</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/sketchentity-split-function/m-p/13652806#M25</link>
      <description>&lt;P&gt;Is there a way to use "sketchsplitcmd" in API function? i tried it,but failed is any one to help?&lt;/P&gt;&lt;LI-CODE lang="visual"&gt;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 &amp;lt;&amp;gt; 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&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 28 May 2025 05:52:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/sketchentity-split-function/m-p/13652806#M25</guid>
      <dc:creator>Stakin</dc:creator>
      <dc:date>2025-05-28T05:52:16Z</dc:date>
    </item>
  </channel>
</rss>

