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

Red text in your code returns the reference of the top assembly document (that owns the rule), while you need in the part document.  As the top assembly does not have those parameters  nothing happens. 

 

Dim openDoc As Document = ThisDoc.Document

If openDoc.DocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then

For Each docFile As Document In openDoc.AllReferencedDocuments

If docFile.DocumentType = DocumentTypeEnum.kPartDocumentObject Then

Dim oParams As Parameters = ThisDoc.Document.ComponentDefinition.Parameters    <--- mistake
Dim oUserParams As UserParameters = oParams.UserParameters

'Look for Frame Gen Parameter and format it
Try
Dim oParam As Inventor.Parameter
'Enter the name of Paramter here
..........................
..........................
..........................

 

 

So please try  this line in the following form:

 

Dim oParams As Inventor.Parameters = docFile.ComponentDefinition.Parameters

Hope this helps.

 


Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network