AnsweredAssumed Answered

Change Drawing Text from Bold to Regular?

Question asked by Patrick Malone on Oct 16, 2015
Latest reply on Oct 20, 2015 by Patrick Malone

Upfront I will state this, limited programming knowledge.

I've done some auto lisp (Autocad) programming so

I understand some programming concepts.

VBA/API are new waters that I am stepping into so it won't take much to exceed my knowledge base at this point.

 

I am starting off by recorded macro...

Here is what I have.

 

' ******************************************************************************

' macro recorded on 10/16/15

' ******************************************************************************

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.Extension.SelectByID2("Sheet2", "SHEET", 0.838669660377358, 0.44465719245283, 0, False, 0, Nothing, 0)

Part.EditTemplate

Part.EditSketch

Part.ClearSelection2 True

boolstatus = Part.Extension.SelectByID2("DetailItem2219@Sheet Format12", "NOTE", 0.703758615709871, 3.44084042712842E-02, 0, False, 0, Nothing, 0)

boolstatus = Part.Extension.SelectByID2("DetailItem2217@Sheet Format12", "NOTE", 0.728801374375636, 3.47156773837475E-02, 0, True, 0, Nothing, 0)

boolstatus = Part.Extension.SelectByID2("DetailItem2176@Sheet Format12", "NOTE", 0.759682322178205, 3.37938580463574E-02, 0, True, 0, Nothing, 0)

boolstatus = Part.Extension.SelectByID2("DetailItem2221@Sheet Format12", "NOTE", 0.826360587582757, 3.42547677150525E-02, 0, True, 0, Nothing, 0)

boolstatus = Part.Extension.SelectByID2("DetailItem2216@Sheet Format12", "NOTE", 0.708367712396822, 2.35002087788344E-02, 0, False, 0, Nothing, 0)

boolstatus = Part.Extension.SelectByID2("DetailItem2175@Sheet Format12", "NOTE", 0.797784188123663, 2.61120302347731E-02, 0, False, 0, Nothing, 0)

boolstatus = Part.Extension.SelectByID2("DetailItem2216@Sheet Format12", "NOTE", 0.73279592483766, 2.48829377849196E-02, 0, True, 0, Nothing, 0)

boolstatus = Part.Extension.SelectByID2("DetailItem2220@Sheet Format12", "NOTE", 0.829740591819854, 2.54974840098463E-02, 0, True, 0, Nothing, 0)

boolstatus = Part.Extension.SelectByID2("DetailItem2229@Sheet Format12", "NOTE", 0.708674985509285, 1.55111078547867E-02, 0, False, 0, Nothing, 0)

boolstatus = Part.Extension.SelectByID2("DetailItem2226@Sheet Format12", "NOTE", 0.750003219135609, 1.55111078547867E-02, 0, True, 0, Nothing, 0)

boolstatus = Part.Extension.SelectByID2("DetailItem2228@Sheet Format12", "NOTE", 0.738941387086927, 1.50501981860916E-02, 0, True, 0, Nothing, 0)

boolstatus = Part.Extension.SelectByID2("DetailItem2227@Sheet Format12", "NOTE", 0.783035078725421, 0.015357471298555, 0, True, 0, Nothing, 0)

boolstatus = Part.Extension.SelectByID2("DetailItem2222@Sheet Format12", "NOTE", 0.795326003223956, 1.52038347423233E-02, 0, True, 0, Nothing, 0)

boolstatus = Part.Extension.SelectByID2("DetailItem2223@Sheet Format12", "NOTE", 0.808538747059881, 1.61256540797134E-02, 0, True, 0, Nothing, 0)

boolstatus = Part.Extension.SelectByID2("DetailItem2225@Sheet Format12", "NOTE", 0.818371486658709, 1.42820154049332E-02, 0, True, 0, Nothing, 0)

boolstatus = Part.Extension.SelectByID2("DetailItem2224@Sheet Format12", "NOTE", 0.829433318707391, 1.50501981860916E-02, 0, True, 0, Nothing, 0)

boolstatus = Part.Extension.SelectByID2("DetailItem84@Sheet Format12", "NOTE", 0.741287052720168, 0.551920199589513, 0, False, 0, Nothing, 0)

boolstatus = Part.Extension.SelectByID2("DetailItem85@Sheet Format12", "NOTE", 0.721665405361847, 0.552279132163141, 0, True, 0, Nothing, 0)

boolstatus = Part.Extension.SelectByID2("DetailItem83@Sheet Format12", "NOTE", 0.659330781741816, 0.552159487971932, 0, True, 0, Nothing, 0)

boolstatus = Part.Extension.SelectByID2("DetailItem86@Sheet Format12", "NOTE", 0.687686455058414, 0.549527315765328, 0, False, 0, Nothing, 0)

boolstatus = Part.Extension.SelectByID2("DetailItem88@Sheet Format12", "NOTE", 0.730279787128915, 0.548689806426863, 0, True, 0, Nothing, 0)

boolstatus = Part.Extension.SelectByID2("DetailItem88@Sheet Format12", "NOTE", 0.745953176177329, 0.548689806426863, 0, True, 0, Nothing, 0)

Part.EditSheet

Part.EditSketch

Part.ClearSelection2 True

Part.ViewZoomtofit2

End Sub

 

 

It appears to touch these objects but it does not change any of them.

Nothing in the code suggests any property change (specifically to Regular)

 

I selected several similar text objects, went to the Note properties, picked Font,

on the Choose Font dialog I only changed the text style from Bold to Regular.

 

Selected several more similar text objects, repeat...

Selected several more similar text objects, repeat....

 

This was at least 5 different "selection sets"

 

in each drawing sheet the text items are in the same placement.

 

Having to correct some legacy drawings and this would save quite a bit of time...

 

 

I am not sure where to start

 

= = = =

Here are the same steps with just fewer objects in case it makes it easier to assist me..

 

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.Extension.SelectByID2("Sheet2", "SHEET", 0.751470654740781, 1.51601575968275E-02, 0, False, 0, Nothing, 0)

Part.EditTemplate

Part.EditSketch

Part.ClearSelection2 True

boolstatus = Part.Extension.SelectByID2("DetailItem2229@Sheet Format12", "NOTE", 0.707642546161755, 1.54023018431205E-02, 0, False, 0, Nothing, 0)

boolstatus = Part.Extension.SelectByID2("DetailItem2226@Sheet Format12", "NOTE", 0.74808063529268, 1.54023018431205E-02, 0, True, 0, Nothing, 0)

boolstatus = Part.Extension.SelectByID2("DetailItem2222@Sheet Format12", "NOTE", 0.794088042088343, 1.54023018431205E-02, 0, True, 0, Nothing, 0)

Part.EditSheet

Part.EditSketch

Part.ClearSelection2 True

Part.ViewZoomtofit2

End Sub

Outcomes