• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    Autodesk Inventor Customization

    Reply
    Valued Mentor
    jdkriek
    Posts: 263
    Registered: ‎03-29-2007
    Accepted Solution

    Change DimStyle to Active Standard

    485 Views, 12 Replies
    06-20-2012 10:38 AM

    Wanted to post this hoping others will find it useful. Works for most versions of Inventor.

     

    Changes all dimensions, balloons, ect (define more if you want) to current object default in active standard.

     

    Try it out, let me know if it works well for you.

     

    Sub ChangeDimStyle()
    'J.Kriek 2012
        Dim oApp As Application
        Dim oIdw As DrawingDocument
        Dim oDim As DrawingDimension
        Dim oBalloon As Balloon
        Dim oDimStyle As DrawingStandardStyle
        Dim oSheet As Sheet
        Set oApp = ThisApplication
        Set oIdw = oApp.ActiveDocument
        
        Set oDimStyle = oIdw.StylesManager.ActiveStandardStyle
        For Each oSheet In oIdw.Sheets
            For Each oDim In oSheet.DrawingDimensions
                    'Add more Styles here
                    If oDim.Style.Name <> oDimStyle.ActiveObjectDefaults.LinearDimensionStyle.Name Then
                        oDim.Style = oDimStyle.ActiveObjectDefaults.LinearDimensionStyle
                    End If
                    If oDim.Style.Name <> oDimStyle.ActiveObjectDefaults.AngularDimensionStyle.Name Then
                        oDim.Style = oDimStyle.ActiveObjectDefaults.AngularDimensionStyle
                    End If
                    If oDim.Style.Name <> oDimStyle.ActiveObjectDefaults.ChamferNoteStyle.Name Then
                        oDim.Style = oDimStyle.ActiveObjectDefaults.ChamferNoteStyle
                    End If
                    If oDim.Style.Name <> oDimStyle.ActiveObjectDefaults.DiameterDimensionStyle.Name Then
                        oDim.Style = oDimStyle.ActiveObjectDefaults.DiameterDimensionStyle
                    End If
                    If oDim.Style.Name <> oDimStyle.ActiveObjectDefaults.LeaderTextStyle.Name Then
                        oDim.Style = oDimStyle.ActiveObjectDefaults.LeaderTextStyle
                    End If
                    If oDim.Style.Name <> oDimStyle.ActiveObjectDefaults.BendNoteStyle.Name Then
                        oDim.Style = oDimStyle.ActiveObjectDefaults.BendNoteStyle
                    End If
            Next
            For Each oBalloon In oSheet.Balloons
                    If oBalloon.Style.Name <> oDimStyle.ActiveObjectDefaults.BalloonStyle.Name Then
                        oBalloon.Style = oDimStyle.ActiveObjectDefaults.BalloonStyle
                    End If
            Next
       Next
    End Sub

     

    Jonathan D. Kriek
    Inventor Applications Engineer
    Autodesk Inventor Certified Expert
    Microsoft Certified Application Developer
    _____________________________________________________
    Did I help you? Please choose Accept as Solution or Kudos below
    Please use plain text.
    Valued Contributor
    jonbrabbs
    Posts: 76
    Registered: ‎07-26-2007

    Re: Change DimStyle to Active Standard

    09-06-2012 03:13 AM in reply to: jdkriek

    Very nice. I've been trying to create something similiar for a couple of hours now. Thanks for the share, it's much appreciated.

     

    Jon Brabbs

    ///////////////////////////////////////////////////////////////////////////////////////////////////
    If this post helps you, please give kudos.
    \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
    Please use plain text.
    Valued Mentor
    jdkriek
    Posts: 263
    Registered: ‎03-29-2007

    Re: Change DimStyle to Active Standard

    09-06-2012 06:14 AM in reply to: jonbrabbs

    Glad it was useful to you =)

    Jonathan D. Kriek
    Inventor Applications Engineer
    Autodesk Inventor Certified Expert
    Microsoft Certified Application Developer
    _____________________________________________________
    Did I help you? Please choose Accept as Solution or Kudos below
    Please use plain text.
    Member
    Posts: 5
    Registered: ‎10-18-2012

    Re: Change DimStyle to Active Standard

    10-18-2012 03:05 AM in reply to: jdkriek

    Hi

     

    How do I use this rule in Inventor 2012 64bit. I am unfamiliar with I-logic, but this seems ideal for what I'm wanting to achieve. Any sort of help is welcome. Thanks

    A

    Please use plain text.
    Valued Mentor
    jdkriek
    Posts: 263
    Registered: ‎03-29-2007

    Re: Change DimStyle to Active Standard

    10-18-2012 12:12 PM in reply to: axplosif

    This is VBA (Visual Basic for Applications). It can be rewritten in iLogic fairly easy (essentially VB.NET)

     

    Or you could use as is, simply go to Tools > VBA Editor > Paste it into a Module. 

     

    Then from iLogic you could run with 

     

    InventorVb.RunMacro("projectName", "moduleName", "macroName")

     

    Or simply run it manually by adding it as a button. Right-click on toolbar > Customize User Commands > Change Drop-down to Macros > Select Macro > Click Add > Then Ok.

    Jonathan D. Kriek
    Inventor Applications Engineer
    Autodesk Inventor Certified Expert
    Microsoft Certified Application Developer
    _____________________________________________________
    Did I help you? Please choose Accept as Solution or Kudos below
    Please use plain text.
    Member
    Posts: 5
    Registered: ‎10-18-2012

    Re: Change DimStyle to Active Standard

    10-19-2012 03:38 AM in reply to: jdkriek

    I appreciate your Help on this. I'm trying to get this to work, but may need some pointers.

     

    I have some old Legacy drawings which I'm trying to bring up to date by applying the current standard’s Layers & Styles. My drawings are from 2003 and are typically using a local style called ANSI. I am looking to convert all Layers and styles to a new Active Standard called Default Standard (ISO). Presently, I am manually replacing all local styles within the Style Editor, but this is a long and tedious process and I have to do this for every drawing. Really, it’s something I should be automating.

     

    For example, I wish to change all Linear, Diameter, Angular dimensions to  Layer - Default Standard (ISO) and Style - Dimension ISO.

     

    If you can point me in the right direction I’ll figure out how to do the rest of the layers such as Centerlines, Symbols, Annotations etc. I take it these will all have some sort of tag that I’ll need to find out in order to input them into the snippet, or do I just use the layer and style names within the angle brackets <> ?

     

    Thanks again

    Please use plain text.
    Valued Mentor
    jdkriek
    Posts: 263
    Registered: ‎03-29-2007

    Re: Change DimStyle to Active Standard

    10-19-2012 04:53 AM in reply to: axplosif

    Few questons first. Are you using the Style Library Manager (outside Inventor) for global styles? Is Default Standard (ISO) a global standard? Are Dimension ISO, ect setup as the Object Defaults for that standard?

     

    This script will make sure all the elements specificed on the drawing get updated to the active standard. And yes they do have specific "tags" as you call them. Some even have diffrent methods in order to access them. It would be a proccess of letting me know which elements in addition to what's already here you need and me showing you that method.

    Jonathan D. Kriek
    Inventor Applications Engineer
    Autodesk Inventor Certified Expert
    Microsoft Certified Application Developer
    _____________________________________________________
    Did I help you? Please choose Accept as Solution or Kudos below
    Please use plain text.
    Member
    Posts: 5
    Registered: ‎10-18-2012

    Re: Change DimStyle to Active Standard

    10-19-2012 07:51 AM in reply to: jdkriek

    Yes, I am using a Style Library Manager (which reads styles from an external folder), and the Standard I use is a modified Global ISO standard (mostly using Imperial units instead of Metric; 3rd Angle etc.). The object defaults have been set up for this.

     

    If you like, I can show you a typical legacy drawing, as well as an up-to-date drawing with the layers applied by the Standard from the Style Library. This way you can see the styles that I am needing changed, and may, hopefully, be able to offer some advice.

     

    I tend to carry out 'Drawing Resource Transfer Wizard' first, so that Drawing Border, Title block and Symbols can be transferred before I start replacing the Styles. 

    Please use plain text.
    Valued Mentor
    jdkriek
    Posts: 263
    Registered: ‎03-29-2007

    Re: Change DimStyle to Active Standard

    10-19-2012 09:33 AM in reply to: axplosif

    Ok, so when you go to Tools > Document Settings > Your Style is listed as the active standard?

     

    If so, then script will work fine. We have the ability to change every elemenet on the drawing, including section and view labels, but not everyone needs those updated.

     

    Just let me know what you need help with.

    Jonathan D. Kriek
    Inventor Applications Engineer
    Autodesk Inventor Certified Expert
    Microsoft Certified Application Developer
    _____________________________________________________
    Did I help you? Please choose Accept as Solution or Kudos below
    Please use plain text.
    Member
    Posts: 5
    Registered: ‎10-18-2012

    Re: Change DimStyle to Active Standard

    10-22-2012 06:22 AM in reply to: jdkriek

    My style is the active standard, so yes, I am hoping to apply styles to the following:

     

    Dimension; Text; Tables; Revision Table; Table.

     

    Most of these use custom styles names that are no longer in the Active Standard i.e' COMPANY ANSI'; 'Table_COMPANY ANSI' etc. I wish to change these to 'Default (Imperial)' for example, which is now the Active Standard for the Styles.

     

    I have attached a list of all the Object Types, i'd like to include in the Macro.

    My question then would be where to find/identify the 'tags' and write them into the snippet?

    Please use plain text.