×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

CATIA Script to Change Ratio

CATIA Script to Change Ratio

CATIA Script to Change Ratio

(OP)
Looking at thread560-344218: How to change the Dimension Text 's Font Size and Name through macro, 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

RE: CATIA Script to Change Ratio

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 --> CATScript

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

https://picasaweb.google.com/102257836106335725208
https://picasaweb.google.com/103462806772634246699...

RE: CATIA Script to Change Ratio

(OP)
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

RE: CATIA Script to Change Ratio

(OP)
Thanks Ferdo. That is what I was looking for!

Thanks again,
Jeff

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources