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.LinearDimensionStyl
e.Name Then oDim.Style = oDimStyle.ActiveObjectDefaults.LinearDimensionStyl e End If If oDim.Style.Name <> oDimStyle.ActiveObjectDefaults.AngularDimensionSty le.Name Then oDim.Style = oDimStyle.ActiveObjectDefaults.AngularDimensionSty le End If If oDim.Style.Name <> oDimStyle.ActiveObjectDefaults.ChamferNoteStyle.Na me Then oDim.Style = oDimStyle.ActiveObjectDefaults.ChamferNoteStyle End If If oDim.Style.Name <> oDimStyle.ActiveObjectDefaults.DiameterDimensionSt yle.Name Then oDim.Style = oDimStyle.ActiveObjectDefaults.DiameterDimensionSt yle End If If oDim.Style.Name <> oDimStyle.ActiveObjectDefaults.LeaderTextStyle.Nam e 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
Solved! Go to Solution.
Very nice. I've been trying to create something similiar for a couple of hours now. Thanks for the share, it's much appreciated.
Glad it was useful to you =)
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
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.
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 <> ?
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.
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.
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.
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?
Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register
Start with some of our most frequented solutions to get help installing your software.