AnsweredAssumed Answered

Delete block from only one sheet

Question asked by Eimantas Palevicius on Apr 12, 2016
Latest reply on Dec 21, 2016 by Eimantas Palevicius

Hello,

 

I am using this part of the code to delete all blocks in my selected drawing view. but when i run this code it also deletes blocks with the same name in other drawing views even in other sheets. Lets say i need to delete "block1" from "drawing view1" in "sheet2", but when i run this code it also deletes "block1" from "sheet1" "drawing view3". Any suggestions what i am doing wrong?

 

Set swSketchMgr = swModel.SketchManager  

    vBlockDef = swSketchMgr.GetSketchBlockDefinitions

    If Not IsEmpty(vBlockDef) Then

        For i = 0 To UBound(vBlockDef)

            Set swBlockDef = vBlockDef(i)

            Set swFeat = swBlockDef.GetFeature

            retval = swFeat.Select2(False, -1)

            retval = swModelDocExt.DeleteSelection2(False)

        Next i

    End If

 

 

Regards

E.P.

 

Update. Found the correct code.

Outcomes