Hello,
I`m looking for the iLogic code that can change one parameter (user defined) for each (ipt) part in assembly (iam)
The one below doesn`t work. Any help is appreciated.
Sub Main Dim oApp As Inventor.Application = ThisApplication Dim oAssy As Inventor.AssemblyDocument = oApp.ActiveDocument For Each oSubDoc as Inventor.Document In oAssy.AllReferencedDocuments On Error Resume Next Parameter(oSubDoc, "FH") = 15.26 Next End Sub
Thanks,
Solved! Go to Solution.
Solved by Curtis_Waguespack. Go to Solution.
I think you can use it like below:
Parameter("Part1:1", "d0") = 1.2
Rocky,
That what I had in my code :
I thought it suppose to take every ipt in my iam as oSubDoc find the FH parameter and change it to 15.26.
Am I doing something wrong?
Parameter(oSubDoc, "FH") = 15.26
Hi achmidt,
Here are two examples that will work. The first looks at the occurences by name the second looks at the actual files by file name:
' set a reference to the assembly component definintion. ' This assumes an assembly document is open. Dim oAsmCompDef As AssemblyComponentDefinition oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition 'Iterate through all of the occurrences Dim oOccurrence As ComponentOccurrence For Each oOccurrence In oAsmCompDef.Occurrences 'check for and skip virtual components '(in case a virtual component trips things up) If Not TypeOf oOccurrence.Definition Is VirtualComponentDefinition Then Parameter.Quiet = True Parameter(oOccurrence.Name, "FH") = 15.26 InventorVb.DocumentUpdate() Else End If Next
'Define the open document
Dim openDoc As Document
openDoc = ThisDoc.Document
'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, "FH") = 15.26
InventorVb.DocumentUpdate()
Next
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
Hi Curtis 🙂
It's possible to put a try and catch in the rule to verify if parameter exist???
Thnaks for your help 🙂
is it possible to re write it to make all part numbers in sub assemblies and parts equal to filename minus extensions.
i've tried several different ilogic rules, posted different places, and none seems work, or i get a error.
i want the rule to run on assembly level, and not embeded in the part template.
Can't find what you're looking for? Ask the community or share your knowledge.