- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have ilogic rule which count quantity of parts based on file name, but sometimes happen that different file has the same part number and should be calculate as the same part. So how can I change my code to calculate parts quantity based on part number. Below is ilogic code which I'm using now.
Dim openDoc As Document openDoc = ThisDoc.Document Dim docFile As Document If openDoc.DocumentType = 12291 Then For Each docFile In openDoc.AllReferencedDocuments Dim FNamePos As Long Dim docFName As String FNamePos = InStrRev(docFile.FullFileName, "\", -1) docFName = Mid(docFile.FullFileName, FNamePos + 1, Len(docFile.FullFileName) - FNamePos) If docFile.IsModifiable = True Then Dim assemblyDoc As AssemblyDocument Dim assemblyDef As AssemblyComponentDefinition Dim partQty As ComponentOccurrencesEnumerator assemblyDoc = openDoc assemblyDef = assemblyDoc.ComponentDefinition partQty = assemblyDef.Occurrences.AllReferencedOccurrences(docFile) If IsNumeric(partQty.Count) = True Then If IsNumeric(iProperties.Value(docFName, "Custom", "szt/maszynę")) = False Then iProperties.Value(docFName, "Custom", "szt/maszynę") = 0 End If If partQty.Count <> iProperties.Value(docFName, "Custom", "szt/maszynę") Then iProperties.Value(docFName, "Custom", "szt/maszynę") = partQty.Count End If End If End If Next Else MessageBox.Show("Musisz otworzyć dokument głównego zespołu przed uruchomieniem tego skryptu!", "Niewłaściwy typ pliku!",MessageBoxButtons.OK,MessageBoxIcon.Exclamation) End If
Solved! Go to Solution.