- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
update iPART part number as filename
Hi everyone, I have used this line of code for consistent Part Numbers when saving files:
iProperties.Value("Project", "Part Number")= ThisDoc.FileName
as suggest by autodesk itself: https://knowledge.autodesk.com/support/inventor/learn-explore/caas/sfdcarticles/sfdcarticles/How-to-...
The problem is when I use this rule in an iPart it breaks the part Number because of Index.
Is there an easy fix to this code?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Can you explain where you need the filename changed? Is the iPart factory in a library or in your workspace folder? The iPart member name or partnumber can be set in the iPart factory table. No ilogic should be needed. If you can supply some more information with images etc the answer can correctly target your request.
Or if this helped you, please, click (like)
Regards
Alan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
@A.Acheson I want to prevent others from changing the filename without changing the iProperties partnumber, this worked as the link suggested "How to update iProperties Part Number so that it always reflect the current file name". the exception is when i try saving an iPart.
There is nothing much to say besides repeating the article steps. Then follow this steps from your Part:
Save as filename.ipt > Manage > Create iPart > insert Row
Now the child PartNumber is filename-01, filename-02.
Run article's Rule0 (iProperties.Value("Project", "Part Number")= ThisDoc.FileName)
Now the child PartNumber is "filename" and not "filename-01".
if you try to change the iPart child in the Table, this is the prompt:
I work aroud the Rule0 to check if is iPart then it will not override the PartNumber:
oPartDoc = ThisApplication.ActiveDocument If oPartDoc.ComponentDefinition.IsiPartFactory _ Or oPartDoc.ComponentDefinition.IsiPartMember Then 'Basically I want this Else iProperties.Value("Project", "Part Number") = ThisDoc.FileName End If
I want that commented line of code that considers Indexes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Perhaps a simple solution is to have the file name column as the part number column instead of the normal method where the member column dictates the filename.
From what I hear the i factory is a writable file and not stored in a library.
Here is the API help for the iPart factory.
Or if this helped you, please, click (like)
Regards
Alan