Update all Styles of IPT file through API

Update all Styles of IPT file through API

MartinKunz
Contributor Contributor
802 Views
5 Replies
Message 1 of 6

Update all Styles of IPT file through API

MartinKunz
Contributor
Contributor

Hello

I'm currently working on a tool that updates elements of drawing files (Borders, Titleblocks etc.) and purges unused local Styles of the drawings. The customer asked me whether it would be possible to extend the functionality and also update the styles of their IPT (both regular IPT and sheetmetal) files.

 

Unlike the Inventor.DrawingDocument, the Inventor.PartDocument doesn't have a StylesManager (Inventor.DrawingStylesManager) to iterate over all the Styles.

 

I can individually iterate the items in the .Materials, .RenderStyles and .LightingStyles collections of the Inventor.DrawingDocument and also the .SheetMetalStyles of the Inventor.SheetMetalComponentDefinition (if the IPT is actually a sheet metal part). 

 

But the Update Styles dialog in the Manage ribbon can also contain objects that don't seem belong to any of those categories (see example image below).

 

Is there any way to update all Styles of an IPT through the API?

 

I'm aware that it's technically possible to simulate a click on the Ribbon Button to open the built in dialog. But I'd then also have to simulate a click on the OK button afterwards. That would be messy, but could work - but the function is supposed to be part of a larger batch processing program that will handle many different files in sequence, so a more robust solution is required.

 

2019-03-12_15-58-20.png

 

0 Likes
803 Views
5 Replies
Replies (5)
Message 2 of 6

bradeneuropeArthur
Mentor
Mentor

There is a tool within inventor called "Batch Update".

 

Batch update.JPG

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 3 of 6

MartinKunz
Contributor
Contributor

Thanks for the tip!

 

I took a look at the source code of that tool (when you install them, they also copy the source codes to the SDK folder).

 

It looks like the UpdateStyles command used by that tool does pretty much exactly what I explained in my first post. It  uses  the StylesManager collection to iterate all Style items for drawing files and handles the RenderStyles, Materials, LightingStyles of IPT (and SheetMetalStyles if the IPT is sheet metal) individually.

 

When I run that tool over Part files with other style types (like the one in the screenshot) it doesn't affect those styles at all.

 

So it looks like there is no API to update all the styles if the bonus tool provided by Autodesk also iterates the different Style collections that are specifically exposed to the API and doesn't handle other elements that don't belong to those categories.

Message 4 of 6

^_^clovis^_^
Advocate
Advocate

Hello,

 

I also would like also to update lots of Ipt with a local style different from the standard styles using a macro. One of the style I need to update is SurfaceTexture. Funny enough this style is define in : drawingDocument->DrawingStylesManager->SurfaceTextureStyles.

In the ipt there's a surfaceTexture :

partDocument -> ComponentDefinition->ModelAnnotations->modelSurfaceTextureSymbols

but nothing to update.

 

So how can I update the local surfaceTexture style in an ipt??

Thanks for any lead.

Yours