I'm on SolidWorks 2022 and the code is as follows:
Sub recupTranparenceImage()
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swSelMgr As SldWorks.SelectionMgr
Dim swFeat As SldWorks.Feature
Dim swSketchPicture As SldWorks.ISketchPicture
Dim boolstatus As Boolean
'Dim instance As ISketchPicture
Dim Style As Long
Dim Transparency As Double
Dim MatchingColor As Long
Dim MatchingTolerance As Double
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
'boolstatus = swModel.Extension.SelectByID2("Feuille1", "SHEET", 5.43900806628579E-02, 0.13276815279762, 0, False, 0, Nothing, 0)
swModel.EditTemplate
swModel.EditSketch
boolstatus = swModel.Extension.SelectByID2("Image d'esquisse2", "SKETCHBITMAP", 0.166852606603703, 0.134853758836237, 0, False, 0, Nothing, 0)
Set swSelMgr = swModel.SelectionManager
Set swFeat = swSelMgr.GetSelectedObject6(1, -1)
Set swSketchPicture = swFeat.GetSpecificFeature2
'Debug.Print swSketchPicture.SetTransparency(2, 0.97, 0, 0)
Debug.Print swSketchPicture.GetTransparency(Style, Transparency, MatchingColor, MatchingTolerance)
Debug.Print Transparency
swModel.EditSheet
End Sub
Yes thank you @Sylk , that's exactly what I just tested, thanks to your value reflection returned by the function:
Sub recupTranparenceImage()
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swSelMgr As SldWorks.SelectionMgr
Dim swFeat As SldWorks.Feature
Dim swSketchPicture As SldWorks.ISketchPicture
Dim boolstatus As Boolean
Dim Style As Long
Dim Transparency As Double
Dim MatchingColor As Long
Dim MatchingTolerance As Double
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
swModel.EditTemplate
swModel.EditSketch
boolstatus = swModel.Extension.SelectByID2("Image d'esquisse2", "SKETCHBITMAP", 0.166852606603703, 0.134853758836237, 0, False, 0, Nothing, 0)
Set swSelMgr = swModel.SelectionManager
Set swFeat = swSelMgr.GetSelectedObject6(1, -1)
Set swSketchPicture = swFeat.GetSpecificFeature2
swSketchPicture.GetTransparency Style, Transparency, MatchingColor, MatchingTolerance
Debug.Print Transparency
swModel.EditSheet
End Sub