AnsweredAssumed Answered

Controlling the width of an note in vb.net

Question asked by Chris Johnson on May 13, 2015

Here is a snippet of my code where Im inserting a note into SW. I cannot figure out how to control the max width on the annotation. can someone help me fill in the blanks?

everything else works perfectly but controlling the width eludes me............ by the way im writing this as a standalone exe in vb.net not vba.

 

 

   'Connect to SolidWorks

            Dim swApp As Object = CreateObject("sldworks.application")

            Dim swModel As ModelDoc2 = Nothing

            Dim swPart As PartDoc = Nothing

            Dim swDrawing As DrawingDoc = Nothing

            Dim swAssembly As AssemblyDoc = Nothing

            Dim boolstatus As Boolean = False

            Dim longstatus As Integer = 0

            Dim longwarnings As Integer = 0

            Dim myNote As Note = Nothing

            Dim myAnnotation As Annotation = Nothing

            Dim myTextFormat As TextFormat = Nothing

            swApp.visible(True)

            swModel = CType(swApp.ActiveDoc, ModelDoc2)

 

            If Not swModel Is Nothing Then

 

                'If model Type is drawing then...Insert Note

                If swModel.GetType = 3 Then

                    myNote = CType(swModel.InsertNote(Notes), Note)

                    myNote.Angle = 0

                    boolstatus = myNote.SetBalloon(0, 2)

                    myAnnotation = CType(myNote.GetAnnotation(), Annotation)

                    longstatus = myAnnotation.SetLeader3(CType(swLeaderStyle_e.swNO_LEADER, Integer), 0, True, False, False, False)

                    boolstatus = myAnnotation.SetPosition(0, 0, 0)

                    boolstatus = myAnnotation.SetTextFormat(0, True, myTextFormat)

                    boolstatus =myAnnotation.Width = 8 * 0.00254

 

thank you kindly for your help!

chris

Outcomes