0% found this document useful (0 votes)
14 views

Add To - Frequently Used Subfolders - Collection - Manufacturing DevBlog

The document describes a workaround for adding frequently used subfolders in Autodesk Inventor projects. It explains that the relevant API does not currently work. It then provides a VBA code example for directly editing the project (.ipj) file, which is an XML file, to add a <Path> node specifying the subfolder.

Uploaded by

VitorHugo
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

Add To - Frequently Used Subfolders - Collection - Manufacturing DevBlog

The document describes a workaround for adding frequently used subfolders in Autodesk Inventor projects. It explains that the relevant API does not currently work. It then provides a VBA code example for directly editing the project (.ipj) file, which is an XML file, to add a <Path> node specifying the subfolder.

Uploaded by

VitorHugo
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Add to "Frequently Used Subfolders" collection - Manufacturing DevBlog http://adndevblog.typepad.com/manufacturing/2016/11/add-to-frequent...

Manufacturing DevBlog
(http://adndevblog.typepad.com
/manufacturing/)
The resource for software developers working with Design, Lifecycle and Simulation
technologies from Autodesk.

11/28/2016

Add to "Frequently Used Subfolders"


collection
By Adam Nagy (http://adndevblog.typepad.com/manufacturing
/adam-nagy.html) (@AdamTheNagy (https://twitter.com
/adamthenagy))
As mentioned in this (http://forums.autodesk.com/t5/inventorcustomization/add-user-path-to-projet-file/m-p/6493668) forum
post, unfortunately, the relevant API does not work :(
Until it gets sorted, you could use the following workaround: edit
directly the Project file (*.ipj), which is in fact an xml file.
The <Path> needs to starts with "Workspace\" and then continue
with the path to the subfolder you want to add.
I'm showing how to do it in VBA, but .NET (also accessible from
iLogic) has similar support for xml editing. Just add a reference to
the "Microsoft XML, v6.0" library:

(http://adndevblog.typepad.com

1 de 6

20/01/2017 20:42

Add to "Frequently Used Subfolders" collection - Manufacturing DevBlog http://adndevblog.typepad.com/manufacturing/2016/11/add-to-frequent...

/.a/6a0167607c2431970b01b8d23ede74970c-popup)

2 de 6

20/01/2017 20:42

Add to "Frequently Used Subfolders" collection - Manufacturing DevBlog http://adndevblog.typepad.com/manufacturing/2016/11/add-to-frequent...

Sub AddFrequentlyUsedSubfolder()
Dim oProjectManager As DesignProjectManager
Set oProjectManager = ThisApplication.Design
ProjectManager
Dim oProject As DesignProject
Set oProject = oProjectManager.ActiveDesignP
roject
' Use 'Microsoft XML, v6.0'
Dim xmlDoc As DOMDocument60
Set xmlDoc = New DOMDocument60
xmlDoc.async = False
Dim strProjectPath As String
strProjectPath = oProject.FullFileName
' Load the project file (*.ipj)
Call xmlDoc.Load(strProjectPath)
' Select the node
Dim xmlProjectPaths As IXMLDOMNode
Call xmlDoc.setProperty("SelectionLanguage",
"XPath")
Set xmlProjectPaths = xmlDoc.selectSingleNod
e("/InventorProject/ProjectPaths")
' Add the new subfolder
' We need to add something like this:
' <ProjectPath pathtype="FrequentlyUsedFolde
r">
'
<PathName>MyFolder</PathName>
'
<Path>Workspace\MySubfolder</Path>
' </ProjectPath>
Dim xmlProjectPath As IXMLDOMNode
Set xmlProjectPath = xmlDoc.createNode(1, "P
rojectPath", "")
Dim xmlPathType As IXMLDOMAttribute
Set xmlPathType = xmlDoc.createAttribute("pa
thtype")
xmlPathType.value = "FrequentlyUsedFolder"
Call xmlProjectPath.Attributes.setNamedItem(
xmlPathType)

3 de 6

20/01/2017 20:42

Add to "Frequently Used Subfolders" collection - Manufacturing DevBlog http://adndevblog.typepad.com/manufacturing/2016/11/add-to-frequent...

Dim xmlPathName As IXMLDOMNode


Set xmlPathName = xmlDoc.createNode(1, "Path
Name", "")
xmlPathName.Text = "MyFolder"
Call xmlProjectPath.appendChild(xmlPathName)
Dim xmlPath As IXMLDOMNode
Set xmlPath = xmlDoc.createNode(1, "Path", "
")
xmlPath.Text = "Workspace\" + "MySubfolder"
Call xmlProjectPath.appendChild(xmlPath)
Call xmlProjectPaths.appendChild(xmlProjectP
ath)
' Make another project active so that we can
save the changes
Call oProjectManager.DesignProjects(1).Activ
ate(False)
' Save the changes
Call xmlDoc.Save(strProjectPath)
' Make our project active again
Call oProject.Activate(False)
End Sub

4 de 6

20/01/2017 20:42

Add to "Frequently Used Subfolders" collection - Manufacturing DevBlog http://adndevblog.typepad.com/manufacturing/2016/11/add-to-frequent...

(http://adndevblog.typepad.com
/.a/6a0167607c2431970b01b7c8b513dc970b-popup)

Posted at 11:29 AM in Adam Nagy (http://adndevblog.typepad.com/manufacturing


/adam-nagy/), Inventor (http://adndevblog.typepad.com/manufacturing
/inventor/) | Permalink (http://adndevblog.typepad.com/manufacturing/2016/11
/add-to-frequently-used-subfolders-collection.html)
(http://twitter.com/share?url=http%3A%2F
%2Fadndevblog.typepad.com%2Fmanufacturing%2F2016%2F11%2Faddto-frequently-used-subfolders-collection.html&text=Add%20to
%20%22Frequently%20Used%20Subfolders%22...)

(https://plus.google.com

/share?url=http://adndevblog.typepad.com/manufacturing/2016/11/add-tofrequently-used-subfolders-collection.html)
(http://www.facebook.com
/sharer.php?u=http%3A%2F
%2Fadndevblog.typepad.com%2Fmanufacturing%2F2016%2F11%2Faddto-frequently-used-subfolders-collection.html)

Comments
Comment below or sign in with
Typepad (http://www.typepad.com
/sitelogin?uri=http%3A%2F
%2Fadndevblog.typepad.com%2Fmanufacturing%2F2016%2F11%2Faddto-frequently-used-subfolders-collection.html&
fp=0a6450a82b0c18ea3ea2206fe00df700&view_uri=http%3A%2F
%2Fprofile.typepad.com%2F&via=blogside&post_uri=http:
//adndevblog.typepad.com/manufacturing/2016/11/add-to-frequentlyused-subfolders-collection.html)
Facebook (http://www.typepad.com
/sitelogin?uri=http%3A%2F
%2Fadndevblog.typepad.com%2Fmanufacturing%2F2016%2F11%2Faddto-frequently-used-subfolders-collection.html&
fp=0a6450a82b0c18ea3ea2206fe00df700&view_uri=http%3A%2F
%2Fprofile.typepad.com%2F&via=blogside&service=facebook&post_uri=http:
//adndevblog.typepad.com/manufacturing/2016/11/add-to-frequentlyused-subfolders-collection.html)
Twitter (http://www.typepad.com
/sitelogin?uri=http%3A%2F
%2Fadndevblog.typepad.com%2Fmanufacturing%2F2016%2F11%2Faddto-frequently-used-subfolders-collection.html&
fp=0a6450a82b0c18ea3ea2206fe00df700&view_uri=http%3A%2F
%2Fprofile.typepad.com%2F&via=blogside&service=twitter&post_uri=http:
//adndevblog.typepad.com/manufacturing/2016/11/add-to-frequentlyused-subfolders-collection.html)
Google+ (http://www.typepad.com
/sitelogin?uri=http%3A%2F
%2Fadndevblog.typepad.com%2Fmanufacturing%2F2016%2F11%2Faddto-frequently-used-subfolders-collection.html&
fp=0a6450a82b0c18ea3ea2206fe00df700&view_uri=http%3A%2F
%2Fprofile.typepad.com%2F&via=blogside&service=gplus&post_uri=http:
//adndevblog.typepad.com/manufacturing/2016/11/add-to-frequently-

5 de 6

20/01/2017 20:42

Add to "Frequently Used Subfolders" collection - Manufacturing DevBlog http://adndevblog.typepad.com/manufacturing/2016/11/add-to-frequent...

used-subfolders-collection.html) and more... (http://www.typepad.com


/sitelogin?uri=http%3A%2F
%2Fadndevblog.typepad.com%2Fmanufacturing%2F2016%2F11%2Faddto-frequently-used-subfolders-collection.html&
fp=0a6450a82b0c18ea3ea2206fe00df700&view_uri=http%3A%2F
%2Fprofile.typepad.com%2F&via=blogside&service=openid&post_uri=http:
//adndevblog.typepad.com/manufacturing/2016/11/add-to-frequentlyused-subfolders-collection.html)

(URLs automatically linked.)

Email address is not displayed with comment.

(http://www.typepad.com/)
Manufacturing DevBlog (http://adndevblog.typepad.com/manufacturing/)

6 de 6

20/01/2017 20:42

You might also like