Replace Styles and Standards in a drawing using iLogic

Replace Styles and Standards in a drawing using iLogic

MSt-Louis
Contributor Contributor
1,868 Views
3 Replies
Message 1 of 4

Replace Styles and Standards in a drawing using iLogic

MSt-Louis
Contributor
Contributor

I'm looking for a solution which is to replace all styles and standards in a drawing like Dimensions Styles, Layers Styles etc... by new ones. Using iLogic.

 

The idea is to use an old drawing that was made for an old customer and run a code that will 'REPLACE' all the old styles with new styles that will meet the new customer's requirements.

 

I know they are few posts on that subject but I don't like the solutions proposed. Specifically when it comes to replace Dimension Styles. The codes I found, always browse in a drawing sheet and gets all the dimensions in it and changes individually the actual style by a new one. But if you do so, you loose all modifications made to a specific dimension. E.g. changes made on the amount of digits.

 

What I'm looking is a code that will go in the Style Manager and literally REPLACE a style by another style. As it is possible to do manually.

 

MStLouis_1-1644450310834.png

 

MStLouis_2-1644450351994.png

 

Is this available in Inventor API?

 

Thanks.

0 Likes
1,869 Views
3 Replies
Replies (3)
Message 2 of 4

theo.bot
Collaborator
Collaborator

when you access the drawingstylesmanager you can use replacestyles it available since inventor R2021.

Inventor 2022 Help | DrawingStylesManager.ReplaceStyles Method | Autodesk

 

here is a sample rule to update styles from a template. By replacing the object defaults style, it will update all object in the drawing where the style is set "by standard".

Message 3 of 4

MSt-Louis
Contributor
Contributor

Thank you theo.bot for you explanations. The are very useful.
I think you understood exactly what I was looking for. But I am using R2019 so I don’t have access to ReplaceStyles Method. No wonder why I couldn't find it.
Fortunately, my IT told me that we would get R2021 somewhere in March 2022. I'll be able to test the code you provided at that time. I'll keep you in touch.

Once again, thank you.

0 Likes
Message 4 of 4

KB6AWRA
Participant
Participant

Hello, did this solution work? Or is it possible to do so without using iLogic?

 

0 Likes