GetWidth method example

Private Sub GetWidth_Example()

     ' This example adds a polyline and determines its width.

     Dim myDoc As IntelliCAD.Document

     Dim myPline As IntelliCAD.LWPolyline

     Dim myPoints As points

     Dim pt As Point

     Set myDoc = ActiveDocument

     Set myPoints = Library.CreatePoints

     Set pt = Library.CreatePoint(1, 1, 0)

     myPoints.Add

     myPoints(myPoints.Count).x = pt.x

     myPoints(myPoints.Count).y = pt.y

     myPoints(myPoints.Count).z = pt.z

     Set pt = Library.CreatePoint(3, 3, 0)

     myPoints.Add

     myPoints(myPoints.Count).x = pt.x

     myPoints(myPoints.Count).y = pt.y

     myPoints(myPoints.Count).z = pt.z

     Set pt = Library.CreatePoint(7, 4, 0)

     myPoints.Add

     myPoints(myPoints.Count).x = pt.x

     myPoints(myPoints.Count).y = pt.y

     myPoints(myPoints.Count).z = pt.z

     Set myPline = ThisDocument.ModelSpace.AddLightWeightPolyline(myPoints)

     myPline.Update

     ThisDocument.ActiveViewport.ZoomExtents

     ' Find the width of the 2nd segment

     Dim sw As Double

     Dim ew As Double

     myPline.GetWidth 2, sw, ew

 

     MsgBox "The starting width for the second segment is " & sw, , "Get/SetWidth Example"

     

     ' Change the starting width of the 2nd segment

     myPline.SetWidth 2, 1.2, ew

     myPline.GetWidth 2, sw, ew

     myPline.Update

     MsgBox "The starting width for the second segment is now " & sw, , "Get/SetWidth Example"

End Sub