Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

drafting dimension

Status
Not open for further replies.

yanabunana

Mechanical
Aug 1, 2019
6
0
0
PH
I'm looking for a macro to change the font size on a dimension.

Can you please help us. Thanks. :)
 
Replies continue below

Recommended for you

Code:
Dim myFontSize As Double
myFontSize = "6.5"
Dim myFontName As Double
myFontName = "SSS1"

set drawingtexts1 = catia.activedocument.sheets.activesheet.views.activeview.texts

Text_string = "Temporary text" 

Set drawingText1 = drawingTexts1.Add(Text_string, 100, 100)
drawingText1.Text = Text_string

drawingText1.SetFontSize 0,0,myFontSize
drawingText1.SetFontName 0,0, myFontName

Regards
Fernando

- Romania
- EU
 
Thank you for responding on my inquiry..

But I was looking for macro to change the font size of all existing dimension.
For example, existing dimensions on my drawing are 3.5, but I want to automatically change them all to font size 4.

The current script that I am using is not working. Please see below.
Hoping you can help me on it.
More power and thank you.



Sub CATMain()

Set drawingDocument1 = CATIA.ActiveDocument
Set Sheets = drawingDocument1.Sheets
Set ActiveSheet = Sheets.ActiveSheet
Set Views = ActiveSheet.Views

For i = 1 To Views.Count
If i <> 2 Then
Set View = Views.Item(i)
Set Texts = View.Dimensions
For j = 1 To Dimensions.Count
Set Dimension = Dimensions.Item(j)
Dimension.SetFontSize 0, 0, 4
Next
End If
Next
 
You don't need a macro to change the size of all dimensions. Instead use Edit + Search to find and select all dimensions, After they are highlighted, just change the size.
 
Status
Not open for further replies.
Back
Top