I want to delete a sketch in a multisketch part with all relation associated to that sketch and dimentions.
How can i do using API's
Thanx.
Aqeel
SolidworksApi macros
I want to delete a sketch in a multisketch part with all relation associated to that sketch and dimentions.
How can i do using API's
Thanx.
Aqeel
SolidworksApi macros
You need to select the sketch and then use Delete() with your ModelDoc2 object.
swSelMgr = k_ModelDoc.SelectionManager
k_ModelDoc.ClearSelection2(
True)
BoolRes = k_ModelDoc.Extension.SelectByID(Trim(strSketch),
"SKETCH", 0, 0, 0, True, 0, Nothing)
swSelMgr = k_ModelDoc.SelectionManager
swFeat = swSelMgr.GetSelectedObject5(1)
swSketch = swFeat.GetSpecificFeature2
swSRM = swSketch.RelationManager
k_ModelDoc.EditSketch()
vSketchRelations = swSRM.GetRelations(swDangling) '->> Instead of swDangling YOU can use other options
If Not vSketchRelations Is Nothing Then
For i = 0 To UBound(vSketchRelations)
swRelation = vSketchRelations(i)
vEntities = swRelation.GetEntities()
For j = 0 To UBound(vEntities)
swEntity = vEntities(j)
k_ModelDoc.ClearSelection2(
True)
swEntity.Select2(
False, 0)
k_ModelDoc.DeleteSelection(
False)
Next j
Next i
End If
k_ModelDoc.EditSketch()