How to change the Dimension Text 's Font Size and Name through macro
How to change the Dimension Text 's Font Size and Name through macro
(OP)
Hi,
Could some body let me know how to change the drawing dimension text font size and name.
Thanks in advance,
Maddy
Could some body let me know how to change the drawing dimension text font size and name.
Thanks in advance,
Maddy





RE: How to change the Dimension Text 's Font Size and Name through macro
CODE --> CATScript
Regards
Fernando
https://picasaweb.google.com/102257836106335725208
https://picasaweb.google.com/103462806772634246699...
RE: How to change the Dimension Text 's Font Size and Name through macro
CODE --> CATScript
' Purpose: Macro will change text in an active CATIA drawing according to your inputs ' Usage: 1 - A CATDrawing must be active with some dimensions on it ' 2 - Run macro ' Author: ferdo (Disclaimer: You use this code at your own risk) ' ====================================================== Sub CATMain() Set drawingDocument1 = CATIA.ActiveDocument Set Sheets = drawingDocument1.Sheets Set activeSheet = Sheets.ActiveSheet Set views = activeSheet.Views Dim myFontSize As Double myFontSize = "10" myFontSize = InputBox ("Please enter a font size.", "Enter Font Size", myFontSize) Dim myFontName As Double myFontName = "Courier" myFontName = InputBox ("Please enter a font name.", "Enter Font Name", myFontName) For i=1 to views.Count if i <> 2 then Set view = views.Item(i) Set texts = view.Texts For j=1 to texts.Count Set text = texts.Item(j) text.SetFontSize 0,0,myFontSize text.SetFontName 0,0, "myFontName" Next End if Next End SubRegards
Fernando
https://picasaweb.google.com/102257836106335725208
https://picasaweb.google.com/103462806772634246699...
RE: How to change the Dimension Text 's Font Size and Name through macro
I'll try to loop through as you said above.
Still one doubt and thought to get the same clarified.
Do the text in dimension should be considered as a text and accessed separately?
I tried to do this but didn't succeeded.
For dc = 1 To oDims.Count ' Dimension loop
Set oMyDimension = oDims.Item(dc)
Set oDimText = oMyDimension.GetValue
oDimText.SetFontName 0, 0, "Courrier 10 BT"
oDimText.SetFontSize 0, 0, 10
Next
Regards,
Maddy
RE: How to change the Dimension Text 's Font Size and Name through macro
Regards
Fernando
https://picasaweb.google.com/102257836106335725208
https://picasaweb.google.com/103462806772634246699...
RE: How to change the Dimension Text 's Font Size and Name through macro
But while doing so i'm not getting any dimension text displayed at all.
RE: How to change the Dimension Text 's Font Size and Name through macro
CODE --> CATScript
Regards
Fernando
https://picasaweb.google.com/102257836106335725208
https://picasaweb.google.com/103462806772634246699...
RE: How to change the Dimension Text 's Font Size and Name through macro
Exactly, That's what i want to change the height and name.
RE: How to change the Dimension Text 's Font Size and Name through macro
Could you please help me on this.
Regards,
Maddy
RE: How to change the Dimension Text 's Font Size and Name through macro
I'm afraid there is no solution for what you want (sorry for misunderstanding in the beginning of the thread). If you will put the code from last CATScript in catvba and use the "watch" for Dimension, you will see there is no reference for FontName or FontSize.
Many things are not exposed in drafting workbench for common automation...and I'm afraid this is one of them.
Regards
Fernando
https://picasaweb.google.com/102257836106335725208
https://picasaweb.google.com/103462806772634246699...