Message 1 of 2
offseting a polyline

Not applicable
02-20-2015
01:02 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi i have this code that allows me to draw a box and then create a polyline from it. I then want it to offset I can get it to work but the when i enter the offset distance it seems to offset the line arbitrarily. Its never the distance i provide.
Private Sub CommandButton1_Click() UserForm2.Hide Dim pi As Double Dim pt1(0 To 2) As Double Dim pt2 As Variant Dim pt3 As Variant Dim pt4 As Variant 'With ThisDrawing '.SendCommand ("select " & "all ") '.SendCommand ("erase ") 'End With pi = 3.14159265358979 pt1(0) = 0#: pt1(1) = 0#: pt1(2) = 0# With ThisDrawing.Utility pt2 = .PolarPoint(pt1, 0, Val(TextBox1.Text)) pt3 = .PolarPoint(pt2, pi / 2, Val(TextBox2.Text)) pt4 = .PolarPoint(pt1, pi / 2, Val(TextBox2.Text)) End With With ThisDrawing.ModelSpace .AddLine pt1, pt4 .AddLine pt4, pt3 .AddLine pt3, pt2 .AddLine pt2, pt1 End With 'ThisDrawing.ModelSpace.AddCircle pt1, Val(TextBox2.Text) / 2 peditAll offSet Unload Me End Sub Private Sub peditAll() ThisDrawing.SendCommand ("PEDIT " & "multiple " & "all " & "yes " & "join " & "close ") End Sub Private Sub CommandButton2_Click() Unload Me End Sub Private Sub offSet() ' Dim dist As String dist = TextBox3.Value & " " ThisDrawing.SendCommand ("select " & "all ") ThisDrawing.SendCommand ("offset " & "t " & dist & " ") End Sub
as you can see it is a userform and the user puts in length and width and offset distance. If there is a better way to do an offset in this fashion I'm all ears.
Thanks for any help