- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Does anyone have a working example of renaming a document (I'm working on regular f3d documents, if it makes a difference) through the API?
Both 'dataFile' and 'document' list name as a read/write field, but I'm not having any effect setting it. Setting dataFile.name doesn't appear to do anything. Setting document.name changes the name as it appears in the browser/tree view, but that change is reset when I save the document (I don't just mean that the change isn't saved, but rather when you click save the name actually switches back in the browser/tree view).
For what it's worth, I've tried both renaming the data file when it was closed:
app = adsk.core.Application.get() projs = app.data.dataProjects testProj = [proj for proj in projs if proj.name == 'Test'][0] dfs = testProj.rootFolder.dataFiles mod1df = [df for df in dfs if df.name == 'mod1'][0] mod1df.name = mod1df.name + '_REV'
and renaming the document and/or data file when it is open:
app = adsk.core.Application.get() mydoc= app.documents.item(0) mydoc.name = mydoc.name + '_REV' mydoc.dataFile.name = mydoc.dataFile.name + '_REV'
Thanks for your suggestions.
Pete
Solved! Go to Solution.