06-11-2020
12:31 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
06-11-2020
12:31 PM
Here you go ![]()
Sub Main Dim asm As AssemblyDocument = ThisDoc.Document copyParams(asm) iLogicVb.UpdateWhenDone = True End Sub Sub copyParams(oAsm As AssemblyDocument) For Each oDoc As Document In oAsm.ReferencedDocuments If oAsm.ComponentDefinition.Occurrences.AllReferencedOccurrences(oDoc).Count > 0 If oDoc.DocumentType = DocumentTypeEnum.kPartDocumentObject Dim oDef As PartComponentDefinition = oDoc.ComponentDefinition For Each oParam As Inventor.Parameter In oAsm.ComponentDefinition.Parameters.UserParameters Dim paramInPart As Inventor.Parameter Try paramInPart = oDef.Parameters.UserParameters.Item(oParam.Name) Try paramInPart.Expression = oParam.Expression Catch paramInPart.Value = oParam.Value End Try Catch Try oDef.Parameters.UserParameters.AddByExpression(oParam.Name, oParam.Expression, oParam.Units) Catch oDef.Parameters.UserParameters.AddByValue(oParam.Name, oParam.Expression, oParam.Units) End Try End Try Next ElseIf oDoc.DocumentType = DocumentTypeEnum.kAssemblyDocumentObject 'if the referenced document is an assembly 'the sub will call itself with that document as the argument copyParams(oDoc) End If End If Next End Sub
Jhoel Forshav
Download my free Inventor Addin - Hole Projector
LinkedIn | Ideas | Contributions | Blog posts | Website