Set part number through saving with ilogic rule
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello all,
Lets get right to the problem. In inventor we use a lot of structural shapes from the content center. Our problem is that the part number and file name are not the same when generating a new structural member. This leads to problems in our Bill of Materials. For instance: we never use the length in the file name because this can change a lot of times before production starts.
For this I tried to use a simple rule that runs everytime the document is saved.
iProperties.Value("Project", "Part Number") = ThisDoc.FileName
But when saving a large assembly that has a lot of updated parts and assemblies that are not checked out from the vault we get a lot of errors because these have the "read only" status. Now I wanted to try some options I found on the forum where the status of the file is used to check if a part/assembly is checked out. That way I would only run when making a new part or if it is checked out from the vault.
Dim d As Inventor.Document = ThisDoc.Document
Dim fio As New System.IO.FileInfo(d.FullDocumentName)
If fio.IsReadOnly = False Then
iProperties.Value("Project", "Part Number") = ThisDoc.FileName
Else
'YOUR CODE IF THE FILE IS CHECKED NOT OUT
End If
This is to where I got. But it still throws some errors trying to save parts/assemblies which have not been checked out. Any help would be great.