Bonsoir à tous,
Le petit bout de code suivant permet de compter les liens OLE.
Ceux-ci peuvent être des images ou autre. Il y a t'il des moyens d'accéder aux autres informations disponibles pour ce type d'objet ?
Je cherche en vain des exemples sur ce sujet !
....
' OLE2FRAME
Set oDics = ThisDrawing.Dictionaries
For Each oD In oDics
If TypeOf oD Is AcadDictionary Then
If oD.Name = "ACAD_IMAGE_DICT" Then
Set oDic = oD
Set ss = sset(0, "OLE2FRAME")
For Each OleDef In ThisDrawing.SelectionSets
OleNbre = ss.Count
MsgBox "Il y a " & OleNbre & " image(s) ole dans ce dessin"
Next OleDef
End If
End If
Next oD
.....
Public Function sset(FilterType, FilterData As Variant, Optional ssName As String = "SS") As AcadSelectionSet
Dim oSSets As AcadSelectionSets
Set oSSets = ThisDrawing.SelectionSets
For Each sset In oSSets
If sset.Name = ssName Then
sset.Delete
Exit For
End If
Next
Dim FType() As Integer
Dim FData() As Variant
Dim i As Integer
If IsArray(FilterType) = False Then
If IsArray(FilterData) = False Then
ReDim FType(0)
ReDim FData(0)
FType(0) = FilterType
FData(0) = FilterData
Else
Exit Function
End If
Else
If UBound(FilterType) UBound(FilterData) Then
Exit Function 'They must be pairs
End If
ReDim FType(UBound(FilterType))
ReDim FData(UBound(FilterType))
For i = 0 To UBound(FilterType)
FType(i) = FilterType(i)
FData(i) = FilterData(i)
Next
End If
Set sset = ThisDrawing.SelectionSets.Add(ssName)
sset.Select 5, FilterType:=FType, FilterData:=FData
'To use this function for single filter
'Set SS = SSet(0, "insert")
'For multiple filter
'Set SS = SSet(array(0,2),array("insert",oBlock.name)) 'must be pairs
End Function