Inventor Customization

Inventor Customization

Reply
Mentor
gerhick
Posts: 180
Registered: ‎04-10-2008
Message 1 of 8 (999 Views)

Import Style Definitions to Drawing

999 Views, 7 Replies
08-02-2010 04:07 PM

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
Valued Mentor
Mike.Wohletz
Posts: 375
Registered: ‎07-29-2008
Message 2 of 8 (981 Views)

Re: Import Style Definitions to Drawing

08-03-2010 06:40 PM 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

 

Mentor
gerhick
Posts: 180
Registered: ‎04-10-2008
Message 3 of 8 (977 Views)

Re: Import Style Definitions to Drawing

08-03-2010 07:12 PM 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
Valued Mentor
Mike.Wohletz
Posts: 375
Registered: ‎07-29-2008
Message 4 of 8 (961 Views)

Re: Import Style Definitions to Drawing

08-04-2010 05:46 AM 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.

 

Mentor
gerhick
Posts: 180
Registered: ‎04-10-2008
Message 5 of 8 (952 Views)

Re: Import Style Definitions to Drawing

08-04-2010 02:32 PM 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
Mentor
gerhick
Posts: 180
Registered: ‎04-10-2008
Message 6 of 8 (866 Views)

Re: Import Style Definitions to Drawing

09-26-2010 11:05 PM 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
Active Contributor
gerrard.hickson
Posts: 27
Registered: ‎11-08-2011
Message 7 of 8 (491 Views)

Re: Import Style Definitions to Drawing

02-05-2012 07:13 PM in reply to: gerhick

Hi all,

 

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

 

Thanks

Valued Mentor
Mike.Wohletz
Posts: 375
Registered: ‎07-29-2008
Message 8 of 8 (487 Views)

Re: Import Style Definitions to Drawing

02-05-2012 08:32 PM in reply to: gerhick

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

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.