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: 

Update Default Width in Document Parts List Style From Library

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
lroberts8VWSJ
466 Views, 5 Replies

Update Default Width in Document Parts List Style From Library

The below is not updating the default width of the columns in the parts list style to what the library has. What do I need to add to get that to work? Also since we exclusively use custom styles, are there any ways to skip the default ones? Inventor 2022.2.2 VB.NET API

Dim prtListStyleEnum As PartsListStylesEnumerator = dwg.StylesManager.PartsListStyles
For Each style As Inventor.PartsListStyle In prtListStyleEnum
    Debug.WriteLine(style.Name & " was found in part list styles")
    If style.StyleLocation = Inventor.StyleLocationEnum.kBothStyleLocation AndAlso style.UpToDate = False Then
        style.UpdateFromGlobal()
        Debug.WriteLine(style.Name & "was found to be out of date. Now updated")
    End If
Next

 

5 REPLIES 5
Message 2 of 6
Ralf_Krieg
in reply to: lroberts8VWSJ

Hello

 

Update works as expected. Do you mean your already placed partslists are not updated? This behavior is as designed. You need to reassign the partslist style to your partslist. I did not found a way to do this direct, only assign any other style and assign the original style again.

 

What means skip default ones?


R. Krieg
RKW Solutions GmbH
www.rkw-solutions.com
Message 3 of 6
lroberts8VWSJ
in reply to: Ralf_Krieg

No, I mean I updated the default width of the column to 3.5 from 2.5 using the master template and the following code:

 

For Each stdStyle As DrawingStandardStyle In dwgDoc.StylesManager.StandardStyles
    If stdStyle.UpToDate = False Then
        stdStyle.SaveToGlobal()
    End If
Next

 

After running the code I mentioned before on an existing document, I checked the local style for the parts list, and the style width in the document remained 2.5. Placing a new parts list didn't result in the new width for the column, either, so just switching to and from won't do it. I also ran in debug and the UpToDate flag was True, even though the widths in the local and global styles were different.

 

As far as skipping the default ones, I mean the preloaded styles that are called default. We don't use them and they shouldn't change since they're static standards, so I don't want to have the code try to update them if I don't have to.

lroberts8VWSJ_2-1649075356408.png

 

 

Message 4 of 6

This is the value from the master template and global style:

lroberts8VWSJ_0-1649075628059.png

 

And this is the value for the same style from the document I tried to update, still showing the old value:

lroberts8VWSJ_2-1649075787294.png

 

Message 5 of 6
Ralf_Krieg
in reply to: lroberts8VWSJ

Hello

 

You are aware that a StandardStyle and a Style are two different things?

For Each Style As Inventor.Style In dwgDoc.StylesManager.Styles
    If Style.UpToDate = False Then
        Style.SaveToGlobal()
    End If
Next

 


R. Krieg
RKW Solutions GmbH
www.rkw-solutions.com
Message 6 of 6
lroberts8VWSJ
in reply to: Ralf_Krieg

I am aware of that. I have the document update code doing each level in turn. Apparently I forgot to add those layers to the code that pushes the information from the master template to global.

 

I knew it was probably something silly. Thank you.

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

Post to forums  

Autodesk Design & Make Report