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: 

Import Style Definitions to Drawing

7 REPLIES 7
Reply
Message 1 of 8
gerhick
2093 Views, 7 Replies

Import Style Definitions to Drawing

Hi all,

 

Does anyone know of a way to automate the import of Style Definition files into the style and standard manager in the drawing environment? If not is there some other way to do it?

 

I've had a good look at using VBA, but i can't see anything that would appear to help.

 

Cheers

___________________________________________
Gerrard Hickson
Inventor CAD Administrator || Autodesk Inventor 2012 Certified Professional
Autodesk AutoCAD 2012 Certified Professional|| Bachelor of Technology (Mechanical)

PointZero Design and Drafting
7 REPLIES 7
Message 2 of 8
Mike.Wohletz
in reply to: gerhick

I am not sure if this is what you are looking for at all, but it will update the current styles to match what is in the styles manager. If you are looking for something other than this please give a little more detail on what you are importing the styles from etc. This is what I have as VB.NETcode

 

 

    Public Sub Update_Styles()
        If ThisApplication.ActiveDocumentType = _
        DocumentTypeEnum.kDrawingDocumentObject Then
            Dim oDwg As DrawingDocument = ThisApplication.ActiveDocument
            For Each oStyle As Style In oDwg.StylesManager.Styles
                If Not oStyle.UpToDate Then ' do not update what is up-to-date!
                    oStyle.UpdateFromGlobal() ' udate the style
                End If
            Next
        End If
    End Sub

 

Message 3 of 8
gerhick
in reply to: Mike.Wohletz

Mike,

 

Thanks for the suggestion, unfortunately it's not what I'm after, and I had to make some changes to get it to work on my system (shown below for reference of others).

 

    Public Sub Update_Styles()
        If ThisApplication.ActiveDocumentType = _
        DocumentTypeEnum.kDrawingDocumentObject Then
            Dim oDwg As DrawingDocument = ThisApplication.ActiveDocument
            For Each oStyle As Style In oDwg.StylesManager.Styles
                If Not oStyle.UpToDate Then ' do not update what is up-to-date!
                    oStyle.UpdateFromGlobal() ' udate the style
                End If
            Next
        End If
    End Sub

 

What I'm trying to do is import from a .styxml file... see image below for description via piccy.

 

 145iADE36B9AF004F50E

 

 

Hope this helps.

 

Thanks again for the assistance so far.

 

Regards

 

Gerrard

___________________________________________
Gerrard Hickson
Inventor CAD Administrator || Autodesk Inventor 2012 Certified Professional
Autodesk AutoCAD 2012 Certified Professional|| Bachelor of Technology (Mechanical)

PointZero Design and Drafting
Message 4 of 8
Mike.Wohletz
in reply to: gerhick

Gerrard

I could not help but notice that the styles library is read only in your project from the picture in your post, perhaps this is something that you want, but if you go to the project and change the "Use Styles Library" from read only to yes and then after you have finished add the style that you have imported to the library with the save button you will then be able to simplify the operation by either the code I provided or with the update button on the other file that need the same data added to them. This will also automatically add the styles to any new documents created.

 

Message 5 of 8
gerhick
in reply to: Mike.Wohletz

Mike,

 

Thanks for pointing that out, but our stlye library is 'read only' for a reason. We have an office of 20+ designers each required to output drawings to strict company standards, allowing designers to make changes to the style library has in the past cost time and money in revising drawings to meet standards.

 

We're not having any troubles manually importing the .styxml file into a single .idw, and the action of importing automatically updates, so there's no problem there. The problem is importing it into several .idw files, that is hugely tedious.

 

Cheers

___________________________________________
Gerrard Hickson
Inventor CAD Administrator || Autodesk Inventor 2012 Certified Professional
Autodesk AutoCAD 2012 Certified Professional|| Bachelor of Technology (Mechanical)

PointZero Design and Drafting
Message 6 of 8
gerhick
in reply to: gerhick

Hi all,

 

Still keen to find a solution to this problem.

 

Anyone have any suggestions?


Regards

___________________________________________
Gerrard Hickson
Inventor CAD Administrator || Autodesk Inventor 2012 Certified Professional
Autodesk AutoCAD 2012 Certified Professional|| Bachelor of Technology (Mechanical)

PointZero Design and Drafting
Message 7 of 8
gerrard.hickson
in reply to: gerhick

Hi all,

 

Just reviving this query... Any suggestions on how to go about it?

 

Thanks

Message 8 of 8
Mike.Wohletz
in reply to: gerhick

As far as I know importing styles from styxml files is not possible in the current API. 

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

Post to forums  

Autodesk Design & Make Report