How to update the style libary through the API

How to update the style libary through the API

davidt162003
Advocate Advocate
312 Views
4 Replies
Message 1 of 5

How to update the style libary through the API

davidt162003
Advocate
Advocate

So im nearing completion of a project where my users will run Inventor through a external UI. As part of the initial setup I need to add in the Drawing template which is fine but it has a different style library. I know how to get users to do this through the UI but Ideally I want the whole setup to be automated. I

s their a way to do this through the API? I tried looking through the documentation but nothing stood out.   

davidt162003_0-1719830587821.pngFor those unaware I'm talking about the "save" under then styles and standards section which pushes the styles in the document to the style library. 

 

HII
0 Likes
313 Views
4 Replies
Replies (4)
Message 2 of 5

daltonNYAW9
Advocate
Advocate

Does this work? Dont want to test it on my machine haha

Dim oDDoc As DrawingDocument = ThisDoc.Document

oDDoc.StylesManager.ActiveStandardStyle.SaveToGlobal()
0 Likes
Message 3 of 5

davidt162003
Advocate
Advocate
Hmm it might do, I think for now were going to get the users to do it for now as were on crunch to release but Ill try adding that in after initial testing.
HII
0 Likes
Message 4 of 5

davidt162003
Advocate
Advocate
@daltonNYAW9 Im struggling to think how best to use it. Currently the setup steps I have are
1. Copy template from shared drive, move it to “C:\Users\Public\Documents\Autodesk\Inventor 2022\Templates\en-US”
2. create a new project setting the style libary to "Read-Write"
3. open up the template and click save,

I think I know how to do 1 and 3, but its step 2 I'm struggling with
HII
0 Likes
Message 5 of 5

daltonNYAW9
Advocate
Advocate

You could create the project with ilogic. Don't have too much experience programming w/ inventor external to the cilent's ui.

Sub Main()
    ' Set a reference to the DesignProjectManager object.
    Dim oDesignProjectMgr As DesignProjectManager = ThisApplication.DesignProjectManager

    ' Create a new singler user project
    Dim oProject As DesignProject = oDesignProjectMgr.DesignProjects.Add(kSingleUserMode, "MyProject", "C:\temp\")
	
	oProject.StylesLibraryAccess = StylesLibraryAccessEnum.kReadWriteStylesLibraryAccess
End Sub