' http://www.danielhansen.net/2014/06/how-to-format-code-and-syntax.html
First post, of what may be many more, or it could simply be the last, only time will tell.
When using text containing characters with features which hung below the bottom, lower case "g" or lower case "q" or in this instance the forward slash "/". The text would shift up in the sketch. The sketch was fully constrained and the single line text was bottom justified.
WHAT WE HAD....
WHAT WE WANTED....
THE SOLUTION...
We posted a query on the
Autodesk Inventor forums asking for assistance and within the hour we had a
solution. Set the text justification to baseline, not bottom justification.
Another solution would have been to simply have had the vertical alignment of the text set to center justification.
The justification configuration was the last piece in the puzzle of the drawing template. We are going to attempt to keep the number of sheets to a minimum, but we currently can have up to eight sheets in a single file.
We are using multiple custom iProperties to populate the title blocks of the various sheets along with an iLogic form to assist in filling out the sheets with the proper client information.
Lastly, there is some iLogic code to push the proper sketch symbols for the client and state onto the eight sheets.
'CODE STARTS HERE:
Option Explicit
Sub Main()
Dim sheetprop As String
Dim iNumSheets as Integer
Dim oDoc as DrawingDocument
oDoc = ThisApplication.ActiveDocument
Dim oSheet As sheet
Dim iSheetCount As Integer
Dim i As Integer
Dim j As Integer
' Number of sheets requested in the control panel form
iNumSheets = iProperties.Value("Custom", "SHEET_NUMBER")
' MsgBox("iNumSheets = " & iNumSheets, vbOKOnly,"Number of Sheets")
j = 1
For Each oSheet In odoc.sheets
sheetprop = "SHEET_"&Trim(Str(j))
oSheet.Name = iProperties.Value("Custom", sheetprop)
If j > iNumSheets And j <=8 Then ' Set the sheet flag to false
'MsgBox("Sheet Number = " & j, vbOKOnly,"Number of Sheets")
Parameter(sheetprop & "_CHK") = False
Else
If j > 1 Then
Parameter(sheetprop & "_CHK") = True
End If
End If
j = j + 1
Next
' Open up the Control Panel
iLogicForm.Show("DRAWING CONTROL PANEL", FormMode.NonModal)
iLogicVb.UpdateWhenDone = True
' Setup the COA number
Dim strState As String = STATE_BORDER 'STATE_BORDER IS A PARAMETER...
Dim strCoaNum as String
Select Case strState
.
.
.
.
Case Else
strCoaNum = "NONE"
End Select
'Push value into the custom iproperty so it can be dropped into symbol
iProperties.Value("Custom", "STATE_COA") = strCoaNum'STATE_COANUMBER
iProperties.Value("Custom", "STATE") = STATE_BORDER
'RuleParametersOutput()
Dim sLogo As String
Select Case CLIENT
Case Else
sLogo = "BLANK"
End Select
' MessageBox.Show ( CLIENT & " - " & sLogo,"Client Selected")
' Update the client logo
'MsgBox ("Logo selected: "& sLogo)
If sLogo <> "BLANK" Then Call logoChk(sLogo)
' Set the printer and page size
Dim oPrintMgr As DrawingPrintManager
oPrintMgr = oDoc.PrintManager
With oPrintMgr
.AllColorsAsBlack = False
.ColorMode = 13314 ' Print using a gray scale
.ScaleMode = 13827 ' kPrintCustomScale
.PaperSize = PaperSizeEnum.kPaperSize11x17
End With
End Sub
Sub logoChk(sketchAdd As String)
' Code utilizes the last four characters of the symbol name
' to see if the symbol is a logo. Therefore only use 'LOGO'
' at the end of the symbol name.
' Insertion point for the current logo and title block (1/22/15)
Dim logopt As Point2D = ThisApplication.TransientGeometry.Createpoint2d(70.1675,7.62)
'logopt.x = 70.1675
'logopt.y = 7.62
Dim oDrawDoc as DrawingDocument
oDrawDoc = ThisApplication.ActiveDocument
Dim oSymDef As SketchedSymbolDefinition
'MsgBox ("Logo Name = " & sketchAdd)
oSymDef = oDrawDoc.SketchedSymbolDefinitions.Item(sketchAdd)
' MsgBox("Symbol Definition : " & oSymDef.Name)
Dim oSym as SketchedSymbol
' Dim oSheet As oDrawDoc.Sheet
Dim bLogoFound As Boolean = False
Dim insPt2D As Point2D
For Each oSheet In oDrawdoc.sheets
'MsgBox ("Sheet Number :"& oSheet.Name)
For Each oSym in oSheet.SketchedSymbols
If Right(oSym.Name,4) = "LOGO" Then
' now we check to see if the logo file matches the
' client selected.
' need to have a flag to let the program know
' that a logo was found and replaced or not
' MsgBox ("Sheet Number: "&"-"&sketchAdd)
If oSym.Name <> sketchAdd Then
'MsgBox ("Sheet Number:"& oSheet.Name &" - " & oSym.Name &" Check Me.")
' Get the insertion point
insPt2D = oSym.Position
' We delete the current definition...
oSym.Delete
'...and replace, with a rotation angle of 0 and a scale of 1
oSym = oSheet.SketchedSymbols.Add(oSymDef,insPt2D,0,1,)
'MsgBox ("Insertion Point : " & insPt2D.x & "-" & insPt2D.y)
bLogoFound = True ' Set flag to True
Else
blogofound = True
End If
End If
Next
If bLogoFound = False Then ' Currently no logo on the sheet
' we need to insert a logo into the
' proper location
'MsgBox ("Logo to be added : " & sketchAdd)
oSym = oSheet.SketchedSymbols.Add(oSymDef,logopt,0,1,)
bLogoFound = False ' Reset flag
End If
Next
' Housekeeping:
' Close any expanded nodes on the browswer
Call CloseTree
End Sub
Sub CloseTree()
'-----start of ilogic-----
'sort components in the browser
'ThisApplication.CommandManager.ControlDefinitions.Item _
'("AssemblyBonusTools_AlphaSortComponentsCmd").Execute
'set a reference to the document
Dim oDoc As Document
oDoc = ThisApplication.ActiveDocument
'Set a reference to the top node of the active browser
Dim oTopNode As BrowserNode
oTopNode = oDoc.BrowserPanes.ActivePane.TopNode
Dim oNode As BrowserNode
For Each oNode In oTopNode.BrowserNodes
' If the node is visible and expanded, collapse it.
If oNode.Visible = True And oNode.Expanded = True Then
oNode.Expanded = False
End If
Next
'zoom all
'ThisApplication.ActiveView.Fit
End Sub