in this line
vSkRelArr = swSkRelMgr.GetRelations(swAll): If IsEmpty(vSkRelArr) Then Exit Sub
'SwBroken = 6 if the enumeration doesnt work
vSkRelArr = swSkRelMgr.GetRelations(swSketchRelationFilterType_e.swBroken): If IsEmpty(vSkRelArr) Then Exit Sub
then delete each one
i have never tried this but it seems like it should be what you are looking for.
thanks for the reply. Forgot about the filter...lol. I got it to work with the below macro, using "1" for "dangling" instead of "6" for "broken"....just didn't work with 6(broken) for some reason....now i just need to run it through the entire model and appropriate sketches
Dim swApp As SldWorks.SldWorks
Dim Part As ModelDoc2
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
Dim swFeat As Feature
Dim swSketch As Sketch
Dim swSkRelMgr As SketchRelationManager
Set swFeat = Part.SelectionManager.GetSelectedObject6(1, -1)
Set swSketch = swFeat.GetSpecificFeature2
Set swSkRelMgr = swSketch.RelationManager
Dim vSkRelArr As Variant
vSkRelArr = swSkRelMgr.GetRelations(swSketchRelationFilterType_e.swAll)
If IsEmpty(vSkRelArr) = False Then
Dim i As Integer
Dim swSkRel As SketchRelation
For i = 0 To UBound(vSkRelArr)
Set swSkRel = vSkRelArr(i)
Debug.Print "Relation type: " & swSkRel.GetRelationType
If swSkRel.GetRelationType = 1 Then boolstatus = swSkRelMgr.DeleteRelation(swSkRel)
This didn't work?
Cus relation type and relation filter type are 2 different enumerators.
No it didn't work. for some reason using vSkRelArr = swSkRelMgr.GetRelations(swSketchRelationFilterType_e.swAll), then setting the swSkRel.GetRelationType = 1(or dangling) worked. Even swSkRel.GetRelationType = 6 (or Broken) didn't work.
USES this enumerator
2017 SOLIDWORKS API Help - swSketchRelationFilterType_e Enumeration
6 in this one is Broken
uses this enumerator
Get Relations use this one
6 in this one is Tangent
if we are talking about the same thing then say we are.
Sorry for the confusion/issue, i have been in 4 straight, full, 12 hr days of Simulation training...and my mind is foggy. I agree with your relation vs relation type list. For some reason my above macro stopped working too.