ilogic function to update local styles to match Style Library

ilogic function to update local styles to match Style Library

waynehelley
Collaborator Collaborator
3,058 Views
4 Replies
Message 1 of 5

ilogic function to update local styles to match Style Library

waynehelley
Collaborator
Collaborator

Does anyone know of an ilogic function to update local styles to match Style Library?

 

I have a snippet of code that, on a drawings, deletes the current parts list (if one exists), then inserts a new parts list which I want to be up to date with the Style Library.

Wayne Helley
Inventor 2013 Certified Professional

Autodesk Inventor Professional 2023
Visual Studio 2022
Windows 10 Pro, 64-bit
3,059 Views
4 Replies
Replies (4)
Message 2 of 5

xiaodong_liang
Autodesk Support
Autodesk Support

Hi,

 

PartsList.Style is read/write. I think you can change it directly without deleting the partslist and adding it again. In addition, Style.UpdateFromGlobal can updates this style from the global repository. 

0 Likes
Message 3 of 5

waynehelley
Collaborator
Collaborator

I can run the following

 

Dim oDrawingDoc As DrawingDocument oDrawingDoc = ThisApplication.ActiveDocument   Dim oSheet As Sheet   oSheet = oDrawingDoc.ActiveSheet

Dim oPartsList As PartsList   oPartsList = oDrawingDoc.ActiveSheet.PartsLists.Item(1)     oPartsList.Style.UpdateFromGlobal

 

but my parts list does not update unless I delete it and reinsert it or select my parts list then click the drop down to change the style and reselect my 'By Standard' style. Is there a line of code I could use to automate the latter?

 

Something along the lines of...

 

oPartsList.Style.Change("By Standard (Parts List (ANSI))")

Wayne Helley
Inventor 2013 Certified Professional

Autodesk Inventor Professional 2023
Visual Studio 2022
Windows 10 Pro, 64-bit
0 Likes
Message 4 of 5

waynehelley
Collaborator
Collaborator

oPartsList.Style = oDrawDoc.StylesManager.PartsListStyles.Item("Parts List (ANSI)")

Wayne Helley
Inventor 2013 Certified Professional

Autodesk Inventor Professional 2023
Visual Studio 2022
Windows 10 Pro, 64-bit
0 Likes
Message 5 of 5

xiaodong_liang
Autodesk Support
Autodesk Support

Hi,

 

I still think this should work. Could you share a test demo file. Which property of PartsList you modified?

0 Likes