<?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 Re: Get Angle between two points in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/get-angle-between-two-points/m-p/7183538#M57428</link>
    <description>&lt;P&gt;Dear Mark,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your query.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The AngleTo method documentation says that it "returns the angle between this vector and the specified vector":&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.revitapidocs.com/2017/4251dd2b-1b48-8b2e-7159-02333cdf39e6.htm" target="_blank"&gt;http://www.revitapidocs.com/2017/4251dd2b-1b48-8b2e-7159-02333cdf39e6.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The input you define above is given as points.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You need to convert your point input to vectors, e.g.:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;  XYZ pt1 = New XYZ(2142.371247, -2066.73581, 0)
  XYZ pt2 = New XYZ(2142.371247, -1989.581039, 0)
  XYZ vector_from_pt1_to_pt2 = pts - pt1
  double angle = vector_from_pt1_to_pt2.AngleTo( XYZ.BasisX )&lt;/PRE&gt;
&lt;P&gt;By the way, if you are just starting to explore the Revit API, I would strongly suggest working through the getting started material first:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://thebuildingcoder.typepad.com/blog/about-the-author.html#2" target="_blank"&gt;http://thebuildingcoder.typepad.com/blog/about-the-author.html#2&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope this helps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jeremy&lt;/P&gt;</description>
    <pubDate>Tue, 27 Jun 2017 21:40:02 GMT</pubDate>
    <dc:creator>jeremytammik</dc:creator>
    <dc:date>2017-06-27T21:40:02Z</dc:date>
    <item>
      <title>Get Angle between two points</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/get-angle-between-two-points/m-p/7182389#M57427</link>
      <description>&lt;P&gt;With the Plant 3D or AutoCAD .NET API, I can "calculate a vector between two points and determines the angle from the X-axis" like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Plant 3D
--------------------
Dim pt1 As New Point2d(2142.371247, -2066.73581)
Dim pt2 As New Point2d(2142.371247, -1989.581039)
Dim angle As Double = pt1.GetVectorTo(pt2).Angle	'RETURNS 1.5707963267948966 IN RADIANS, WHICH IS 90-DEGREES&lt;/PRE&gt;
&lt;P&gt;I'm not able to do likewise with the Revit API however. I've tried the "AngleOnPlaneTo" and "AngleTo" but do not get the expected results as above:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &lt;/P&gt;
&lt;PRE&gt;Dim pt1 As New XYZ(2142.371247, -2066.73581)
Dim pt2 As New XYZ(2142.371247, -1989.581039)
Dim angle2 As Double = pt1.AngleOnPlaneTo(pt2, New XYZ(0, 0, 1))	'RETURNS 0.01899334843737778
Dim angle3 As Double = pt1.AngleTo(pt2)	'RETURNS 0.018159197737853211&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Any suggestions?&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jun 2017 14:29:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/get-angle-between-two-points/m-p/7182389#M57427</guid>
      <dc:creator>MarkSanchezSPEC</dc:creator>
      <dc:date>2017-06-27T14:29:40Z</dc:date>
    </item>
    <item>
      <title>Re: Get Angle between two points</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/get-angle-between-two-points/m-p/7183538#M57428</link>
      <description>&lt;P&gt;Dear Mark,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your query.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The AngleTo method documentation says that it "returns the angle between this vector and the specified vector":&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.revitapidocs.com/2017/4251dd2b-1b48-8b2e-7159-02333cdf39e6.htm" target="_blank"&gt;http://www.revitapidocs.com/2017/4251dd2b-1b48-8b2e-7159-02333cdf39e6.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The input you define above is given as points.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You need to convert your point input to vectors, e.g.:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;  XYZ pt1 = New XYZ(2142.371247, -2066.73581, 0)
  XYZ pt2 = New XYZ(2142.371247, -1989.581039, 0)
  XYZ vector_from_pt1_to_pt2 = pts - pt1
  double angle = vector_from_pt1_to_pt2.AngleTo( XYZ.BasisX )&lt;/PRE&gt;
&lt;P&gt;By the way, if you are just starting to explore the Revit API, I would strongly suggest working through the getting started material first:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://thebuildingcoder.typepad.com/blog/about-the-author.html#2" target="_blank"&gt;http://thebuildingcoder.typepad.com/blog/about-the-author.html#2&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope this helps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jeremy&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jun 2017 21:40:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/get-angle-between-two-points/m-p/7183538#M57428</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2017-06-27T21:40:02Z</dc:date>
    </item>
    <item>
      <title>Re: Get Angle between two points</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/get-angle-between-two-points/m-p/7183606#M57429</link>
      <description>&lt;P&gt;Thank you sir.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jun 2017 22:12:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/get-angle-between-two-points/m-p/7183606#M57429</guid>
      <dc:creator>MarkSanchezSPEC</dc:creator>
      <dc:date>2017-06-27T22:12:32Z</dc:date>
    </item>
  </channel>
</rss>

