Sketch Batch delete..

Valued Contributor
Valued Contributor

Hello developers..

I have a question.

 

I want to delete all the sketches used in the synchronous environment.

However, I do not seem to be able to access the "used sketch" in a synchronous environment.
My code can only handle the sketch part.
Is there a way to access and delete used sketch? ..

 

The code I used.

 

---------------------------

Dim application As SolidEdgeFramework.Application = Nothing

        Dim partDocument As SolidEdgePart.PartDocument = Nothing

        Dim SMDocument As SolidEdgePart.SheetMetalDocument = Nothing

        Dim AssyDocument As SolidEdgeAssembly.AssemblyDocument = Nothing

        Dim sketchs As SolidEdgePart.Sketchs = Nothing

        Dim sketch As SolidEdgePart.Sketch = Nothing

 

        Try

            ' See "Handling 'Application is Busy' and 'Call was Rejected By Callee' errors" topic.

            'OleMessageFilter.Register()

 

            ' Attempt to connect to a running instance of Solid Edge.

            application = DirectCast(Marshal.GetActiveObject("SolidEdge.Application"), SolidEdgeFramework.Application)

            partDocument = TryCast(application.ActiveDocument, SolidEdgePart.PartDocument)

            SMDocument = TryCast(application.ActiveDocument, SolidEdgePart.SheetMetalDocument)

 

 

            If partDocument IsNot Nothing Then

                sketchs = partDocument.Sketches

 

                For i As Integer = sketchs.Count To 1 Step -1

                    'objdimes.Count To 1 Step -1

                    sketch = sketchs.Item(i)

                    sketch.Delete()

                Next

            End If

 

            If SMDocument IsNot Nothing Then

                sketchs = SMDocument.Sketches

 

                For i As Integer = sketchs.Count To 1 Step -1

                    'objdimes.Count To 1 Step -1

                    sketch = sketchs.Item(i)

                    sketch.Delete()

                Next

            End If

 

        Catch ex As System.Exception

            Console.WriteLine(ex)

        Finally

            'OleMessageFilter.Unregister()

        End Try

-----------------------------------------------------------

1 REPLY

Re: Sketch Batch delete..

it appears to me that the API does not make distinction between sketchs and used sketches except that EnableRegions=False on used sketches

 

 

 

===================================================
Matt Johnson
Solid Edge Certified Professional (ST7 & ST8)
Solid Edge ST9 (SEEC) - Production
NX10 (Tc Integration) Pre-Production Testing
Teamcenter 10.1.6