Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MintJulep on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

CATIA Script to Change Ratio 1

Status
Not open for further replies.

jmarkus

Mechanical
Joined
Jul 11, 2001
Messages
377
Location
CA
Looking at thread560-344218, it deals with the font size and name for text on a drawing.

I would like to change the font name and ratio for all items (text, dimensions, balloons, labels, GD&T, etc). I tried text.SetFontRatio, but it didn't appear to be a proper function. I also can't figure out how to select everything with fonts (ie. not just text items).

Can someone point me in the right direction?

Thanks,
Jeff
 
Hi Jeff

This is a workaround for a part of your problem, posted by me on COE. I believe you can modify according to your needs.

Code:
Language="VBSCRIPT"
Sub CATMain()

Dim drawingTexts1 As DrawingTexts
Dim drawingText1 As DrawingText
Dim Textbezeichnung As String

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

drawingText1.Name = "Temporary_text"

Set drawingDocument1 = CATIA.ActiveDocument
Set selection1 = drawingDocument1.Selection
selection1.Search "CATDrwSearch.DrwDimension,all"
CATIA.StartCommand "Copy Object Format"

Set selecttodelete= drawingDocument1.Selection
selecttodelete.Search "CATDrwSearch.DrwText.Name=Temporary_text,all"

selecttodelete.delete

End Sub

Regards
Fernando

 
Thanks Ferdo, I understand that I can use SetFontSize and SetFontName, how do I control the text ratio (aspect ratio of the font, e.g. 75% vs 100%, etc).

If there a CATScript function to do so?

Jeff
 
Thanks Ferdo. That is what I was looking for!

Thanks again,
Jeff
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top