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
Solved! Go to Solution.
Solved by Ralf_Krieg. Go to Solution.
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?
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.
This is the value from the master template and global style:
And this is the value for the same style from the document I tried to update, still showing the old value:
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
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.