What is the easiest way to place text on a line and have it centered on the line and offset? Can the dimension function be used to place distances only on all lines without the dimenion lines. What about bearings on lines? Text centereed on arcs?
If I were to calculate the bearings and distances manually what sort of coding would I need this text to all lines in the drawing?
Thanks again.
Page 1 of 1
Centering Text
#2
Posted 26 May 2005 - 09:02 PM
Hi,
Here is an example about placing dimensions on all the lines of a drawing.
Here is an example about placing dimensions on all the lines of a drawing.
Option Explicit Dim oMath As cAvaxMath Private Sub Command1_Click() Dim h() As Long, vData() As Variant Dim iType() As AvaxItemType Dim vItemProperties() As Variant Dim xyz() As Single, lMax As Long, lCnt As Long Dim x1 As Single, y1 As Single, z1 As Single Dim x2 As Single, y2 As Single, z2 As Single Dim Angle As Single, xc As Single, yc As Single Dim xNew1 As Single, yNew1 As Single, Offset As Single Dim Distance As Single, z As Single, sDim As String Dim TextScale As Single, xNew As Single, yNew As Single Dim TextLength As Single Offset = 1 TextScale = 5 lMax = cAvax1.GetAllHandlesArr(h(), Line_i) If cAvax1.GetProperties(h(), iType(), vItemProperties(), vData()) = True Then For lCnt = 1 To lMax If iType(lCnt) = Line_i Then xyz() = vData(lCnt) 'Get the coordinates x1 = xyz(1) y1 = xyz(2) z1 = xyz(3) x2 = xyz(4) y2 = xyz(5) z2 = xyz(6) Call oMath.Distance(x1, y1, x2, y2, Distance) sDim = Trim$(Str$(Round(Distance, 2))) TextLength = Len(sDim) * TextScale * cAvax1.GetAvaxProperty(TextInitWidth_p) Call oMath.LineInclination(x2, y2, x1, y1, Angle) Call oMath.LineCenter(x1, y1, x2, y2, xc, yc) Call oMath.PolarPoint(xc, yc, Offset, Angle + 90, xNew1, yNew1) Call oMath.PolarPoint(xNew1, yNew1, TextLength / 2, Angle + 180, xNew, yNew) Call cAvax1.Add_Text(sDim, xNew, yNew, z, , TextScale, , Angle) End If Next lCnt End If Set oMath = Nothing End Sub Private Sub Form_Load() 'Add to references avMath.dll Set oMath = New cAvaxMath Command1.Caption = "Add Dimensions" Call cAvax1.StartAvax Call cAvax1.Add_Line(0, 0, 0, 10, 15, 0) Call cAvax1.Add_Line(0, 0, 0, 10, 0, 0) End Sub Private Sub Form_Unload(Cancel As Integer) Call cAvax1.EndAvax Set oMath = Nothing End Sub
Athanasios Gardos
Avax-Software.com
Avax-Software.com
Page 1 of 1
Sign In
Register
Help
Add Reply
MultiQuote