Hi @ricky_galetaSGGSQ . The biggest problem is to get the drawings of the parts from the upper assembly. I wrote an example rule for you that deletes the rule named "Create PDF" (line 5). This rule can get the name of the component and look for a match in the directory "C:\project1\drawings\" (line 4). If this option does not work for you, the best way would be to describe your situation in more detail, where and under what name your drawings are stored, in order to better understand what logic to write to find them.
Sub main()
Dim oDoc As Document = ThisDoc.Document
If Not TypeOf oDoc Is AssemblyDocument Then Exit Sub
Dim sDrawPath As String = "C:\project1\drawings\"
Dim sNameRule As String = "Create PDF"
Dim oAsmDoc As AssemblyDocument = oDoc
Dim oDrawFullName As String
oDrawFullName = GetDrawingDoc(oAsmDoc, sDrawPath)
If String.IsNullOrEmpty(oDrawFullName) Then
Call DeleteRule(oDrawFullName, sNameRule)
oDrawFullName = Nothing
End If
For Each oRefDoc As Document In oAsmDoc.AllReferencedDocuments
oDrawFullName = GetDrawingDoc(oRefDoc, sDrawPath)
If String.IsNullOrEmpty(oDrawFullName) Then
Call DeleteRule(oDrawFullName, sNameRule)
oDrawFullName = Nothing
End If
Next
End Sub
Private Function DeleteRule(ByVal oDrawFullName As String, ByVal sRuleName As String)
Try
Dim oDocs As Documents = ThisApplication.Documents.Open(oDrawFullName, False)
iLogicVb.Automation.DeleteRule(oDDoc, sRuleName)
oDDoc.Save()
oDDoc.Close()
Catch : End Try
End Function
Private Function GetDrawingDoc(ByVal oDoc As Document, ByVal sDrawPath As String) As String
Dim sDrawName As String = System.IO.Path.GetFileNameWithoutExtension(oDoc.FullDocumentName)
If System.IO.File.Exists(sDrawPath & sDrawName & ".idw") Then
Return sDrawPath & sDrawName & ".idw"
Else If System.IO.File.Exists(sDrawPath & sDrawName & ".dwg") Then
Return sDrawPath & sDrawName & ".dwg"
End If
Return Nothing
End Function