Message 1 of 4
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
Can somebody check/clarify the comments I have added to this rule?
I know what is this code doing but Try - Catch block confuses me...
Tom
'Define opened document as this document Dim openDoc As Document openDoc = ThisDoc.Document 'Define file as document Dim docFile As Document 'opened document needs to be assembly in order for code to work If openDoc.DocumentType = 12291 Then 'for each file that exist in opened assembly For Each docFile In openDoc.AllReferencedDocuments 'if file is not Read Only If docFile.IsModifiable = True Then 'Get the quantity of the file/component currently being looked in the assembly Dim qty As Integer = openDoc.ComponentDefinition.Occurrences.AllReferencedOccurrences(docFile).Count 'Get the value in the iProperties of the component under the tab "Project" -> "Part Number" 'What is Item("Design Tracking Properties") ?? Is that the way to define "Project" tab in iProperties Dim oPartnumber As String = docFile.PropertySets.Item("Design Tracking Properties").Item("Part Number").Value 'Define oProp as Inventor property Dim oProp As Inventor.Property Try 'Item("Inventor User Defined Properties") -> Custom iProperties of assembly? oProp = openDoc.PropertySets.Item("Inventor User Defined Properties").Item(oPartnumber) 'What is happening here?
oProp.Value = oProp.Value + qty Catch
'Add oPartnumber and it's qty into Custom iProperties of assembly oProp = openDoc.PropertySets.Item("Inventor User Defined Properties").Add(qty, oPartnumber) End Try End If Next Else MessageBox.Show("!", "Message",MessageBoxButtons.OK,MessageBoxIcon.Exclamation) End If
Solved! Go to Solution.