Create a Sketch on the same plane as the first one and project the cut geometry. Name the sketch "ExportThisSketch" and run this rule:
Dim pDoc As PartDocument = TryCast(ThisApplication.ActiveDocument, PartDocument)
If pDoc Is Nothing Then Logger.Debug("Not Run In Part Document") : Exit Sub
If pDoc.FullFileName Is Nothing Then MessageBox.Show("Please save this file before running rule.")
Dim ExportSketch As PlanarSketch
Try
ExportSketch = TryCast(pDoc.ComponentDefinition.Sketches.Item("ExportThisSketch"), PlanarSketch)
Catch
MessageBox.Show("Please Create a 2D sketch that you want to export and name it: ""ExportThisSketch"".")
Exit Sub
End Try
Dim DXFfilename As String
Dim sysPath As System.IO.Path
DXFfilename = sysPath.GetDirectoryName(pDoc.FullFileName)
DXFfilename = sysPath.Combine(DXFfilename, sysPath.GetFileNameWithoutExtension(pDoc.FullFileName) & "_DXF_Exports")
If Not System.IO.Directory.Exists(DXFfilename) Then System.IO.Directory.CreateDirectory(DXFfilename)
Dim AllModelStates As ModelStates = pDoc.ComponentDefinition.ModelStates
For Each ms As ModelState In AllModelStates
If ms.Name = String.Empty Then Continue For
If ms IsNot AllModelStates.ActiveModelState Then ms.Activate
Call ExportSketch.DataIO.WriteDataToFile("DXF", System.IO.Path.Combine(DXFfilename, ms.Name & ".dxf"))
Next
Here is an example of me setting it up:
You should end up with a folder in the same location as your part file with all the exported sketches. It may take a while for all 300.
Let me know if you have any questions, or run into any issues.