Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Rule to delete PFD object not working from assembly environment

caroline_ccc
Enthusiast

Rule to delete PFD object not working from assembly environment

caroline_ccc
Enthusiast
Enthusiast

Hello all.

I would like your help to understand the below. :smiling_face_with_smiling_eyes:

 

The below rule is included in one of my Inventor parts, it is used to delete a pdf file included as 3rd party object.  

The rule works perfectly when I run inside the part environment, but when I request to run straight from the assembly  environment with ilogicVb.RunRule ("partABC", "Rule break link") it does nothing. 

 

What would be the reason?

 

This is the rule included in the part file.

Dim oDoc As Inventor.Document
oDoc = ThisApplication.ActiveDocument
For Each ref As ReferencedOLEFileDescriptor In oDoc.ReferencedOLEFileDescriptors
If (iProperties.Value("Custom", "Material") = "ABC") And (iProperties.Value("Custom", "Type") = "X") Then

If (ref.DisplayName = "PDFA.pdf") Then
ref.Delete() 'delete reference

End if
End if
Next

 

0 Likes
Reply
Accepted solutions (1)
262 Views
2 Replies
Replies (2)

Michael.Navara
Advisor
Advisor
Accepted solution

Avoid to use ThisApplication.ActiveDocument Use ThisDoc.Document instead.

ThisDoc references to the document in which context the rule is running.

caroline_ccc
Enthusiast
Enthusiast

@Michael.Navara 

Thanks for your fast reply and it works perfectly!

0 Likes