Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ilogic function to update local styles to match Style Library

4 REPLIES 4
Reply
Message 1 of 5
waynehelley
2850 Views, 4 Replies

ilogic function to update local styles to match Style Library

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
4 REPLIES 4
Message 2 of 5

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. 

Message 3 of 5

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
Message 4 of 5
waynehelley
in reply to: waynehelley

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
Message 5 of 5

Hi,

 

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report