<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic help in VBA Forum</title>
    <link>https://forums.autodesk.com/t5/vba-forum/help/m-p/2193922#M20830</link>
    <description>I need to be able to place text in Autocad while controlling the angle and justification.  And I am havig trouble doing both.  I have known coordinates to place the text.   Can someone show me an example?</description>
    <pubDate>Sat, 01 Mar 2008 15:48:29 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2008-03-01T15:48:29Z</dc:date>
    <item>
      <title>help</title>
      <link>https://forums.autodesk.com/t5/vba-forum/help/m-p/2193922#M20830</link>
      <description>I need to be able to place text in Autocad while controlling the angle and justification.  And I am havig trouble doing both.  I have known coordinates to place the text.   Can someone show me an example?</description>
      <pubDate>Sat, 01 Mar 2008 15:48:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/help/m-p/2193922#M20830</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-03-01T15:48:29Z</dc:date>
    </item>
    <item>
      <title>Re: help</title>
      <link>https://forums.autodesk.com/t5/vba-forum/help/m-p/2193923#M20831</link>
      <description>This will label mtext 100 &amp;amp; 102 at the selected screen points with the &lt;BR /&gt;
rotation of the axis from pnt &amp;amp; pnt2&lt;BR /&gt;
&lt;BR /&gt;
hope this helps&lt;BR /&gt;
&lt;BR /&gt;
John&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Sub labeltext()&lt;BR /&gt;
Dim pt1 As Variant&lt;BR /&gt;
Dim Pt2 As Variant&lt;BR /&gt;
Dim Leftendelevation  As Double&lt;BR /&gt;
Dim Rightendelevation As Double&lt;BR /&gt;
Dim mtxtlabel As AcadMText&lt;BR /&gt;
Dim dblrot As Double&lt;BR /&gt;
&lt;BR /&gt;
pt1 = ThisDrawing.Utility.GetPoint(, "PICK FIRST RUNWAY END: LEFT TO RIGHT &lt;BR /&gt;
")&lt;BR /&gt;
' Get the value&lt;BR /&gt;
Leftendelevation = 100#&lt;BR /&gt;
&lt;BR /&gt;
Pt2 = ThisDrawing.Utility.GetPoint(pt1, "PICK SECOND RUNWAY END: ")&lt;BR /&gt;
' Get the station&lt;BR /&gt;
Rightendelevation = 102#&lt;BR /&gt;
&lt;BR /&gt;
dblrot = ThisDrawing.Utility.AngleFromXAxis(pt1, Pt2)&lt;BR /&gt;
Set mtxtlabel = ThisDrawing.ModelSpace.AddMText(pt1, dblWidth, &lt;BR /&gt;
Leftendelevation)&lt;BR /&gt;
    mtxtlabel.Height = 5&lt;BR /&gt;
    mtxtlabel.Rotation = dblrot&lt;BR /&gt;
&lt;BR /&gt;
Set mtxtlabel = ThisDrawing.ModelSpace.AddMText(Pt2, dblWidth, &lt;BR /&gt;
Rightendelevation)&lt;BR /&gt;
    mtxtlabel.Height = 5&lt;BR /&gt;
    mtxtlabel.Rotation = dblrot&lt;BR /&gt;
End Sub&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;DRKELLOG&gt; wrote in message &lt;BR /&gt;
news:5863525@discussion.autodesk.com...&lt;BR /&gt;
I need to be able to place text in Autocad while controlling the angle and &lt;BR /&gt;
justification.  And I am havig trouble doing both.  I have known coordinates &lt;BR /&gt;
to place the text.   Can someone show me an example?&lt;/DRKELLOG&gt;</description>
      <pubDate>Sun, 02 Mar 2008 12:32:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/help/m-p/2193923#M20831</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-03-02T12:32:37Z</dc:date>
    </item>
    <item>
      <title>Re: help</title>
      <link>https://forums.autodesk.com/t5/vba-forum/help/m-p/2193924#M20832</link>
      <description>To continue the prior thread&lt;BR /&gt;
Here is the same method for plain text:&lt;BR /&gt;
&lt;BR /&gt;
Sub AlignText()&lt;BR /&gt;
Dim sset As AcadSelectionSet&lt;BR /&gt;
Dim dxfCode, dxfValue&lt;BR /&gt;
Dim ftype(0) As Integer&lt;BR /&gt;
Dim fdata(0) As Variant&lt;BR /&gt;
ftype(0) = 0: fdata(0) = "LINE"&lt;BR /&gt;
dxfCode = ftype: dxfValue = fdata&lt;BR /&gt;
Dim lineObj As Object&lt;BR /&gt;
     Dim oText As AcadText&lt;BR /&gt;
     Dim oEnt As AcadEntity&lt;BR /&gt;
     Dim strText1 As String&lt;BR /&gt;
     Dim strText2 As String&lt;BR /&gt;
     Dim txtPt As Variant&lt;BR /&gt;
     Dim movePt1 As Variant&lt;BR /&gt;
     Dim movePt2 As Variant&lt;BR /&gt;
     Dim dblHgt As Double&lt;BR /&gt;
     Dim dblAng As Double&lt;BR /&gt;
     Dim moveAng As Double&lt;BR /&gt;
     Dim rotAng As Double&lt;BR /&gt;
     Dim PI As Double&lt;BR /&gt;
     PI = Atn(1) * 4&lt;BR /&gt;
&lt;BR /&gt;
     ' Define the new Text object&lt;BR /&gt;
     strText1 = "First line"&lt;BR /&gt;
     strText2 = "Second line"&lt;BR /&gt;
     dblHgt = 0.125&lt;BR /&gt;
   &lt;BR /&gt;
          With ThisDrawing.SelectionSets&lt;BR /&gt;
               While .Count &amp;gt; 0&lt;BR /&gt;
                    .Item(0).Delete&lt;BR /&gt;
               Wend&lt;BR /&gt;
          End With&lt;BR /&gt;
          &lt;BR /&gt;
Set sset = ThisDrawing.SelectionSets.Add("$Lines$")&lt;BR /&gt;
sset.SelectOnScreen dxfCode, dxfValue&lt;BR /&gt;
For Each oEnt In sset&lt;BR /&gt;
' get the line object&lt;BR /&gt;
Set lineObj = oEnt&lt;BR /&gt;
     txtPt = lineObj.StartPoint&lt;BR /&gt;
&lt;BR /&gt;
     ' get line angle&lt;BR /&gt;
     dblAng = lineObj.Angle&lt;BR /&gt;
     ' Debug.Print dblAng ' debug only&lt;BR /&gt;
     ' recalculate rotation angle&lt;BR /&gt;
     If dblAng &amp;gt;= 0 Then&lt;BR /&gt;
          rotAng = dblAng&lt;BR /&gt;
     End If&lt;BR /&gt;
&lt;BR /&gt;
     If dblAng &amp;gt; PI / 2 Then&lt;BR /&gt;
          rotAng = PI + dblAng&lt;BR /&gt;
     End If&lt;BR /&gt;
&lt;BR /&gt;
     If dblAng &amp;gt;= PI * 1.5 Then&lt;BR /&gt;
          rotAng = dblAng&lt;BR /&gt;
     End If&lt;BR /&gt;
     &lt;BR /&gt;
     If dblAng &amp;gt;= PI * 1.5 And dblAng &amp;lt;= PI * 2 _&lt;BR /&gt;
     Or dblAng &amp;lt;= PI / 2 And dblAng &amp;gt;= 0 Then&lt;BR /&gt;
               moveAng = dblAng + PI / 2&lt;BR /&gt;
               Else&lt;BR /&gt;
               moveAng = dblAng - PI / 2&lt;BR /&gt;
               End If&lt;BR /&gt;
                    &lt;BR /&gt;
     ' Debug.Print rotAng ' debug only&lt;BR /&gt;
     ' update text object&lt;BR /&gt;
     movePt1 = ThisDrawing.Utility.PolarPoint(txtPt, moveAng, 0.25 * dblHgt) '&amp;lt; --0.25 * dblHgt is text offset change to suit&lt;BR /&gt;
     ' Create the Text object in model space&lt;BR /&gt;
     Set oText = ThisDrawing.ModelSpace.AddText(strText1, movePt1, dblHgt)&lt;BR /&gt;
&lt;BR /&gt;
     oText.Alignment = acAlignmentBottomCenter&lt;BR /&gt;
     oText.TextAlignmentPoint = movePt1&lt;BR /&gt;
     oText.Rotation = rotAng&lt;BR /&gt;
     movePt2 = ThisDrawing.Utility.PolarPoint(txtPt, moveAng + PI, 0.25 * dblHgt)  '&amp;lt; --0.25 * dblHgt is text offset change to suit&lt;BR /&gt;
     ' Create the Text object in model space&lt;BR /&gt;
     Set oText = ThisDrawing.ModelSpace.AddText(strText2, movePt2, dblHgt)&lt;BR /&gt;
     oText.Alignment = acAlignmentTopCenter&lt;BR /&gt;
     oText.TextAlignmentPoint = movePt2&lt;BR /&gt;
     oText.Rotation = rotAng&lt;BR /&gt;
     &lt;BR /&gt;
Next oEnt&lt;BR /&gt;
     &lt;BR /&gt;
End Sub&lt;BR /&gt;
&lt;BR /&gt;
~'J'~</description>
      <pubDate>Sun, 02 Mar 2008 15:47:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/help/m-p/2193924#M20832</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-03-02T15:47:00Z</dc:date>
    </item>
  </channel>
</rss>

