Hello together,
how could I change all text-fonts from ISOCP to ISOCPEUR for all text-elemts in the drawing (in the frame, title etc.)?
Thank you very much
Georg
Solved! Go to Solution.
Solved by Vladimir.Ananyev. Go to Solution.
Texts are represented by TextBox objects. You may change TextBox.Style.Font property or override font using TextBox.FormattedText propery value. If text belongs to Border, Title block or sketched symbol you have to edit corresponding definition: BorderDefinition, SketchedSymbolDefinition or TitleBlockDefinition objects. There are several VBA samples in API help (e.g., CreateSketchedSymbolDefinition, CreateTitleBlockDefinition).
Open drawing and run the following sample. It will dump information about texts in current title block and the change font type and size for Author field.
Sub OverrideTextFont () Dim oDoc As DrawingDocument Set oDoc = ThisApplication.ActiveDocument Dim oSheet As Sheet Set oSheet = oDoc.ActiveSheet Dim oTB As TitleBlock Set oTB = oSheet.TitleBlock Dim oTBDef As TitleBlockDefinition Set oTBDef = oTB.Definition Dim oSketch As DrawingSketch Set oSketch = oTBDef.Sketch 'dump texts in this title block Dim oTextBox As TextBox Dim i As Integer For i = 1 To oSketch.TextBoxes.Count Set oTextBox = oSketch.TextBoxes.Item(i) Debug.Print i, oTextBox.Text Debug.Print i, oTextBox.FormattedText Debug.Print oTextBox.Style.Name Debug.Print Next ' change formatted text for box #9 ('Author' in my case) ' override font family and size Call oTBDef.Edit(oSketch) ' enter edit mode Set oTextBox = oSketch.TextBoxes.Item(9) ' text value is derived from to iPropertyc "Author" oTextBox.FormattedText = "<StyleOverride Font='Chiller' FontSize='1'><Property Document='drawing' PropertySet='Inventor Summary Information' Property='Author' FormatID='{F29F85E0-4FF9-1068-AB91-08002B27B3D9}' PropertyID='4'>AUTHOR</Property></StyleOverride>" Call oTBDef.ExitEdit(True) ' exit edit mode Beep End Sub
Hope this could help you to develop your own procedure.
Cheers,