Update value of Title textbox

Update value of Title textbox

Anonymous
Not applicable
492 Views
2 Replies
Message 1 of 3

Update value of Title textbox

Anonymous
Not applicable

Hi:

First of all I apologize for my bad English.


I'm trying to adapt a code I've seen updated from the value of a TexBox of Title with the value of the scale of a view.

The problem is not as update the value of TexBox

 

 

Option Explicit

Public Sub escala()
Dim oDoc As DrawingDocument
Set oDoc = ThisApplication.ActiveDocument

Dim oSheet As Sheet
Set oSheet = oDoc.ActiveSheet

Dim oTitleBlockDef As TitleBlockDefinition
Set oTitleBlockDef = oSheet.TitleBlock.Definition

Dim oTextBox As TextBox


Dim bFound As Boolean

bFound = False
For Each oTextBox In oTitleBlockDef.Sketch.TextBoxes
If oTextBox.Text = "<ESCALA>" Then

Dim EscalaTitle As String
EscalaTitle = oSheet.DrawingViews.Item(1).ScaleString
'''ERROR
''' I want to pass the value of EscalaTitle to EscalaProp

Dim EscalaProp As TextBox
EscalaProp = oSheet.TitleBlock.SetPromptResultText(oTextBox, EscalaTitle)


'''ERROR



MsgBox "encontrado =block."

bFound = True

Exit For

End If
Next
If bFound Then
oSheet.Name = oSheet.TitleBlock.GetResultText(oTextBox)

MsgBox "Encontrado valor" & oTextBox.Text & oSheet.TitleBlock.GetResultText(oTextBox)
Else
MsgBox "Specified formatted text was not found in the title =block."
End If


End Sub

 

Thank in advance

 

0 Likes
493 Views
2 Replies
Replies (2)
Message 2 of 3

YuhanZhang
Autodesk
Autodesk

I test the code with Inventor 2011, and only one line has a trivial issue, that is:

 

 

oSheet.Name = oSheet.TitleBlock.GetResultText(oTextBox)

 

the line is gonna set the sheet name with a string like "1 : 1" which is not supported. Except this issue everything works fine.

 



If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.



Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.

0 Likes
Message 3 of 3

Anonymous
Not applicable

I really want to change is the value of a text prompt called <ESCALA> of the Title and enhance the value of the scale of the first view.

 

I am working with Inventor 2008

 

Thanks for everything

0 Likes