AnsweredAssumed Answered

Find non-fully constrained sketches (including 3D sketch)?

Question asked by Marc Kane on Sep 16, 2020
Latest reply on Sep 19, 2020 by Deepak Gupta

With these lines of the code I am extracting the names of all of the sketches that are not fully constrained. And it works also even if the sketch is standing alone in the tree (no feature has been built out of it), however this doesn't work for 3d sketch or sketches that are under hole wizard, so I assume it has to be something with the two sketches that are required to create it (hole wizard for example). Do you have an idea how can I implement it into this code (maybe with subfeature) and how to tell the program to loop only through the sketches that are not suppressed?

 

 

Dim sSketchNameArr() As String
Dim swFeat As Feature
Dim swSketch As Sketch
Const swTnProfileFeature As String = "ProfileFeature"

 

ReDim sSketchNameArr(0)
swFeat = swPart.FirstFeature
Do While Not swFeat Is Nothing
If swTnProfileFeature = swFeat.GetTypeName2 Then
swSketch = swFeat.GetSpecificFeature2
If swConstrainedStatus_e.swUnderConstrained = swSketch.GetConstrainedStatus Then
sSketchNameArr(UBound(sSketchNameArr)) = swFeat.Name
ReDim Preserve sSketchNameArr(UBound(sSketchNameArr) + 1)
End If
End If
swFeat = swFeat.GetNextFeature
Loop

 

' Remove last empty sketch name

 

ReDim Preserve sSketchNameArr(UBound(sSketchNameArr) - 1)

 

'Write down the results

 

Dim FileName As String = Application.StartupPath & "\myarray.txt"
IO.File.WriteAllLines(FileName, sSketchNameArr)

Outcomes