ds-blue-logo
Preview  |  SOLIDWORKS USER FORUM
Use your SOLIDWORKS ID or 3DEXPERIENCE ID to log in.
BRBrian Roby27/12/2010

Hi all,

I am trying to figure out a macro that will allow me to change the font size for all Revision notes on a selected drawing.

I have worked out how to iterate through all the appropriate notes on a drawing but not how to change the font in each note.

i.e. if the Note is one character long and is surrounded by a triangle, then change the font size to x.xxmm

I have tried recording a macro to see what is being captured but it appears that there is an error in the recording.

This is the code that was recorded...

Dim swApp As Object
Dim Part As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Sub main()
Set swApp = _
Application.SldWorks
Set Part = swApp.ActiveDoc
boolstatus = Part.ActivateView("Drawing View1")
boolstatus = Part.Extension.SelectByID2("DetailItem91@Drawing View1", "NOTE", 0.1658965339045, 0.1668846303502, 0, False, 0, Nothing, 0)
boolstatus = Part.Extension.SelectByID2("DetailItem91@Drawing View1", "NOTE", 0.1658965339045, 0.1668846303502, 0, False, 0, Nothing, 0)
Part.FontUnits 5mm
Part.ClearSelection2 True
End Sub

the code line: "Part.FontUnits 5mm" shows up in red within the programming environment...

Looking up the help file is seems to indicate that the code is correct, but...?

Removing either the 5 or "mm" from the line allows the code to run but with no effect on the selected "Note".

I know how to change the font on a global scale, but in this instance I want to only change the font within single character "Revision" numbers in the drawing.

Can anyone help?

Thanks in advance.

Brian.