Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

import Style ".styxml" file using VBA

dibujocad
Enthusiast

import Style ".styxml" file using VBA

dibujocad
Enthusiast
Enthusiast

Hi everybody, I exported my drawing style in a .styxml file, and I'd like to know if it's possible to import it through a VBA macro.

I know that it's possible to import it to an active drawing through the style manager manually. However, I have to import this style file in a huge amount of drawing files, so doing this process manually is not an option for me.

 

I've read some posts in this forum about this topic, but it's not still clear for me whether it's possible or not.

Reply
1,002 Views
4 Replies
Replies (4)

theo.bot
Collaborator
Collaborator

Like you have read in older posts, there is no option to import the styxml file. But in most cases it's not needed. You should use the Style library. So save you new style to the style library. Then when you open older files you can use your new style. When your access the style manager using the api, you can find the style and use the function "Converttolocal" to include the style in your drawing.

When you already have objects in your drawing that needs use the new style you need to change the style for these objects.

dibujocad
Enthusiast
Enthusiast

Thanks Theo for your advise.

I explain you better my problem because I'm not sure if your recommended solution could be possible in my case.

I' m trying to write this macro for the company where I work. The company doesn't work with style library, because the Design Data folder is the default one stored in each computer.

If I'm right, the style file was exported and then it was imported into the template files. In this way, everytime a drawing is created from a template, it contains the updated style.

So, I guess the style is stored in each drawing.

I was thinking and maybe an idea could be:

1-Make changes in style and then export it to .styxml file

2-Import the new .styxml file to template files

3-Copy active standard style from template file to an old drawing.

I'm a bit beginner working with styles in inventor, so I'm not totally sure if it could work.

0 Likes

theo.bot
Collaborator
Collaborator

My best advise will be start using the style library. Multiple engineers are using the same template as well i asume. During inventor configuration, you should always use a custom style library ( design data) and templates. I would also think that changing styles won't happen that often. Many companies are setting up a template and over time There will be minor changes in styles. The manual import process is much quicker that creating a macro or rule.

 

lohithna
Enthusiast
Enthusiast

hI DID YOU GOT SOLUTION FOR THIS I AM ALSO LOOKING FOR THE SAME