Extract text from sketched symbol

Extract text from sketched symbol

Anonymous
Not applicable
438 Views
1 Reply
Message 1 of 2

Extract text from sketched symbol

Anonymous
Not applicable
I am using Inventor 2008 and am trying to extract text from a sketched symbol. I have found the last Revision Block in the database using this code:

Dim oLastRevBox As SketchedSymbol

Dim oSketchedSymb As SketchedSymbol

lNumSymb = oSheet.SketchedSymbols.Count
For i = 1 To lNumSymb
Set oSketchedSymb = oSheet.SketchedSymbols.Item(i)
If oSketchedSymb.Definition.Name = "Rev Block" Then
dInsXPos = oSketchedSymb.Position.X 'find location for insertion of next rev. block
dYPos = oSketchedSymb.Position.Y
dInsYPos = dYPos - 0.254
Set oLastRevBox = oSketchedSymb 'get last rev. block
End If
If oSketchedSymb.Definition.Name = "Rev Block 2" Then
dInsXPos = oSketchedSymb.Position.X 'find location for insertion of next rev. block
dYPos = oSketchedSymb.Position.Y
dInsYPos = dYPos - 0.254 * 2
Set oLastRevBox = oSketchedSymb 'get last rev. block
End If
Next

Now that I have the last revision block, I want to extract the text from that sketched symbol:

If oLastRevBox.Definition.Name = "Rev Block" Then
'Get text from oLastRevBox
End If

If oLastRevBox.Definition.Name = "Rev Block 2" Then
'Get text from oLastRevBox
End If

The text field are called "Rev Level", "Rev Description", "Rev Date", "Rev By", and "Rev Approved". The fields are the same, but I have two different symbols and the formatting of the text is slightly different.

Thanks,
Tim
0 Likes
439 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable
I found it:

{code}
For Each oTextBox In oLastRevBox.Definition.Sketch.TextBoxes
Select Case oTextBox.Text
Case "Rev Level"
tbNewRev.Value = oLastRevBox.GetResultText(oTextBox)
Case "Rev Description"
tbRevCom.Value = oLastRevBox.GetResultText(oTextBox)
Case "Rev Date"
tbRevDate.Value = oLastRevBox.GetResultText(oTextBox)
Case "Rev By"
tbRevBy.Value = oLastRevBox.GetResultText(oTextBox)
Case "Rev Approved"
tbAppBy.Value = oLastRevBox.GetResultText(oTextBox)
End Select
Next
{code}

Tim Edited by: trumph@wabtec.com on Oct 10, 2009 12:09 PM
0 Likes