Message 1 of 6
Updating Assembly with iLogic rule problems
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have an assembly that I have been working on and has been working fine so far through all the parts I have added until now. as soon as I add another part the Ilogic rule (that I got from the internet) doesn't work right. In the screencast I show how I add Pc# 12 and it gives me the error. its not just this part, its anything I try to add. Any help would be great. This is the link to a screencast I made of my problem. Screencast
Public Sub Main()
CopyUserParams()
End Sub
Private Sub CopyUserParams()
If ThisDoc.Document.DocumentType <> Inventor.DocumentTypeEnum.kAssemblyDocumentObject Then
MsgBox("The active document must be an assembly.")
Return
End If
Dim asmDoc As Inventor.AssemblyDocument = ThisDoc.Document
For Each refDoc As Inventor.Document In asmDoc.AllReferencedDocuments
' Look for part documents.
If refDoc.DocumentType = Inventor.DocumentTypeEnum.kPartDocumentObject Then
Dim partDoc As Inventor.PartDocument = refDoc
Dim refDocUserParams As UserParameters = partDoc.ComponentDefinition.Parameters.UserParameters
' Add the assembly parameters to the part.
For Each asmUserParam As UserParameter In asmDoc.ComponentDefinition.Parameters.UserParameters
' Check to see if the parameter already exists.
Dim checkParam As UserParameter = Nothing
Try
checkParam = refDocUserParams.Item(asmUserParam.Name)
Catch ex As Exception
checkParam = Nothing
End Try
If checkParam Is Nothing Then
' Create the missing parameter.
refDocUserParams.AddByExpression(asmUserParam.Name, asmUserParam.Expression, asmUserParam.Units)
Else
' Update the value of the existing parameter.
checkParam.Expression = asmUserParam.Expression
End If
Next
End If
Next
iLogicVb.UpdateWhenDone = True
End Sub