Friday, September 5, 2014

iLogic - Dimension Text Scale

Issue:
You have some iLogic code to help you setup your drawing sheets and title block size (see this link from Jonathan Landeros for a great example of using iLogic to configure title block and borders). But when you change sheet to a larger size the dimension text is hard to read. You'd like to be able to adjust the dimension style text size as well.



Solution:
Here is a quick iLogic rule that prompts the user to set the text size. You could remove the user input lines, and just have the value set depending on the sheet size as well.



'set active document as drawing document
Dim oDoc As DrawingDocument
oDoc = ThisApplication.ActiveDocument

'get the active dim style
Dim oDStyle As DimensionStyle
oDStyle = oDoc.StylesManager.ActiveStandardStyle. _
ActiveObjectDefaults.LinearDimensionStyle

'get current font size
Dim sFontSize as String
sFontSize = oDStyle.TextStyle.FontSize

'get user input
oInput = InputBox("Active Dimesnion Style = " &  oDStyle.Name _
& vblf & vblf &  "Enter a new font size in inches." , "iLogic", _
Round(sFontSize / 2.54,3))

'set font size for dim style
oDStyle.TextStyle.FontSize = oInput * 2.54





Here is a related topic also:
http://inventortrenches.blogspot.com/2011/05/use-ilogic-to-change-sheet-orientation.html