trying to use iLogic to update the same parameter in multiple parts...

trying to use iLogic to update the same parameter in multiple parts...

matthew_neesley
Collaborator Collaborator
260 Views
1 Reply
Message 1 of 2

trying to use iLogic to update the same parameter in multiple parts...

matthew_neesley
Collaborator
Collaborator

I am trying to update the same named parameter in several existing parts in an assembly.  I'm using this code:

 

'Define the open document
Dim openDoc As Document
openDoc = ThisDoc.Document

InventorVb.DocumentUpdate()

'Look at all of the files referenced in the open document
Dim docFile As Document
For Each docFile In openDoc.AllReferencedDocuments                
'format  file name                   
Dim FNamePos As Long
FNamePos = InStrRev(docFile.FullFileName, "\", -1)                        
Dim docFName As String 
docFName = Right(docFile.FullFileName, Len(docFile.FullFileName) - FNamePos) 
Parameter.Quiet = True
Parameter(docFName, "Smart_Height") = 1000
Next

The absolutely MADDENING thing is that it seems to be working in complete reverse.  NONE of my existing parts in the assembly change.  The parameter ONLY changes in any NEW part I add AFTER running the rule.  Keee-rypes, what is going on here?

0 Likes
261 Views
1 Reply
Reply (1)
Message 2 of 2

Sergio.D.Suárez
Mentor
Mentor

Hi, Try this rule from the assembly.

Dim openDoc As AssemblyDocument
openDoc = ThisDoc.Document

Dim e_1 As Double
e_1 = InputBox("Use decimal separator comma", "Change Smart Height", "1000") / 10

For Each doc As Document In openDoc.AllReferencedDocuments
	If doc.DocumentType<>Inventor.DocumentTypeEnum.kAssemblyDocumentObject  Then
	On Error Resume Next
	doc.ComponentDefinition.Parameters("Smart_Height").Value = e_1
	End If
Next

Parameter.UpdateAfterChange = True
iLogicVb.UpdateWhenDone = True


I hope it is useful for you. regards 


Please accept as solution and give likes if applicable.

I am attaching my Upwork profile for specific queries.

Sergio Daniel Suarez
Mechanical Designer

| Upwork Profile | LinkedIn

0 Likes