Hello There,
We once had the Idea of adding some pictures as OLE objects of general tolerances (DIN ISO 2768 for example) but now with implementing PDM we're having problems with transitions of drawings with OLE objects (this is a known SPR) and exporting to DXF without those images seems not possible.
So I deleted the pcitures/OLE objects in the template, but there are a number of drawings still with those pictures in it. I want to delete those using a macro. I found a SolidWorks API help item about this: 2018 SOLIDWORKS API Help - Delete OLE Objects from Drawing Sheet and Template Example (VBA)
but it doesn't work it hangs at "DeleteAllOleItemsInSheet" : compile error wrong number of arguments or invalid property assignment.
also I found this simpler version of deleting a sketch picture on a drawing. But I have no name for the OLE objects. So I dont know if it's possible to change it for type in stead of name?
Option Explicit<br><br><br><br>Dim swApp As SldWorks.SldWorks<br>Dim swModel As ModelDoc2<br><br><br><br>Sub main()<br><br><br><br>Set swApp = Application.SldWorks<br><br><br><br>Set swModel = swApp.ActiveDoc<br>swModel.SelectByName 0, "Sketch Picture1"<br>swModel.EditDelete<br><br><br><br>End Sub<br><span class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span>It would be nice if I can run it on a folder, but opening the files and deleting the pictures with a macro is also an option.
I'm dabbling a bit with macro's and API but i've still got a long way to go.. I would appreciate help on this subject!
SolidworksApi/macros