Hello all! In solidworks VBA, I'm attempting to turn all text found within specially titled sketches into its base segments. The solidworks API documentation for the method (found here) is somewhat vague.
Every so often, some variation on the code below seems to work on the UI (the text has visibly been dissolved), but the dissolved text is not picked up as a sketch during later parts of the function. In addition, when it does work, it seems to "lock down" the solidworks UI - it won't even let me exit the assembly view after the macro has finished running.
If anybody has any idea how to reliably dissolve sketch text with the API, I'd appreciate the assistance.
For i = 1 To pathList.Count
Set swModel = swApp.OpenDoc(pathList(i), 1) 'Can I force-open a drawing of the doc if I make the integer 3?
Set swFeat = swModel.FirstFeature
Do While Not swFeat Is Nothing
If swFeat.GetTypeName2 = "ProfileFeature" Or swFeat.GetTypeName2 = "3DProfileFeature" Then
If swFeat.Name Like "ETCH_*" Or swFeat.Name Like "OPEN_*" Then
Set swSketch = swFeat.GetSpecificFeature2()
swSketchTextList = swSketch.GetSketchTextSegments
If Not IsEmpty(swSketchTextList) Then
'Debug.Print "it's not empty"
Dim k As Integer
swSketch.Select4 True, Nothing
swModel.ClearSelection2 True
swModel.EditSketch
For k = 0 To UBound(swSketchTextList)
Set swSketchTextSeg = swSketchTextList(k)
If swSketchTextSeg Is Nothing Then
Debug.Print "It's nothing!"
End If
selBool = swSketchTextSeg.Select4(True, Nothing)
Debug.Print selBool
Next k
swModel.DissolveSketchText
swModel.InsertSketch2 True
End If
End If
End If
Set swFeat = swFeat.GetNextFeature
Loop
swModel.ForceRebuild3 False
